From 1519079f693b6a3f3acc9c19d11eca07882dadc1 Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 8 Oct 2022 21:50:46 +0500 Subject: [PATCH] trying new format with two seperate npm packages --- .github/workflows/publish.yml | 5 + .gitignore | 5 +- get-words.js | 10 +- library-post-build.js | 30 - library-tsconfig.json | 31 - package.json | 20 +- src/App.tsx | 22 +- src/components.ts | 69 - src/components/EntrySelect.tsx | 182 - src/components/ep-explorer/EquativePicker.tsx | 111 - src/{ => components}/images.d.ts | 0 src/components/lib-tsconfig.json | 29 + src/components/library.ts | 78 + src/components/node_modules/.bin/loose-envify | 1 + src/components/node_modules/.bin/lz-string | 1 + src/components/node_modules/.bin/resolve | 1 + src/components/node_modules/.yarn-integrity | 108 + .../node_modules/@babel/code-frame/LICENSE | 22 + .../node_modules/@babel/code-frame/README.md | 19 + .../@babel/code-frame/lib/index.js | 163 + .../@babel/code-frame/package.json | 30 + .../@babel/helper-module-imports/LICENSE | 22 + .../@babel/helper-module-imports/README.md | 19 + .../lib/import-builder.js | 164 + .../lib/import-injector.js | 280 + .../@babel/helper-module-imports/lib/index.js | 41 + .../helper-module-imports/lib/is-module.js | 18 + .../@babel/helper-module-imports/package.json | 28 + .../@babel/helper-plugin-utils/LICENSE | 22 + .../@babel/helper-plugin-utils/README.md | 19 + .../@babel/helper-plugin-utils/lib/index.js | 97 + .../helper-plugin-utils/lib/index.js.map | 1 + .../@babel/helper-plugin-utils/package.json | 21 + .../@babel/helper-string-parser/LICENSE | 22 + .../@babel/helper-string-parser/README.md | 19 + .../@babel/helper-string-parser/lib/index.js | 328 + .../@babel/helper-string-parser/package.json | 28 + .../helper-validator-identifier/LICENSE | 22 + .../helper-validator-identifier/README.md | 19 + .../lib/identifier.js | 86 + .../lib/identifier.js.map | 1 + .../helper-validator-identifier/lib/index.js | 59 + .../lib/index.js.map | 1 + .../lib/keyword.js | 40 + .../lib/keyword.js.map | 1 + .../helper-validator-identifier/package.json | 28 + .../scripts/generate-identifier-regex.js | 75 + .../node_modules/@babel/highlight/LICENSE | 22 + .../node_modules/@babel/highlight/README.md | 19 + .../@babel/highlight/lib/index.js | 116 + .../@babel/highlight/package.json | 30 + .../@babel/plugin-syntax-jsx/LICENSE | 22 + .../@babel/plugin-syntax-jsx/README.md | 19 + .../@babel/plugin-syntax-jsx/lib/index.js | 30 + .../@babel/plugin-syntax-jsx/package.json | 33 + .../node_modules/@babel/runtime/LICENSE | 22 + .../node_modules/@babel/runtime/README.md | 19 + .../@babel/runtime/helpers/AsyncGenerator.js | 73 + .../@babel/runtime/helpers/AwaitValue.js | 5 + .../@babel/runtime/helpers/OverloadYield.js | 5 + .../helpers/applyDecoratedDescriptor.js | 30 + .../@babel/runtime/helpers/applyDecs.js | 284 + .../@babel/runtime/helpers/applyDecs2203.js | 222 + .../runtime/helpers/arrayLikeToArray.js | 11 + .../@babel/runtime/helpers/arrayWithHoles.js | 5 + .../runtime/helpers/arrayWithoutHoles.js | 7 + .../runtime/helpers/assertThisInitialized.js | 9 + .../runtime/helpers/asyncGeneratorDelegate.js | 28 + .../@babel/runtime/helpers/asyncIterator.js | 50 + .../runtime/helpers/asyncToGenerator.js | 37 + .../runtime/helpers/awaitAsyncGenerator.js | 7 + .../helpers/checkPrivateRedeclaration.js | 7 + .../classApplyDescriptorDestructureSet.js | 22 + .../helpers/classApplyDescriptorGet.js | 9 + .../helpers/classApplyDescriptorSet.js | 13 + .../@babel/runtime/helpers/classCallCheck.js | 7 + .../helpers/classCheckPrivateStaticAccess.js | 7 + .../classCheckPrivateStaticFieldDescriptor.js | 7 + .../helpers/classExtractFieldDescriptor.js | 9 + .../runtime/helpers/classNameTDZError.js | 5 + .../classPrivateFieldDestructureSet.js | 10 + .../runtime/helpers/classPrivateFieldGet.js | 10 + .../helpers/classPrivateFieldInitSpec.js | 8 + .../helpers/classPrivateFieldLooseBase.js | 9 + .../helpers/classPrivateFieldLooseKey.js | 7 + .../runtime/helpers/classPrivateFieldSet.js | 11 + .../runtime/helpers/classPrivateMethodGet.js | 9 + .../helpers/classPrivateMethodInitSpec.js | 8 + .../runtime/helpers/classPrivateMethodSet.js | 5 + .../classStaticPrivateFieldDestructureSet.js | 13 + .../helpers/classStaticPrivateFieldSpecGet.js | 13 + .../helpers/classStaticPrivateFieldSpecSet.js | 14 + .../helpers/classStaticPrivateMethodGet.js | 8 + .../helpers/classStaticPrivateMethodSet.js | 5 + .../@babel/runtime/helpers/construct.js | 22 + .../@babel/runtime/helpers/createClass.js | 20 + .../helpers/createForOfIteratorHelper.js | 60 + .../helpers/createForOfIteratorHelperLoose.js | 24 + .../@babel/runtime/helpers/createSuper.js | 24 + .../@babel/runtime/helpers/decorate.js | 400 + .../@babel/runtime/helpers/defaults.js | 16 + .../helpers/defineEnumerableProperties.js | 24 + .../@babel/runtime/helpers/defineProperty.js | 16 + .../runtime/helpers/esm/AsyncGenerator.js | 70 + .../@babel/runtime/helpers/esm/AwaitValue.js | 3 + .../runtime/helpers/esm/OverloadYield.js | 3 + .../helpers/esm/applyDecoratedDescriptor.js | 28 + .../@babel/runtime/helpers/esm/applyDecs.js | 282 + .../runtime/helpers/esm/applyDecs2203.js | 220 + .../runtime/helpers/esm/arrayLikeToArray.js | 9 + .../runtime/helpers/esm/arrayWithHoles.js | 3 + .../runtime/helpers/esm/arrayWithoutHoles.js | 4 + .../helpers/esm/assertThisInitialized.js | 7 + .../helpers/esm/asyncGeneratorDelegate.js | 25 + .../runtime/helpers/esm/asyncIterator.js | 48 + .../runtime/helpers/esm/asyncToGenerator.js | 35 + .../helpers/esm/awaitAsyncGenerator.js | 4 + .../helpers/esm/checkPrivateRedeclaration.js | 5 + .../esm/classApplyDescriptorDestructureSet.js | 20 + .../helpers/esm/classApplyDescriptorGet.js | 7 + .../helpers/esm/classApplyDescriptorSet.js | 11 + .../runtime/helpers/esm/classCallCheck.js | 5 + .../esm/classCheckPrivateStaticAccess.js | 5 + .../classCheckPrivateStaticFieldDescriptor.js | 5 + .../esm/classExtractFieldDescriptor.js | 7 + .../runtime/helpers/esm/classNameTDZError.js | 3 + .../esm/classPrivateFieldDestructureSet.js | 6 + .../helpers/esm/classPrivateFieldGet.js | 6 + .../helpers/esm/classPrivateFieldInitSpec.js | 5 + .../helpers/esm/classPrivateFieldLooseBase.js | 7 + .../helpers/esm/classPrivateFieldLooseKey.js | 4 + .../helpers/esm/classPrivateFieldSet.js | 7 + .../helpers/esm/classPrivateMethodGet.js | 7 + .../helpers/esm/classPrivateMethodInitSpec.js | 5 + .../helpers/esm/classPrivateMethodSet.js | 3 + .../classStaticPrivateFieldDestructureSet.js | 8 + .../esm/classStaticPrivateFieldSpecGet.js | 8 + .../esm/classStaticPrivateFieldSpecSet.js | 9 + .../esm/classStaticPrivateMethodGet.js | 5 + .../esm/classStaticPrivateMethodSet.js | 3 + .../@babel/runtime/helpers/esm/construct.js | 18 + .../@babel/runtime/helpers/esm/createClass.js | 18 + .../helpers/esm/createForOfIteratorHelper.js | 57 + .../esm/createForOfIteratorHelperLoose.js | 21 + .../@babel/runtime/helpers/esm/createSuper.js | 19 + .../@babel/runtime/helpers/esm/decorate.js | 396 + .../@babel/runtime/helpers/esm/defaults.js | 14 + .../helpers/esm/defineEnumerableProperties.js | 22 + .../runtime/helpers/esm/defineProperty.js | 14 + .../@babel/runtime/helpers/esm/extends.js | 16 + .../@babel/runtime/helpers/esm/get.js | 20 + .../runtime/helpers/esm/getPrototypeOf.js | 6 + .../@babel/runtime/helpers/esm/identity.js | 3 + .../@babel/runtime/helpers/esm/inherits.js | 18 + .../runtime/helpers/esm/inheritsLoose.js | 6 + .../helpers/esm/initializerDefineProperty.js | 9 + .../helpers/esm/initializerWarningHelper.js | 3 + .../@babel/runtime/helpers/esm/instanceof.js | 7 + .../helpers/esm/interopRequireDefault.js | 5 + .../helpers/esm/interopRequireWildcard.js | 51 + .../runtime/helpers/esm/isNativeFunction.js | 3 + .../helpers/esm/isNativeReflectConstruct.js | 12 + .../runtime/helpers/esm/iterableToArray.js | 3 + .../helpers/esm/iterableToArrayLimit.js | 29 + .../helpers/esm/iterableToArrayLimitLoose.js | 14 + .../@babel/runtime/helpers/esm/jsx.js | 26 + .../runtime/helpers/esm/maybeArrayLike.js | 9 + .../runtime/helpers/esm/newArrowCheck.js | 5 + .../runtime/helpers/esm/nonIterableRest.js | 3 + .../runtime/helpers/esm/nonIterableSpread.js | 3 + .../helpers/esm/objectDestructuringEmpty.js | 3 + .../runtime/helpers/esm/objectSpread.js | 19 + .../runtime/helpers/esm/objectSpread2.js | 27 + .../helpers/esm/objectWithoutProperties.js | 19 + .../esm/objectWithoutPropertiesLoose.js | 14 + .../@babel/runtime/helpers/esm/package.json | 3 + .../helpers/esm/possibleConstructorReturn.js | 11 + .../runtime/helpers/esm/readOnlyError.js | 3 + .../runtime/helpers/esm/regeneratorRuntime.js | 352 + .../@babel/runtime/helpers/esm/set.js | 51 + .../runtime/helpers/esm/setPrototypeOf.js | 7 + .../helpers/esm/skipFirstGeneratorNext.js | 7 + .../runtime/helpers/esm/slicedToArray.js | 7 + .../runtime/helpers/esm/slicedToArrayLoose.js | 7 + .../runtime/helpers/esm/superPropBase.js | 9 + .../helpers/esm/taggedTemplateLiteral.js | 11 + .../helpers/esm/taggedTemplateLiteralLoose.js | 8 + .../@babel/runtime/helpers/esm/tdz.js | 3 + .../@babel/runtime/helpers/esm/temporalRef.js | 5 + .../runtime/helpers/esm/temporalUndefined.js | 1 + .../@babel/runtime/helpers/esm/toArray.js | 7 + .../runtime/helpers/esm/toConsumableArray.js | 7 + .../@babel/runtime/helpers/esm/toPrimitive.js | 13 + .../runtime/helpers/esm/toPropertyKey.js | 6 + .../@babel/runtime/helpers/esm/typeof.js | 9 + .../helpers/esm/unsupportedIterableToArray.js | 9 + .../runtime/helpers/esm/wrapAsyncGenerator.js | 6 + .../runtime/helpers/esm/wrapNativeSuper.js | 37 + .../@babel/runtime/helpers/esm/wrapRegExp.js | 58 + .../runtime/helpers/esm/writeOnlyError.js | 3 + .../@babel/runtime/helpers/extends.js | 18 + .../@babel/runtime/helpers/get.js | 23 + .../@babel/runtime/helpers/getPrototypeOf.js | 8 + .../@babel/runtime/helpers/identity.js | 5 + .../@babel/runtime/helpers/inherits.js | 21 + .../@babel/runtime/helpers/inheritsLoose.js | 9 + .../helpers/initializerDefineProperty.js | 11 + .../helpers/initializerWarningHelper.js | 5 + .../@babel/runtime/helpers/instanceof.js | 9 + .../runtime/helpers/interopRequireDefault.js | 7 + .../runtime/helpers/interopRequireWildcard.js | 53 + .../runtime/helpers/isNativeFunction.js | 5 + .../helpers/isNativeReflectConstruct.js | 14 + .../@babel/runtime/helpers/iterableToArray.js | 5 + .../runtime/helpers/iterableToArrayLimit.js | 31 + .../helpers/iterableToArrayLimitLoose.js | 16 + .../@babel/runtime/helpers/jsx.js | 29 + .../@babel/runtime/helpers/maybeArrayLike.js | 12 + .../@babel/runtime/helpers/newArrowCheck.js | 7 + .../@babel/runtime/helpers/nonIterableRest.js | 5 + .../runtime/helpers/nonIterableSpread.js | 5 + .../helpers/objectDestructuringEmpty.js | 5 + .../@babel/runtime/helpers/objectSpread.js | 22 + .../@babel/runtime/helpers/objectSpread2.js | 29 + .../helpers/objectWithoutProperties.js | 22 + .../helpers/objectWithoutPropertiesLoose.js | 16 + .../helpers/possibleConstructorReturn.js | 15 + .../@babel/runtime/helpers/readOnlyError.js | 5 + .../runtime/helpers/regeneratorRuntime.js | 354 + .../@babel/runtime/helpers/set.js | 54 + .../@babel/runtime/helpers/setPrototypeOf.js | 9 + .../runtime/helpers/skipFirstGeneratorNext.js | 9 + .../@babel/runtime/helpers/slicedToArray.js | 13 + .../runtime/helpers/slicedToArrayLoose.js | 13 + .../@babel/runtime/helpers/superPropBase.js | 12 + .../runtime/helpers/taggedTemplateLiteral.js | 13 + .../helpers/taggedTemplateLiteralLoose.js | 10 + .../@babel/runtime/helpers/tdz.js | 5 + .../@babel/runtime/helpers/temporalRef.js | 9 + .../runtime/helpers/temporalUndefined.js | 3 + .../@babel/runtime/helpers/toArray.js | 13 + .../runtime/helpers/toConsumableArray.js | 13 + .../@babel/runtime/helpers/toPrimitive.js | 16 + .../@babel/runtime/helpers/toPropertyKey.js | 10 + .../@babel/runtime/helpers/typeof.js | 11 + .../helpers/unsupportedIterableToArray.js | 12 + .../runtime/helpers/wrapAsyncGenerator.js | 9 + .../@babel/runtime/helpers/wrapNativeSuper.js | 42 + .../@babel/runtime/helpers/wrapRegExp.js | 63 + .../@babel/runtime/helpers/writeOnlyError.js | 5 + .../node_modules/@babel/runtime/package.json | 894 + .../@babel/runtime/regenerator/index.js | 15 + .../node_modules/@babel/types/LICENSE | 22 + .../node_modules/@babel/types/README.md | 19 + .../@babel/types/lib/asserts/assertNode.js | 19 + .../types/lib/asserts/assertNode.js.map | 1 + .../types/lib/asserts/generated/index.js | 1524 ++ .../types/lib/asserts/generated/index.js.map | 1 + .../types/lib/ast-types/generated/index.js | 3 + .../lib/ast-types/generated/index.js.map | 1 + .../lib/builders/flow/createFlowUnionType.js | 22 + .../builders/flow/createFlowUnionType.js.map | 1 + .../flow/createTypeAnnotationBasedOnTypeof.js | 43 + .../createTypeAnnotationBasedOnTypeof.js.map | 1 + .../types/lib/builders/generated/index.js | 2229 ++ .../types/lib/builders/generated/index.js.map | 1 + .../types/lib/builders/generated/uppercase.js | 1521 ++ .../lib/builders/generated/uppercase.js.map | 1 + .../types/lib/builders/react/buildChildren.js | 31 + .../lib/builders/react/buildChildren.js.map | 1 + .../builders/typescript/createTSUnionType.js | 27 + .../typescript/createTSUnionType.js.map | 1 + .../@babel/types/lib/builders/validateNode.js | 22 + .../types/lib/builders/validateNode.js.map | 1 + .../@babel/types/lib/clone/clone.js | 14 + .../@babel/types/lib/clone/clone.js.map | 1 + .../@babel/types/lib/clone/cloneDeep.js | 14 + .../@babel/types/lib/clone/cloneDeep.js.map | 1 + .../types/lib/clone/cloneDeepWithoutLoc.js | 14 + .../lib/clone/cloneDeepWithoutLoc.js.map | 1 + .../@babel/types/lib/clone/cloneNode.js | 122 + .../@babel/types/lib/clone/cloneNode.js.map | 1 + .../@babel/types/lib/clone/cloneWithoutLoc.js | 14 + .../types/lib/clone/cloneWithoutLoc.js.map | 1 + .../@babel/types/lib/comments/addComment.js | 17 + .../types/lib/comments/addComment.js.map | 1 + .../@babel/types/lib/comments/addComments.js | 25 + .../types/lib/comments/addComments.js.map | 1 + .../lib/comments/inheritInnerComments.js | 14 + .../lib/comments/inheritInnerComments.js.map | 1 + .../lib/comments/inheritLeadingComments.js | 14 + .../comments/inheritLeadingComments.js.map | 1 + .../lib/comments/inheritTrailingComments.js | 14 + .../comments/inheritTrailingComments.js.map | 1 + .../types/lib/comments/inheritsComments.js | 21 + .../lib/comments/inheritsComments.js.map | 1 + .../types/lib/comments/removeComments.js | 18 + .../types/lib/comments/removeComments.js.map | 1 + .../types/lib/constants/generated/index.js | 109 + .../lib/constants/generated/index.js.map | 1 + .../@babel/types/lib/constants/index.js | 51 + .../@babel/types/lib/constants/index.js.map | 1 + .../types/lib/converters/ensureBlock.js | 16 + .../types/lib/converters/ensureBlock.js.map | 1 + .../converters/gatherSequenceExpressions.js | 77 + .../gatherSequenceExpressions.js.map | 1 + .../lib/converters/toBindingIdentifierName.js | 16 + .../converters/toBindingIdentifierName.js.map | 1 + .../@babel/types/lib/converters/toBlock.js | 36 + .../types/lib/converters/toBlock.js.map | 1 + .../types/lib/converters/toComputedKey.js | 17 + .../types/lib/converters/toComputedKey.js.map | 1 + .../types/lib/converters/toExpression.js | 35 + .../types/lib/converters/toExpression.js.map | 1 + .../types/lib/converters/toIdentifier.js | 32 + .../types/lib/converters/toIdentifier.js.map | 1 + .../@babel/types/lib/converters/toKeyAlias.js | 48 + .../types/lib/converters/toKeyAlias.js.map | 1 + .../lib/converters/toSequenceExpression.js | 23 + .../converters/toSequenceExpression.js.map | 1 + .../types/lib/converters/toStatement.js | 49 + .../types/lib/converters/toStatement.js.map | 1 + .../types/lib/converters/valueToNode.js | 101 + .../types/lib/converters/valueToNode.js.map | 1 + .../@babel/types/lib/definitions/core.js | 1716 ++ .../@babel/types/lib/definitions/core.js.map | 1 + .../types/lib/definitions/experimental.js | 135 + .../types/lib/definitions/experimental.js.map | 1 + .../@babel/types/lib/definitions/flow.js | 488 + .../@babel/types/lib/definitions/flow.js.map | 1 + .../@babel/types/lib/definitions/index.js | 105 + .../@babel/types/lib/definitions/index.js.map | 1 + .../@babel/types/lib/definitions/jsx.js | 159 + .../@babel/types/lib/definitions/jsx.js.map | 1 + .../@babel/types/lib/definitions/misc.js | 34 + .../@babel/types/lib/definitions/misc.js.map | 1 + .../types/lib/definitions/placeholders.js | 35 + .../types/lib/definitions/placeholders.js.map | 1 + .../types/lib/definitions/typescript.js | 497 + .../types/lib/definitions/typescript.js.map | 1 + .../@babel/types/lib/definitions/utils.js | 345 + .../@babel/types/lib/definitions/utils.js.map | 1 + .../@babel/types/lib/index-legacy.d.ts | 2732 +++ .../node_modules/@babel/types/lib/index.d.ts | 3221 +++ .../@babel/types/lib/index.d.ts.map | 1 + .../node_modules/@babel/types/lib/index.js | 649 + .../@babel/types/lib/index.js.flow | 2586 ++ .../@babel/types/lib/index.js.map | 1 + .../modifications/appendToMemberExpression.js | 17 + .../appendToMemberExpression.js.map | 1 + .../flow/removeTypeDuplicates.js | 80 + .../flow/removeTypeDuplicates.js.map | 1 + .../types/lib/modifications/inherits.js | 35 + .../types/lib/modifications/inherits.js.map | 1 + .../prependToMemberExpression.js | 21 + .../prependToMemberExpression.js.map | 1 + .../lib/modifications/removeProperties.js | 31 + .../lib/modifications/removeProperties.js.map | 1 + .../lib/modifications/removePropertiesDeep.js | 17 + .../modifications/removePropertiesDeep.js.map | 1 + .../typescript/removeTypeDuplicates.js | 80 + .../typescript/removeTypeDuplicates.js.map | 1 + .../lib/retrievers/getBindingIdentifiers.js | 107 + .../retrievers/getBindingIdentifiers.js.map | 1 + .../retrievers/getOuterBindingIdentifiers.js | 17 + .../getOuterBindingIdentifiers.js.map | 1 + .../@babel/types/lib/traverse/traverse.js | 57 + .../@babel/types/lib/traverse/traverse.js.map | 1 + .../@babel/types/lib/traverse/traverseFast.js | 30 + .../types/lib/traverse/traverseFast.js.map | 1 + .../@babel/types/lib/utils/inherit.js | 14 + .../@babel/types/lib/utils/inherit.js.map | 1 + .../react/cleanJSXElementLiteralChild.js | 49 + .../react/cleanJSXElementLiteralChild.js.map | 1 + .../@babel/types/lib/utils/shallowEqual.js | 20 + .../types/lib/utils/shallowEqual.js.map | 1 + .../validators/buildMatchMemberExpression.js | 15 + .../buildMatchMemberExpression.js.map | 1 + .../types/lib/validators/generated/index.js | 4829 ++++ .../lib/validators/generated/index.js.map | 1 + .../@babel/types/lib/validators/is.js | 35 + .../@babel/types/lib/validators/is.js.map | 1 + .../@babel/types/lib/validators/isBinding.js | 33 + .../types/lib/validators/isBinding.js.map | 1 + .../types/lib/validators/isBlockScoped.js | 16 + .../types/lib/validators/isBlockScoped.js.map | 1 + .../types/lib/validators/isImmutable.js | 26 + .../types/lib/validators/isImmutable.js.map | 1 + .../@babel/types/lib/validators/isLet.js | 16 + .../@babel/types/lib/validators/isLet.js.map | 1 + .../@babel/types/lib/validators/isNode.js | 14 + .../@babel/types/lib/validators/isNode.js.map | 1 + .../types/lib/validators/isNodesEquivalent.js | 72 + .../lib/validators/isNodesEquivalent.js.map | 1 + .../types/lib/validators/isPlaceholderType.js | 23 + .../lib/validators/isPlaceholderType.js.map | 1 + .../types/lib/validators/isReferenced.js | 130 + .../types/lib/validators/isReferenced.js.map | 1 + .../@babel/types/lib/validators/isScope.js | 22 + .../types/lib/validators/isScope.js.map | 1 + .../lib/validators/isSpecifierDefault.js | 16 + .../lib/validators/isSpecifierDefault.js.map | 1 + .../@babel/types/lib/validators/isType.js | 26 + .../@babel/types/lib/validators/isType.js.map | 1 + .../lib/validators/isValidES3Identifier.js | 16 + .../validators/isValidES3Identifier.js.map | 1 + .../types/lib/validators/isValidIdentifier.js | 22 + .../lib/validators/isValidIdentifier.js.map | 1 + .../@babel/types/lib/validators/isVar.js | 18 + .../@babel/types/lib/validators/isVar.js.map | 1 + .../types/lib/validators/matchesPattern.js | 44 + .../lib/validators/matchesPattern.js.map | 1 + .../types/lib/validators/react/isCompatTag.js | 12 + .../lib/validators/react/isCompatTag.js.map | 1 + .../lib/validators/react/isReactComponent.js | 14 + .../validators/react/isReactComponent.js.map | 1 + .../@babel/types/lib/validators/validate.js | 34 + .../types/lib/validators/validate.js.map | 1 + .../node_modules/@babel/types/package.json | 41 + .../types/scripts/generators/asserts.js | 55 + .../types/scripts/generators/ast-types.js | 196 + .../types/scripts/generators/builders.js | 193 + .../types/scripts/generators/constants.js | 15 + .../@babel/types/scripts/generators/docs.js | 283 + .../@babel/types/scripts/generators/flow.js | 260 + .../scripts/generators/typescript-legacy.js | 369 + .../types/scripts/generators/validators.js | 91 + .../@babel/types/scripts/package.json | 1 + .../types/scripts/utils/formatBuilderName.js | 8 + .../@babel/types/scripts/utils/lowerFirst.js | 3 + .../types/scripts/utils/stringifyValidator.js | 69 + .../types/scripts/utils/toFunctionName.js | 4 + .../@emotion/babel-plugin/LICENSE | 21 + .../@emotion/babel-plugin/README.md | 346 + .../@emotion/babel-plugin/package.json | 54 + .../@emotion/babel-plugin/src/core-macro.js | 198 + .../babel-plugin/src/emotion-macro.js | 63 + .../@emotion/babel-plugin/src/index.js | 300 + .../@emotion/babel-plugin/src/styled-macro.js | 141 + .../babel-plugin/src/utils/add-import.js | 30 + .../src/utils/create-node-env-conditional.js | 14 + .../src/utils/get-styled-options.js | 103 + .../src/utils/get-target-class-name.js | 52 + .../@emotion/babel-plugin/src/utils/index.js | 13 + .../@emotion/babel-plugin/src/utils/label.js | 193 + .../@emotion/babel-plugin/src/utils/minify.js | 153 + .../src/utils/object-to-string.js | 40 + .../babel-plugin/src/utils/source-maps.js | 45 + .../babel-plugin/src/utils/strings.js | 61 + .../utils/transform-expression-with-styles.js | 149 + .../src/utils/transformer-macro.js | 58 + .../src/utils/transpiled-output-utils.js | 80 + .../node_modules/@emotion/cache/LICENSE | 21 + .../node_modules/@emotion/cache/README.md | 62 + .../node_modules/@emotion/cache/package.json | 52 + .../@emotion/cache/src/index.d.ts | 2 + .../node_modules/@emotion/cache/src/index.js | 269 + .../@emotion/cache/src/stylis-plugins.js | 269 + .../node_modules/@emotion/cache/src/types.js | 26 + .../@emotion/cache/types/index.d.ts | 44 + .../node_modules/@emotion/hash/LICENSE | 21 + .../node_modules/@emotion/hash/README.md | 11 + .../node_modules/@emotion/hash/package.json | 32 + .../node_modules/@emotion/hash/src/index.d.ts | 2 + .../node_modules/@emotion/hash/src/index.js | 64 + .../@emotion/hash/types/index.d.ts | 1 + .../node_modules/@emotion/memoize/LICENSE | 21 + .../@emotion/memoize/package.json | 32 + .../@emotion/memoize/src/index.d.ts | 2 + .../@emotion/memoize/src/index.js | 10 + .../@emotion/memoize/types/index.d.ts | 3 + .../node_modules/@emotion/react/LICENSE | 21 + .../node_modules/@emotion/react/README.md | 48 + .../react/_isolated-hnrs/package.json | 12 + .../react/jsx-dev-runtime/package.json | 13 + .../@emotion/react/jsx-runtime/package.json | 13 + .../node_modules/@emotion/react/macro.d.ts | 1 + .../node_modules/@emotion/react/macro.js | 1 + .../node_modules/@emotion/react/macro.js.flow | 2 + .../node_modules/@emotion/react/package.json | 122 + .../@emotion/react/src/_isolated-hnrs.d.ts | 3 + .../@emotion/react/src/_isolated-hnrs.js | 10 + .../@emotion/react/src/class-names.js | 166 + .../@emotion/react/src/context.js | 69 + .../node_modules/@emotion/react/src/css.js | 10 + .../@emotion/react/src/emotion-element.js | 164 + .../react/src/get-label-from-stack-trace.js | 55 + .../node_modules/@emotion/react/src/global.js | 143 + .../@emotion/react/src/index.d.ts | 1 + .../node_modules/@emotion/react/src/index.js | 42 + .../@emotion/react/src/jsx-dev-runtime.d.ts | 1 + .../@emotion/react/src/jsx-dev-runtime.js | 35 + .../@emotion/react/src/jsx-runtime.d.ts | 1 + .../@emotion/react/src/jsx-runtime.js | 22 + .../node_modules/@emotion/react/src/jsx.js | 29 + .../@emotion/react/src/keyframes.js | 23 + .../@emotion/react/src/theming.js | 79 + .../node_modules/@emotion/react/src/utils.js | 4 + .../@emotion/react/types/css-prop.d.ts | 9 + .../@emotion/react/types/helper.d.ts | 14 + .../@emotion/react/types/index.d.ts | 114 + .../@emotion/react/types/jsx-dev-runtime.d.ts | 1 + .../@emotion/react/types/jsx-namespace.d.ts | 40 + .../@emotion/react/types/jsx-runtime.d.ts | 1 + .../@emotion/react/types/theming.d.ts | 31 + .../node_modules/@emotion/serialize/LICENSE | 21 + .../@emotion/serialize/package.json | 52 + .../@emotion/serialize/src/index.d.ts | 2 + .../@emotion/serialize/src/index.js | 388 + .../@emotion/serialize/types/index.d.ts | 69 + .../node_modules/@emotion/sheet/LICENSE | 21 + .../node_modules/@emotion/sheet/README.md | 121 + .../node_modules/@emotion/sheet/package.json | 45 + .../@emotion/sheet/src/index.d.ts | 2 + .../node_modules/@emotion/sheet/src/index.js | 175 + .../@emotion/sheet/types/index.d.ts | 26 + .../node_modules/@emotion/unitless/LICENSE | 21 + .../node_modules/@emotion/unitless/README.md | 11 + .../@emotion/unitless/package.json | 26 + .../@emotion/unitless/src/index.d.ts | 2 + .../@emotion/unitless/src/index.js | 53 + .../LICENSE | 21 + .../README.md | 1 + .../package.json | 44 + .../src/index.js | 16 + .../node_modules/@emotion/utils/LICENSE | 21 + .../node_modules/@emotion/utils/package.json | 47 + .../@emotion/utils/src/index.d.ts | 1 + .../node_modules/@emotion/utils/src/index.js | 77 + .../node_modules/@emotion/utils/src/types.js | 28 + .../@emotion/utils/types/index.d.ts | 59 + .../@emotion/weak-memoize/LICENSE | 21 + .../@emotion/weak-memoize/README.md | 35 + .../@emotion/weak-memoize/package.json | 32 + .../@emotion/weak-memoize/src/index.d.ts | 2 + .../@emotion/weak-memoize/src/index.js | 16 + .../@emotion/weak-memoize/types/index.d.ts | 7 + .../@formkit/auto-animate/LICENSE | 7 + .../@formkit/auto-animate/README.md | 52 + .../@formkit/auto-animate/angular/index.d.ts | 10 + .../@formkit/auto-animate/angular/index.mjs | 52 + .../@formkit/auto-animate/index.d.ts | 78 + .../@formkit/auto-animate/index.min.js | 1 + .../@formkit/auto-animate/index.mjs | 553 + .../@formkit/auto-animate/package.json | 38 + .../@formkit/auto-animate/react/index.d.ts | 8 + .../@formkit/auto-animate/react/index.mjs | 24 + .../@formkit/auto-animate/vue/index.d.ts | 10 + .../@formkit/auto-animate/vue/index.mjs | 32 + .../node_modules/@types/parse-json/LICENSE | 21 + .../node_modules/@types/parse-json/README.md | 16 + .../node_modules/@types/parse-json/index.d.ts | 9 + .../@types/parse-json/package.json | 22 + .../node_modules/@types/prop-types/LICENSE | 21 + .../node_modules/@types/prop-types/README.md | 16 + .../node_modules/@types/prop-types/index.d.ts | 91 + .../@types/prop-types/package.json | 35 + .../react-transition-group/CSSTransition.d.ts | 45 + .../@types/react-transition-group/LICENSE | 21 + .../@types/react-transition-group/README.md | 16 + .../SwitchTransition.d.ts | 49 + .../react-transition-group/Transition.d.ts | 246 + .../TransitionGroup.d.ts | 80 + .../@types/react-transition-group/config.d.ts | 6 + .../@types/react-transition-group/index.d.ts | 14 + .../react-transition-group/package.json | 42 + .../node_modules/@types/react/LICENSE | 21 + .../node_modules/@types/react/README.md | 16 + .../@types/react/experimental.d.ts | 135 + .../node_modules/@types/react/global.d.ts | 155 + .../node_modules/@types/react/index.d.ts | 3322 +++ .../@types/react/jsx-dev-runtime.d.ts | 2 + .../@types/react/jsx-runtime.d.ts | 2 + .../node_modules/@types/react/next.d.ts | 30 + .../node_modules/@types/react/package.json | 179 + .../node_modules/@types/scheduler/LICENSE | 21 + .../node_modules/@types/scheduler/README.md | 16 + .../node_modules/@types/scheduler/index.d.ts | 32 + .../@types/scheduler/package.json | 30 + .../@types/scheduler/tracing.d.ts | 131 + .../node_modules/ansi-styles/index.js | 165 + .../node_modules/ansi-styles/license | 9 + .../node_modules/ansi-styles/package.json | 56 + .../node_modules/ansi-styles/readme.md | 147 + .../babel-plugin-macros/CHANGELOG.md | 5 + .../node_modules/babel-plugin-macros/LICENSE | 20 + .../babel-plugin-macros/README.md | 457 + .../node_modules/.bin/resolve | 1 + .../babel-plugin-macros/package.json | 68 + .../node_modules/callsites/index.d.ts | 96 + .../node_modules/callsites/index.js | 13 + src/components/node_modules/callsites/license | 9 + .../node_modules/callsites/package.json | 39 + .../node_modules/callsites/readme.md | 48 + src/components/node_modules/chalk/index.js | 228 + .../node_modules/chalk/index.js.flow | 93 + src/components/node_modules/chalk/license | 9 + .../escape-string-regexp/index.js | 11 + .../node_modules/escape-string-regexp/license | 21 + .../escape-string-regexp/package.json | 41 + .../escape-string-regexp/readme.md | 27 + .../node_modules/chalk/package.json | 71 + src/components/node_modules/chalk/readme.md | 314 + .../node_modules/chalk/templates.js | 128 + .../node_modules/chalk/types/index.d.ts | 97 + .../node_modules/classnames/HISTORY.md | 101 + .../node_modules/classnames/LICENSE | 21 + .../node_modules/classnames/README.md | 198 + .../node_modules/classnames/bind.d.ts | 9 + .../node_modules/classnames/bind.js | 54 + .../node_modules/classnames/dedupe.d.ts | 2 + .../node_modules/classnames/dedupe.js | 115 + .../node_modules/classnames/index.d.ts | 23 + .../node_modules/classnames/index.js | 60 + .../node_modules/classnames/package.json | 41 + .../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 | 868 + .../node_modules/color-convert/index.js | 78 + .../node_modules/color-convert/package.json | 46 + .../node_modules/color-convert/route.js | 97 + .../node_modules/color-name/.eslintrc.json | 43 + .../node_modules/color-name/.npmignore | 107 + .../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 | 25 + .../node_modules/color-name/test.js | 7 + .../node_modules/convert-source-map/LICENSE | 23 + .../node_modules/convert-source-map/README.md | 120 + .../node_modules/convert-source-map/index.js | 136 + .../convert-source-map/package.json | 44 + .../node_modules/cosmiconfig/LICENSE | 22 + .../node_modules/cosmiconfig/README.md | 572 + .../node_modules/cosmiconfig/package.json | 145 + src/components/node_modules/csstype/LICENSE | 19 + src/components/node_modules/csstype/README.md | 271 + .../node_modules/csstype/index.d.ts | 20256 ++++++++++++++++ .../node_modules/csstype/index.js.flow | 6325 +++++ .../node_modules/csstype/package.json | 66 + .../node_modules/dom-helpers/LICENSE | 21 + .../node_modules/dom-helpers/README.md | 70 + .../dom-helpers/activeElement/package.json | 7 + .../dom-helpers/addClass/package.json | 7 + .../dom-helpers/addEventListener/package.json | 7 + .../dom-helpers/animate/package.json | 7 + .../dom-helpers/animationFrame/package.json | 7 + .../dom-helpers/attribute/package.json | 7 + .../dom-helpers/camelize/package.json | 7 + .../dom-helpers/camelizeStyle/package.json | 7 + .../dom-helpers/canUseDOM/package.json | 7 + .../dom-helpers/childElements/package.json | 7 + .../dom-helpers/childNodes/package.json | 7 + .../dom-helpers/cjs/activeElement.d.ts | 6 + .../dom-helpers/cjs/activeElement.js | 34 + .../dom-helpers/cjs/addClass.d.ts | 7 + .../node_modules/dom-helpers/cjs/addClass.js | 20 + .../dom-helpers/cjs/addEventListener.d.ts | 16 + .../dom-helpers/cjs/addEventListener.js | 67 + .../node_modules/dom-helpers/cjs/animate.d.ts | 19 + .../node_modules/dom-helpers/cjs/animate.js | 103 + .../dom-helpers/cjs/animationFrame.d.ts | 2 + .../dom-helpers/cjs/animationFrame.js | 52 + .../dom-helpers/cjs/attribute.d.ts | 8 + .../node_modules/dom-helpers/cjs/attribute.js | 27 + .../dom-helpers/cjs/camelize.d.ts | 1 + .../node_modules/dom-helpers/cjs/camelize.js | 13 + .../dom-helpers/cjs/camelizeStyle.d.ts | 2 + .../dom-helpers/cjs/camelizeStyle.js | 21 + .../dom-helpers/cjs/canUseDOM.d.ts | 2 + .../node_modules/dom-helpers/cjs/canUseDOM.js | 9 + .../dom-helpers/cjs/childElements.d.ts | 6 + .../dom-helpers/cjs/childElements.js | 15 + .../dom-helpers/cjs/childNodes.d.ts | 6 + .../dom-helpers/cjs/childNodes.js | 16 + .../node_modules/dom-helpers/cjs/clear.d.ts | 6 + .../node_modules/dom-helpers/cjs/clear.js | 23 + .../node_modules/dom-helpers/cjs/closest.d.ts | 8 + .../node_modules/dom-helpers/cjs/closest.js | 29 + .../dom-helpers/cjs/collectElements.d.ts | 3 + .../dom-helpers/cjs/collectElements.js | 19 + .../dom-helpers/cjs/collectSiblings.d.ts | 1 + .../dom-helpers/cjs/collectSiblings.js | 34 + .../dom-helpers/cjs/contains.d.ts | 7 + .../node_modules/dom-helpers/cjs/contains.js | 21 + .../node_modules/dom-helpers/cjs/css.d.ts | 6 + .../node_modules/dom-helpers/cjs/css.js | 43 + .../dom-helpers/cjs/filterEventHandler.d.ts | 2 + .../dom-helpers/cjs/filterEventHandler.js | 23 + .../dom-helpers/cjs/getComputedStyle.d.ts | 7 + .../dom-helpers/cjs/getComputedStyle.js | 20 + .../dom-helpers/cjs/getScrollAccessor.d.ts | 4 + .../dom-helpers/cjs/getScrollAccessor.js | 30 + .../dom-helpers/cjs/hasClass.d.ts | 7 + .../node_modules/dom-helpers/cjs/hasClass.js | 17 + .../node_modules/dom-helpers/cjs/height.d.ts | 7 + .../node_modules/dom-helpers/cjs/height.js | 23 + .../dom-helpers/cjs/hyphenate.d.ts | 1 + .../node_modules/dom-helpers/cjs/hyphenate.js | 11 + .../dom-helpers/cjs/hyphenateStyle.d.ts | 7 + .../dom-helpers/cjs/hyphenateStyle.js | 21 + .../node_modules/dom-helpers/cjs/index.d.ts | 99 + .../node_modules/dom-helpers/cjs/index.js | 231 + .../dom-helpers/cjs/insertAfter.d.ts | 7 + .../dom-helpers/cjs/insertAfter.js | 26 + .../dom-helpers/cjs/isDocument.d.ts | 1 + .../dom-helpers/cjs/isDocument.js | 10 + .../node_modules/dom-helpers/cjs/isInput.d.ts | 6 + .../node_modules/dom-helpers/cjs/isInput.js | 16 + .../dom-helpers/cjs/isTransform.d.ts | 2 + .../dom-helpers/cjs/isTransform.js | 11 + .../dom-helpers/cjs/isVisible.d.ts | 6 + .../node_modules/dom-helpers/cjs/isVisible.js | 15 + .../dom-helpers/cjs/isWindow.d.ts | 1 + .../node_modules/dom-helpers/cjs/isWindow.js | 16 + .../node_modules/dom-helpers/cjs/listen.d.ts | 3 + .../node_modules/dom-helpers/cjs/listen.js | 21 + .../node_modules/dom-helpers/cjs/matches.d.ts | 7 + .../node_modules/dom-helpers/cjs/matches.js | 26 + .../dom-helpers/cjs/nextUntil.d.ts | 7 + .../node_modules/dom-helpers/cjs/nextUntil.js | 20 + .../node_modules/dom-helpers/cjs/offset.d.ts | 11 + .../node_modules/dom-helpers/cjs/offset.js | 42 + .../dom-helpers/cjs/offsetParent.d.ts | 1 + .../dom-helpers/cjs/offsetParent.js | 27 + .../dom-helpers/cjs/ownerDocument.d.ts | 6 + .../dom-helpers/cjs/ownerDocument.js | 15 + .../dom-helpers/cjs/ownerWindow.d.ts | 6 + .../dom-helpers/cjs/ownerWindow.js | 20 + .../node_modules/dom-helpers/cjs/parents.d.ts | 6 + .../node_modules/dom-helpers/cjs/parents.js | 19 + .../dom-helpers/cjs/position.d.ts | 12 + .../node_modules/dom-helpers/cjs/position.js | 60 + .../node_modules/dom-helpers/cjs/prepend.d.ts | 7 + .../node_modules/dom-helpers/cjs/prepend.js | 26 + .../dom-helpers/cjs/querySelectorAll.d.ts | 7 + .../dom-helpers/cjs/querySelectorAll.js | 17 + .../node_modules/dom-helpers/cjs/remove.d.ts | 6 + .../node_modules/dom-helpers/cjs/remove.js | 20 + .../dom-helpers/cjs/removeClass.d.ts | 7 + .../dom-helpers/cjs/removeClass.js | 27 + .../dom-helpers/cjs/removeEventListener.d.ts | 11 + .../dom-helpers/cjs/removeEventListener.js | 25 + .../dom-helpers/cjs/scrollLeft.d.ts | 11 + .../dom-helpers/cjs/scrollLeft.js | 19 + .../dom-helpers/cjs/scrollParent.d.ts | 7 + .../dom-helpers/cjs/scrollParent.js | 41 + .../dom-helpers/cjs/scrollTo.d.ts | 1 + .../node_modules/dom-helpers/cjs/scrollTo.js | 51 + .../dom-helpers/cjs/scrollTop.d.ts | 11 + .../node_modules/dom-helpers/cjs/scrollTop.js | 19 + .../dom-helpers/cjs/scrollbarSize.d.ts | 1 + .../dom-helpers/cjs/scrollbarSize.js | 30 + .../dom-helpers/cjs/siblings.d.ts | 6 + .../node_modules/dom-helpers/cjs/siblings.js | 19 + .../node_modules/dom-helpers/cjs/text.d.ts | 8 + .../node_modules/dom-helpers/cjs/text.js | 42 + .../dom-helpers/cjs/toggleClass.d.ts | 7 + .../dom-helpers/cjs/toggleClass.js | 24 + .../dom-helpers/cjs/transitionEnd.d.ts | 2 + .../dom-helpers/cjs/transitionEnd.js | 50 + .../dom-helpers/cjs/triggerEvent.d.ts | 9 + .../dom-helpers/cjs/triggerEvent.js | 30 + .../node_modules/dom-helpers/cjs/types.d.ts | 8 + .../node_modules/dom-helpers/cjs/width.d.ts | 7 + .../node_modules/dom-helpers/cjs/width.js | 23 + .../dom-helpers/clear/package.json | 7 + .../dom-helpers/closest/package.json | 7 + .../dom-helpers/collectElements/package.json | 7 + .../dom-helpers/collectSiblings/package.json | 7 + .../dom-helpers/contains/package.json | 7 + .../node_modules/dom-helpers/css/package.json | 7 + .../dom-helpers/esm/activeElement.d.ts | 6 + .../dom-helpers/esm/activeElement.js | 25 + .../dom-helpers/esm/addClass.d.ts | 7 + .../node_modules/dom-helpers/esm/addClass.js | 11 + .../dom-helpers/esm/addEventListener.d.ts | 16 + .../dom-helpers/esm/addEventListener.js | 56 + .../node_modules/dom-helpers/esm/animate.d.ts | 19 + .../node_modules/dom-helpers/esm/animate.js | 90 + .../dom-helpers/esm/animationFrame.d.ts | 2 + .../dom-helpers/esm/animationFrame.js | 42 + .../dom-helpers/esm/attribute.d.ts | 8 + .../node_modules/dom-helpers/esm/attribute.js | 20 + .../dom-helpers/esm/camelize.d.ts | 1 + .../node_modules/dom-helpers/esm/camelize.js | 6 + .../dom-helpers/esm/camelizeStyle.d.ts | 2 + .../dom-helpers/esm/camelizeStyle.js | 10 + .../dom-helpers/esm/canUseDOM.d.ts | 2 + .../node_modules/dom-helpers/esm/canUseDOM.js | 1 + .../dom-helpers/esm/childElements.d.ts | 6 + .../dom-helpers/esm/childElements.js | 8 + .../dom-helpers/esm/childNodes.d.ts | 6 + .../dom-helpers/esm/childNodes.js | 10 + .../node_modules/dom-helpers/esm/clear.d.ts | 6 + .../node_modules/dom-helpers/esm/clear.js | 16 + .../node_modules/dom-helpers/esm/closest.d.ts | 8 + .../node_modules/dom-helpers/esm/closest.js | 20 + .../dom-helpers/esm/collectElements.d.ts | 3 + .../dom-helpers/esm/collectElements.js | 12 + .../dom-helpers/esm/collectSiblings.d.ts | 1 + .../dom-helpers/esm/collectSiblings.js | 24 + .../dom-helpers/esm/contains.d.ts | 7 + .../node_modules/dom-helpers/esm/contains.js | 14 + .../node_modules/dom-helpers/esm/css.d.ts | 6 + .../node_modules/dom-helpers/esm/css.js | 32 + .../dom-helpers/esm/filterEventHandler.d.ts | 2 + .../dom-helpers/esm/filterEventHandler.js | 12 + .../dom-helpers/esm/getComputedStyle.d.ts | 7 + .../dom-helpers/esm/getComputedStyle.js | 11 + .../dom-helpers/esm/getScrollAccessor.d.ts | 4 + .../dom-helpers/esm/getScrollAccessor.js | 20 + .../dom-helpers/esm/hasClass.d.ts | 7 + .../node_modules/dom-helpers/esm/hasClass.js | 10 + .../node_modules/dom-helpers/esm/height.d.ts | 7 + .../node_modules/dom-helpers/esm/height.js | 13 + .../dom-helpers/esm/hyphenate.d.ts | 1 + .../node_modules/dom-helpers/esm/hyphenate.js | 4 + .../dom-helpers/esm/hyphenateStyle.d.ts | 7 + .../dom-helpers/esm/hyphenateStyle.js | 10 + .../node_modules/dom-helpers/esm/index.d.ts | 99 + .../node_modules/dom-helpers/esm/index.js | 92 + .../dom-helpers/esm/insertAfter.d.ts | 7 + .../dom-helpers/esm/insertAfter.js | 19 + .../dom-helpers/esm/isDocument.d.ts | 1 + .../dom-helpers/esm/isDocument.js | 3 + .../node_modules/dom-helpers/esm/isInput.d.ts | 6 + .../node_modules/dom-helpers/esm/isInput.js | 10 + .../dom-helpers/esm/isTransform.d.ts | 2 + .../dom-helpers/esm/isTransform.js | 4 + .../dom-helpers/esm/isVisible.d.ts | 6 + .../node_modules/dom-helpers/esm/isVisible.js | 8 + .../dom-helpers/esm/isWindow.d.ts | 1 + .../node_modules/dom-helpers/esm/isWindow.js | 6 + .../node_modules/dom-helpers/esm/listen.d.ts | 3 + .../node_modules/dom-helpers/esm/listen.js | 11 + .../node_modules/dom-helpers/esm/matches.d.ts | 7 + .../node_modules/dom-helpers/esm/matches.js | 20 + .../dom-helpers/esm/nextUntil.d.ts | 7 + .../node_modules/dom-helpers/esm/nextUntil.js | 11 + .../node_modules/dom-helpers/esm/offset.d.ts | 11 + .../node_modules/dom-helpers/esm/offset.js | 30 + .../dom-helpers/esm/offsetParent.d.ts | 1 + .../dom-helpers/esm/offsetParent.js | 17 + .../dom-helpers/esm/ownerDocument.d.ts | 6 + .../dom-helpers/esm/ownerDocument.js | 8 + .../dom-helpers/esm/ownerWindow.d.ts | 6 + .../dom-helpers/esm/ownerWindow.js | 11 + .../node_modules/dom-helpers/esm/parents.d.ts | 6 + .../node_modules/dom-helpers/esm/parents.js | 10 + .../dom-helpers/esm/position.d.ts | 12 + .../node_modules/dom-helpers/esm/position.js | 46 + .../node_modules/dom-helpers/esm/prepend.d.ts | 7 + .../node_modules/dom-helpers/esm/prepend.js | 19 + .../dom-helpers/esm/querySelectorAll.d.ts | 7 + .../dom-helpers/esm/querySelectorAll.js | 11 + .../node_modules/dom-helpers/esm/remove.d.ts | 6 + .../node_modules/dom-helpers/esm/remove.js | 13 + .../dom-helpers/esm/removeClass.d.ts | 7 + .../dom-helpers/esm/removeClass.js | 20 + .../dom-helpers/esm/removeEventListener.d.ts | 11 + .../dom-helpers/esm/removeEventListener.js | 18 + .../dom-helpers/esm/scrollLeft.d.ts | 11 + .../dom-helpers/esm/scrollLeft.js | 9 + .../dom-helpers/esm/scrollParent.d.ts | 7 + .../dom-helpers/esm/scrollParent.js | 29 + .../dom-helpers/esm/scrollTo.d.ts | 1 + .../node_modules/dom-helpers/esm/scrollTo.js | 36 + .../dom-helpers/esm/scrollTop.d.ts | 11 + .../node_modules/dom-helpers/esm/scrollTop.js | 9 + .../dom-helpers/esm/scrollbarSize.d.ts | 1 + .../dom-helpers/esm/scrollbarSize.js | 19 + .../dom-helpers/esm/siblings.d.ts | 6 + .../node_modules/dom-helpers/esm/siblings.js | 10 + .../node_modules/dom-helpers/esm/text.d.ts | 8 + .../node_modules/dom-helpers/esm/text.js | 36 + .../dom-helpers/esm/toggleClass.d.ts | 7 + .../dom-helpers/esm/toggleClass.js | 13 + .../dom-helpers/esm/transitionEnd.d.ts | 2 + .../dom-helpers/esm/transitionEnd.js | 39 + .../dom-helpers/esm/triggerEvent.d.ts | 9 + .../dom-helpers/esm/triggerEvent.js | 23 + .../node_modules/dom-helpers/esm/types.d.ts | 8 + .../node_modules/dom-helpers/esm/width.d.ts | 7 + .../node_modules/dom-helpers/esm/width.js | 13 + .../filterEventHandler/package.json | 7 + .../dom-helpers/getComputedStyle/package.json | 7 + .../getScrollAccessor/package.json | 7 + .../dom-helpers/hasClass/package.json | 7 + .../dom-helpers/height/package.json | 7 + .../dom-helpers/hyphenate/package.json | 7 + .../dom-helpers/hyphenateStyle/package.json | 7 + .../dom-helpers/insertAfter/package.json | 7 + .../dom-helpers/isDocument/package.json | 7 + .../dom-helpers/isInput/package.json | 7 + .../dom-helpers/isTransform/package.json | 7 + .../dom-helpers/isVisible/package.json | 7 + .../dom-helpers/isWindow/package.json | 7 + .../dom-helpers/listen/package.json | 7 + .../dom-helpers/matches/package.json | 7 + .../dom-helpers/nextUntil/package.json | 7 + .../dom-helpers/offset/package.json | 7 + .../dom-helpers/offsetParent/package.json | 7 + .../dom-helpers/ownerDocument/package.json | 7 + .../dom-helpers/ownerWindow/package.json | 7 + .../node_modules/dom-helpers/package.json | 48 + .../dom-helpers/parents/package.json | 7 + .../dom-helpers/position/package.json | 7 + .../dom-helpers/prepend/package.json | 7 + .../dom-helpers/querySelectorAll/package.json | 7 + .../dom-helpers/remove/package.json | 7 + .../dom-helpers/removeClass/package.json | 7 + .../removeEventListener/package.json | 7 + .../dom-helpers/scrollLeft/package.json | 7 + .../dom-helpers/scrollParent/package.json | 7 + .../dom-helpers/scrollTo/package.json | 7 + .../dom-helpers/scrollTop/package.json | 7 + .../dom-helpers/scrollbarSize/package.json | 7 + .../dom-helpers/siblings/package.json | 7 + .../dom-helpers/text/package.json | 7 + .../dom-helpers/toggleClass/package.json | 7 + .../dom-helpers/transitionEnd/package.json | 7 + .../dom-helpers/triggerEvent/package.json | 7 + .../dom-helpers/width/package.json | 7 + src/components/node_modules/error-ex/LICENSE | 21 + .../node_modules/error-ex/README.md | 144 + src/components/node_modules/error-ex/index.js | 141 + .../node_modules/error-ex/package.json | 46 + .../escape-string-regexp/index.d.ts | 18 + .../escape-string-regexp/index.js | 13 + .../node_modules/escape-string-regexp/license | 9 + .../escape-string-regexp/package.json | 38 + .../escape-string-regexp/readme.md | 34 + .../node_modules/find-root/.npmignore | 2 + .../node_modules/find-root/.travis.yml | 10 + .../node_modules/find-root/LICENSE.md | 7 + .../node_modules/find-root/README.md | 69 + .../node_modules/find-root/index.js | 31 + .../node_modules/find-root/package.json | 30 + .../node_modules/find-root/test/test.js | 61 + src/components/node_modules/fs-extra/LICENSE | 15 + .../node_modules/fs-extra/README.md | 262 + .../fs-extra/lib/copy/copy-sync.js | 169 + .../node_modules/fs-extra/lib/copy/copy.js | 235 + .../node_modules/fs-extra/lib/copy/index.js | 7 + .../node_modules/fs-extra/lib/empty/index.js | 39 + .../node_modules/fs-extra/lib/ensure/file.js | 69 + .../node_modules/fs-extra/lib/ensure/index.js | 23 + .../node_modules/fs-extra/lib/ensure/link.js | 64 + .../fs-extra/lib/ensure/symlink-paths.js | 99 + .../fs-extra/lib/ensure/symlink-type.js | 31 + .../fs-extra/lib/ensure/symlink.js | 82 + .../node_modules/fs-extra/lib/fs/index.js | 128 + .../node_modules/fs-extra/lib/index.js | 16 + .../node_modules/fs-extra/lib/json/index.js | 16 + .../fs-extra/lib/json/jsonfile.js | 11 + .../fs-extra/lib/json/output-json-sync.js | 12 + .../fs-extra/lib/json/output-json.js | 12 + .../node_modules/fs-extra/lib/mkdirs/index.js | 14 + .../fs-extra/lib/mkdirs/make-dir.js | 27 + .../node_modules/fs-extra/lib/mkdirs/utils.js | 21 + .../node_modules/fs-extra/lib/move/index.js | 7 + .../fs-extra/lib/move/move-sync.js | 54 + .../node_modules/fs-extra/lib/move/move.js | 75 + .../fs-extra/lib/output-file/index.js | 40 + .../fs-extra/lib/path-exists/index.js | 12 + .../node_modules/fs-extra/lib/remove/index.js | 22 + .../fs-extra/lib/remove/rimraf.js | 302 + .../node_modules/fs-extra/lib/util/stat.js | 154 + .../node_modules/fs-extra/lib/util/utimes.js | 26 + .../node_modules/fs-extra/package.json | 67 + .../node_modules/function-bind/.editorconfig | 20 + .../node_modules/function-bind/.eslintrc | 15 + .../node_modules/function-bind/.jscs.json | 176 + .../node_modules/function-bind/.npmignore | 22 + .../node_modules/function-bind/.travis.yml | 168 + .../node_modules/function-bind/LICENSE | 20 + .../node_modules/function-bind/README.md | 48 + .../function-bind/implementation.js | 52 + .../node_modules/function-bind/index.js | 5 + .../node_modules/function-bind/package.json | 63 + .../node_modules/function-bind/test/.eslintrc | 9 + .../node_modules/function-bind/test/index.js | 252 + .../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 + .../graceful-fs/legacy-streams.js | 118 + .../node_modules/graceful-fs/package.json | 50 + .../node_modules/graceful-fs/polyfills.js | 355 + src/components/node_modules/has-flag/index.js | 8 + src/components/node_modules/has-flag/license | 9 + .../node_modules/has-flag/package.json | 44 + .../node_modules/has-flag/readme.md | 70 + src/components/node_modules/has/LICENSE-MIT | 22 + src/components/node_modules/has/README.md | 18 + src/components/node_modules/has/package.json | 48 + src/components/node_modules/has/src/index.js | 5 + src/components/node_modules/has/test/index.js | 10 + .../hoist-non-react-statics/CHANGELOG.md | 37 + .../hoist-non-react-statics/LICENSE.md | 29 + .../hoist-non-react-statics/README.md | 55 + .../hoist-non-react-statics/package.json | 55 + .../hoist-non-react-statics/src/index.js | 104 + .../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/is-arrayish/.editorconfig | 18 + .../node_modules/is-arrayish/.istanbul.yml | 4 + .../node_modules/is-arrayish/.npmignore | 5 + .../node_modules/is-arrayish/.travis.yml | 17 + .../node_modules/is-arrayish/LICENSE | 21 + .../node_modules/is-arrayish/README.md | 16 + .../node_modules/is-arrayish/index.js | 10 + .../node_modules/is-arrayish/package.json | 34 + .../node_modules/is-core-module/.eslintrc | 18 + .../node_modules/is-core-module/.nycrc | 9 + .../node_modules/is-core-module/CHANGELOG.md | 143 + .../node_modules/is-core-module/LICENSE | 20 + .../node_modules/is-core-module/README.md | 40 + .../node_modules/is-core-module/core.json | 153 + .../node_modules/is-core-module/index.js | 69 + .../node_modules/is-core-module/package.json | 65 + .../node_modules/is-core-module/test/index.js | 133 + .../node_modules/js-tokens/CHANGELOG.md | 151 + src/components/node_modules/js-tokens/LICENSE | 21 + .../node_modules/js-tokens/README.md | 240 + .../node_modules/js-tokens/index.js | 23 + .../node_modules/js-tokens/package.json | 30 + .../CHANGELOG.md | 50 + .../json-parse-even-better-errors/LICENSE.md | 25 + .../json-parse-even-better-errors/README.md | 96 + .../json-parse-even-better-errors/index.js | 121 + .../package.json | 33 + .../node_modules/jsonfile/CHANGELOG.md | 171 + src/components/node_modules/jsonfile/LICENSE | 15 + .../node_modules/jsonfile/README.md | 230 + src/components/node_modules/jsonfile/index.js | 88 + .../node_modules/jsonfile/package.json | 40 + src/components/node_modules/jsonfile/utils.js | 14 + src/components/node_modules/jsurl2/README.md | 147 + .../node_modules/jsurl2/lib/jsurl.js | 193 + .../node_modules/jsurl2/lib/jsurl2.js | 331 + .../node_modules/jsurl2/package.json | 32 + src/components/node_modules/jsurl2/v1.js | 1 + .../node_modules/lines-and-columns/LICENSE | 21 + .../node_modules/lines-and-columns/README.md | 33 + .../lines-and-columns/build/index.d.ts | 13 + .../lines-and-columns/build/index.js | 62 + .../lines-and-columns/package.json | 49 + .../node_modules/loose-envify/LICENSE | 21 + .../node_modules/loose-envify/README.md | 45 + .../node_modules/loose-envify/cli.js | 16 + .../node_modules/loose-envify/custom.js | 4 + .../node_modules/loose-envify/index.js | 3 + .../node_modules/loose-envify/loose-envify.js | 36 + .../node_modules/loose-envify/package.json | 36 + .../node_modules/loose-envify/replace.js | 65 + .../node_modules/lz-string/LICENSE.txt | 13 + .../node_modules/lz-string/README.md | 18 + .../node_modules/lz-string/bin/bin.js | 13 + .../node_modules/lz-string/bower.json | 11 + .../lz-string/libs/base64-string.js | 285 + .../node_modules/lz-string/libs/lz-string.js | 501 + .../lz-string/libs/lz-string.min.js | 1 + .../node_modules/lz-string/package.json | 41 + .../lz-string/reference/lz-string-1.0.2.js | 204 + .../lz-string/tests/SpecRunner.html | 51 + .../tests/lib/jasmine-1.3.1/MIT.LICENSE | 20 + .../tests/lib/jasmine-1.3.1/jasmine-html.js | 681 + .../tests/lib/jasmine-1.3.1/jasmine.css | 82 + .../tests/lib/jasmine-1.3.1/jasmine.js | 2600 ++ .../lz-string/tests/lz-string-spec.js | 226 + .../lz-string/typings/lz-string.d.ts | 16 + .../node_modules/memoize-one/LICENSE | 21 + .../node_modules/memoize-one/README.md | 268 + .../node_modules/memoize-one/package.json | 90 + .../memoize-one/src/are-inputs-equal.ts | 39 + .../memoize-one/src/memoize-one.js.flow | 8 + .../memoize-one/src/memoize-one.ts | 40 + .../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/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-json/index.js | 54 + .../node_modules/parse-json/license | 9 + .../node_modules/parse-json/package.json | 45 + .../node_modules/parse-json/readme.md | 119 + .../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-type/index.d.ts | 51 + .../node_modules/path-type/index.js | 43 + src/components/node_modules/path-type/license | 9 + .../node_modules/path-type/package.json | 45 + .../node_modules/path-type/readme.md | 72 + .../node_modules/prop-types/LICENSE | 21 + .../node_modules/prop-types/README.md | 302 + .../node_modules/prop-types/checkPropTypes.js | 103 + .../node_modules/prop-types/factory.js | 19 + .../prop-types/factoryWithThrowingShims.js | 65 + .../prop-types/factoryWithTypeCheckers.js | 610 + .../node_modules/prop-types/index.js | 19 + .../prop-types/lib/ReactPropTypesSecret.js | 12 + .../node_modules/prop-types/lib/has.js | 1 + .../prop-types/node_modules/.bin/loose-envify | 1 + .../node_modules/prop-types/package.json | 60 + .../node_modules/prop-types/prop-types.js | 1315 + .../node_modules/prop-types/prop-types.min.js | 1 + src/components/node_modules/react-is/LICENSE | 21 + .../node_modules/react-is/README.md | 104 + .../node_modules/react-is/build-info.json | 8 + .../react-is/cjs/react-is.development.js | 181 + .../react-is/cjs/react-is.production.min.js | 15 + src/components/node_modules/react-is/index.js | 7 + .../node_modules/react-is/package.json | 27 + .../react-is/umd/react-is.development.js | 181 + .../react-is/umd/react-is.production.min.js | 13 + .../node_modules/react-select/CHANGELOG.md | 1839 ++ .../node_modules/react-select/README.md | 168 + .../react-select/animated/package.json | 8 + .../react-select/async-creatable/package.json | 8 + .../react-select/async/package.json | 8 + .../react-select/base/package.json | 8 + .../react-select/creatable/package.json | 8 + .../node_modules/react-select/package.json | 61 + .../CSSTransition/package.json | 6 + .../react-transition-group/LICENSE | 30 + .../react-transition-group/README.md | 34 + .../ReplaceTransition/package.json | 6 + .../SwitchTransition/package.json | 6 + .../Transition/package.json | 6 + .../TransitionGroup/package.json | 6 + .../TransitionGroupContext/package.json | 6 + .../cjs/CSSTransition.js | 430 + .../cjs/ReplaceTransition.js | 152 + .../cjs/SwitchTransition.js | 269 + .../react-transition-group/cjs/Transition.js | 648 + .../cjs/TransitionGroup.js | 205 + .../cjs/TransitionGroupContext.js | 13 + .../react-transition-group/cjs/config.js | 9 + .../react-transition-group/cjs/index.js | 30 + .../cjs/utils/ChildMapping.js | 150 + .../cjs/utils/PropTypes.js | 28 + .../cjs/utils/SimpleSet.js | 37 + .../cjs/utils/reflow.js | 10 + .../config/package.json | 6 + .../esm/CSSTransition.js | 412 + .../esm/ReplaceTransition.js | 136 + .../esm/SwitchTransition.js | 257 + .../react-transition-group/esm/Transition.js | 625 + .../esm/TransitionGroup.js | 189 + .../esm/TransitionGroupContext.js | 2 + .../react-transition-group/esm/config.js | 3 + .../react-transition-group/esm/index.js | 6 + .../esm/utils/ChildMapping.js | 140 + .../esm/utils/PropTypes.js | 18 + .../esm/utils/SimpleSet.js | 31 + .../esm/utils/reflow.js | 3 + .../node_modules/.bin/loose-envify | 1 + .../react-transition-group/package.json | 69 + .../node_modules/regenerator-runtime/LICENSE | 21 + .../regenerator-runtime/README.md | 31 + .../regenerator-runtime/package.json | 19 + .../node_modules/regenerator-runtime/path.js | 11 + .../regenerator-runtime/runtime.js | 754 + .../node_modules/resolve-from/index.js | 47 + .../node_modules/resolve-from/license | 9 + .../node_modules/resolve-from/package.json | 34 + .../node_modules/resolve-from/readme.md | 72 + .../node_modules/resolve/.editorconfig | 37 + src/components/node_modules/resolve/.eslintrc | 65 + .../node_modules/resolve/.github/FUNDING.yml | 12 + src/components/node_modules/resolve/LICENSE | 21 + .../node_modules/resolve/SECURITY.md | 3 + src/components/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 + src/components/node_modules/resolve/index.js | 6 + .../node_modules/resolve/lib/async.js | 329 + .../node_modules/resolve/lib/caller.js | 8 + .../node_modules/resolve/lib/core.js | 52 + .../node_modules/resolve/lib/core.json | 153 + .../node_modules/resolve/lib/homedir.js | 24 + .../node_modules/resolve/lib/is-core.js | 5 + .../resolve/lib/node-modules-paths.js | 42 + .../resolve/lib/normalize-options.js | 10 + .../node_modules/resolve/lib/sync.js | 208 + .../node_modules/resolve/package.json | 71 + .../node_modules/resolve/readme.markdown | 301 + src/components/node_modules/resolve/sync.js | 3 + .../node_modules/resolve/test/core.js | 88 + .../node_modules/resolve/test/dotdot.js | 29 + .../resolve/test/dotdot/abc/index.js | 2 + .../node_modules/resolve/test/dotdot/index.js | 1 + .../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 + .../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 + .../resolve/test/precedence/aaa.js | 1 + .../resolve/test/precedence/aaa/index.js | 1 + .../resolve/test/precedence/aaa/main.js | 1 + .../resolve/test/precedence/bbb.js | 1 + .../resolve/test/precedence/bbb/main.js | 1 + .../node_modules/resolve/test/resolver.js | 595 + .../resolve/test/resolver/baz/doom.js | 0 .../resolve/test/resolver/baz/package.json | 4 + .../resolve/test/resolver/baz/quux.js | 1 + .../resolve/test/resolver/browser_field/a.js | 0 .../resolve/test/resolver/browser_field/b.js | 0 .../test/resolver/browser_field/package.json | 5 + .../resolve/test/resolver/cup.coffee | 1 + .../resolve/test/resolver/dot_main/index.js | 1 + .../test/resolver/dot_main/package.json | 3 + .../test/resolver/dot_slash_main/index.js | 1 + .../test/resolver/dot_slash_main/package.json | 3 + .../resolve/test/resolver/false_main/index.js | 0 .../test/resolver/false_main/package.json | 4 + .../node_modules/resolve/test/resolver/foo.js | 1 + .../test/resolver/incorrect_main/index.js | 2 + .../test/resolver/incorrect_main/package.json | 3 + .../test/resolver/invalid_main/package.json | 7 + .../resolver/malformed_package_json/index.js | 0 .../malformed_package_json/package.json | 1 + .../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 + .../resolve/test/resolver_sync.js | 726 + .../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/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 | 62 + .../node_modules/safe-buffer/package.json | 37 + .../node_modules/source-map/CHANGELOG.md | 301 + .../node_modules/source-map/LICENSE | 28 + .../node_modules/source-map/README.md | 729 + .../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 + src/components/node_modules/stylis/LICENSE | 21 + src/components/node_modules/stylis/README.md | 161 + src/components/node_modules/stylis/index.js | 7 + .../node_modules/stylis/package.json | 164 + .../node_modules/stylis/src/Enum.js | 20 + .../node_modules/stylis/src/Middleware.js | 108 + .../node_modules/stylis/src/Parser.js | 191 + .../node_modules/stylis/src/Prefixer.js | 119 + .../node_modules/stylis/src/Serializer.js | 35 + .../node_modules/stylis/src/Tokenizer.js | 246 + .../node_modules/stylis/src/Utility.js | 115 + .../node_modules/supports-color/browser.js | 5 + .../node_modules/supports-color/index.js | 131 + .../node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 53 + .../node_modules/supports-color/readme.md | 66 + .../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/to-fast-properties/index.js | 27 + .../node_modules/to-fast-properties/license | 10 + .../to-fast-properties/package.json | 35 + .../node_modules/to-fast-properties/readme.md | 37 + .../node_modules/universalify/LICENSE | 20 + .../node_modules/universalify/README.md | 76 + .../node_modules/universalify/index.js | 24 + .../node_modules/universalify/package.json | 34 + src/components/node_modules/yaml/LICENSE | 13 + src/components/node_modules/yaml/README.md | 127 + .../node_modules/yaml/browser/index.js | 1 + .../node_modules/yaml/browser/map.js | 2 + .../node_modules/yaml/browser/pair.js | 2 + .../node_modules/yaml/browser/parse-cst.js | 1 + .../node_modules/yaml/browser/scalar.js | 2 + .../node_modules/yaml/browser/schema.js | 9 + .../node_modules/yaml/browser/seq.js | 2 + .../node_modules/yaml/browser/types.js | 1 + .../node_modules/yaml/browser/types/binary.js | 8 + .../node_modules/yaml/browser/types/omap.js | 3 + .../node_modules/yaml/browser/types/pairs.js | 3 + .../node_modules/yaml/browser/types/set.js | 3 + .../yaml/browser/types/timestamp.js | 10 + .../node_modules/yaml/browser/util.js | 1 + src/components/node_modules/yaml/index.d.ts | 372 + src/components/node_modules/yaml/index.js | 1 + src/components/node_modules/yaml/map.js | 2 + src/components/node_modules/yaml/package.json | 106 + src/components/node_modules/yaml/pair.js | 2 + .../node_modules/yaml/parse-cst.d.ts | 191 + src/components/node_modules/yaml/parse-cst.js | 1 + src/components/node_modules/yaml/scalar.js | 2 + src/components/node_modules/yaml/schema.js | 9 + src/components/node_modules/yaml/seq.js | 2 + src/components/node_modules/yaml/types.d.ts | 407 + src/components/node_modules/yaml/types.js | 17 + src/components/node_modules/yaml/types.mjs | 17 + .../node_modules/yaml/types/binary.js | 8 + .../node_modules/yaml/types/omap.js | 3 + .../node_modules/yaml/types/pairs.js | 3 + src/components/node_modules/yaml/types/set.js | 3 + .../node_modules/yaml/types/timestamp.js | 10 + src/components/node_modules/yaml/util.d.ts | 86 + src/components/node_modules/yaml/util.js | 16 + src/components/node_modules/yaml/util.mjs | 18 + src/components/package.json | 38 + src/components/post-build.cjs | 22 + src/components/{ => src}/ButtonSelect.tsx | 0 .../{ => src}/CompiledPTextDisplay.tsx | 4 +- src/components/{ => src}/ComplementPicker.tsx | 2 +- .../{ => src}/DisplayModeSelect.tsx | 0 src/components/src/EntrySelect.tsx | 180 + src/components/{ => src}/Examples.tsx | 2 +- src/components/{ => src}/Hider.tsx | 2 +- .../src/HumanReadableInflectionPattern.tsx | 18 + src/components/{ => src}/InflectionsTable.tsx | 4 +- src/components/{ => src}/InlinePs.tsx | 2 +- src/components/{ => src}/Keyframes.tsx | 0 src/components/{ => src}/Pashto.tsx | 8 +- src/components/{ => src}/PersInfsPicker.tsx | 30 +- src/components/{ => src}/PersonSelection.tsx | 6 +- src/components/{ => src}/Phonetics.tsx | 6 +- .../{ => src}/RenderedBlocksDisplay.tsx | 4 +- .../{ => src}/SingleItemDisplay.tsx | 2 +- src/components/{ => src}/TableCell.tsx | 2 +- src/components/{ => src}/VerbFormDisplay.tsx | 6 +- src/components/{ => src}/VerbTable.tsx | 8 +- .../{ => src}/ap-picker/APPicker.tsx | 2 +- .../{ => src}/ap-picker/AdverbPicker.tsx | 12 +- src/components/{ => src}/blocks/Block.tsx | 10 +- .../{ => src}/blocks/KidDisplay.tsx | 4 +- .../{ => src}/ep-explorer/EPDisplay.tsx | 10 +- .../{ => src}/ep-explorer/EPExplorer.tsx | 22 +- .../{ => src}/ep-explorer/EPPicker.tsx | 18 +- .../{ => src}/ep-explorer/EqChartsDisplay.tsx | 8 +- .../src/ep-explorer/EquativePicker.tsx | 110 + .../eq-comp-picker/LocativeAdverbPicker.tsx | 12 +- src/{lib => components/src}/gender-colors.ts | 0 src/{lib => components/src}/jsx-map.test.tsx | 0 src/{lib => components/src}/jsx-map.tsx | 2 +- .../{ => src}/np-picker/AdjectiveManager.tsx | 2 +- .../{ => src}/np-picker/AdjectivePicker.tsx | 11 +- .../{ => src}/np-picker/NPNounPicker.tsx | 5 +- .../np-picker/NPParticiplePicker.tsx | 11 +- .../{ => src}/np-picker/NPPicker.tsx | 6 +- .../{ => src}/np-picker/NPPronounPicker.tsx | 6 +- .../{ => src}/np-picker/SandwichPicker.tsx | 6 +- .../{ => src}/np-picker/picker-tools.tsx | 35 +- src/{lib => components/src}/play-audio.ts | 0 src/{lib => components/src}/useStickyState.ts | 0 .../{ => src}/verb-info/VerbInfo.tsx | 14 +- .../verb-info/VerbInfoItemDisplay.tsx | 4 +- .../{ => src}/verb-info/VerbTypeInfo.tsx | 4 +- .../dynamic-compound-intransitive.svg | 0 .../verb-info/dynamic-compound-transitive.svg | 0 .../{ => src}/verb-info/faded-tree.svg | 0 ...nerative-stative-compound-intransitive.svg | 0 ...generative-stative-compound-transitive.svg | 0 .../grammatically-transitive-past.svg | 0 .../grammatically-transitive-present.svg | 0 .../{ => src}/verb-info/intransitive.svg | 0 .../stative-compound-intransitive.svg | 0 .../verb-info/stative-compound-transitive.svg | 0 .../{ => src}/verb-info/transitive-past.svg | 0 .../verb-info/transitive-present.svg | 0 .../vp-explorer/AbbreviationFormSelector.tsx | 2 +- .../{ => src}/vp-explorer/CompoundDisplay.tsx | 6 +- .../{ => src}/vp-explorer/TensePicker.tsx | 6 +- .../{ => src}/vp-explorer/VPChartDisplay.tsx | 6 +- .../{ => src}/vp-explorer/VPDisplay.tsx | 12 +- .../{ => src}/vp-explorer/VPExplorer.tsx | 12 +- .../VPExplorerExplanationModal.tsx | 0 .../{ => src}/vp-explorer/VPExplorerQuiz.tsx | 40 +- .../{ => src}/vp-explorer/VPPicker.tsx | 14 +- .../{ => src}/vp-explorer/VerbPicker.tsx | 10 +- .../{ => src}/vp-explorer/energy-drink.jpg | Bin .../vp-explorer/vp-structure-source.svg | 0 .../{ => src}/vp-explorer/vp-structure.svg | 0 src/components/yarn.lock | 523 + src/lib/lib-tsconfig.json | 23 + src/{functions.ts => lib/library.ts} | 84 +- src/lib/node_modules/.yarn-integrity | 16 + src/lib/node_modules/rambda/CHANGELOG.md | 745 + src/lib/node_modules/rambda/LICENSE | 21 + src/lib/node_modules/rambda/README.md | 19309 +++++++++++++++ src/lib/node_modules/rambda/immutable.d.ts | 1570 ++ src/lib/node_modules/rambda/immutable.js | 1 + src/lib/node_modules/rambda/index.d.ts | 1570 ++ src/lib/node_modules/rambda/package.json | 128 + src/lib/node_modules/rambda/src/F.js | 3 + src/lib/node_modules/rambda/src/T.js | 3 + .../rambda/src/_internals/baseSlice.js | 21 + .../rambda/src/_internals/cloneList.js | 1 + .../rambda/src/_internals/constants.js | 1 + .../rambda/src/_internals/createPath.js | 3 + .../rambda/src/_internals/isArray.js | 1 + .../rambda/src/_internals/isFalsy.js | 13 + .../rambda/src/_internals/isInteger.js | 5 + .../rambda/src/_internals/isIterable.js | 5 + .../rambda/src/_internals/isObject.js | 5 + .../rambda/src/_internals/isTruthy.js | 13 + .../rambda/src/_internals/keys.js | 1 + .../rambda/src/_internals/objectIs.js | 9 + .../node_modules/rambda/src/_internals/set.js | 41 + src/lib/node_modules/rambda/src/add.js | 5 + src/lib/node_modules/rambda/src/adjust.js | 16 + src/lib/node_modules/rambda/src/all.js | 9 + src/lib/node_modules/rambda/src/allPass.js | 13 + src/lib/node_modules/rambda/src/always.js | 3 + src/lib/node_modules/rambda/src/and.js | 5 + src/lib/node_modules/rambda/src/any.js | 13 + src/lib/node_modules/rambda/src/anyPass.js | 13 + src/lib/node_modules/rambda/src/append.js | 12 + src/lib/node_modules/rambda/src/apply.js | 7 + src/lib/node_modules/rambda/src/applySpec.js | 132 + src/lib/node_modules/rambda/src/assoc.js | 11 + src/lib/node_modules/rambda/src/assocPath.js | 50 + src/lib/node_modules/rambda/src/bind.js | 9 + src/lib/node_modules/rambda/src/both.js | 5 + src/lib/node_modules/rambda/src/chain.js | 7 + src/lib/node_modules/rambda/src/clamp.js | 15 + src/lib/node_modules/rambda/src/clone.js | 18 + src/lib/node_modules/rambda/src/complement.js | 3 + src/lib/node_modules/rambda/src/compose.js | 9 + src/lib/node_modules/rambda/src/concat.js | 5 + src/lib/node_modules/rambda/src/cond.js | 14 + src/lib/node_modules/rambda/src/converge.js | 18 + src/lib/node_modules/rambda/src/count.js | 10 + src/lib/node_modules/rambda/src/countBy.js | 17 + src/lib/node_modules/rambda/src/curry.js | 7 + src/lib/node_modules/rambda/src/curryN.js | 103 + src/lib/node_modules/rambda/src/dec.js | 1 + src/lib/node_modules/rambda/src/defaultTo.js | 13 + src/lib/node_modules/rambda/src/difference.js | 8 + src/lib/node_modules/rambda/src/dissoc.js | 13 + src/lib/node_modules/rambda/src/divide.js | 5 + src/lib/node_modules/rambda/src/drop.js | 5 + src/lib/node_modules/rambda/src/dropLast.js | 9 + .../node_modules/rambda/src/dropLastWhile.js | 32 + .../node_modules/rambda/src/dropRepeats.js | 20 + .../rambda/src/dropRepeatsWith.js | 28 + src/lib/node_modules/rambda/src/dropWhile.js | 26 + src/lib/node_modules/rambda/src/either.js | 8 + src/lib/node_modules/rambda/src/endsWith.js | 23 + src/lib/node_modules/rambda/src/eqProps.js | 11 + src/lib/node_modules/rambda/src/equals.js | 192 + src/lib/node_modules/rambda/src/evolve.js | 60 + src/lib/node_modules/rambda/src/filter.js | 50 + src/lib/node_modules/rambda/src/find.js | 15 + src/lib/node_modules/rambda/src/findIndex.js | 14 + src/lib/node_modules/rambda/src/findLast.js | 13 + .../node_modules/rambda/src/findLastIndex.js | 13 + src/lib/node_modules/rambda/src/flatten.js | 15 + src/lib/node_modules/rambda/src/flip.js | 23 + src/lib/node_modules/rambda/src/forEach.js | 34 + src/lib/node_modules/rambda/src/fromPairs.js | 6 + src/lib/node_modules/rambda/src/groupBy.js | 17 + src/lib/node_modules/rambda/src/groupWith.js | 46 + src/lib/node_modules/rambda/src/has.js | 7 + src/lib/node_modules/rambda/src/hasPath.js | 9 + src/lib/node_modules/rambda/src/head.js | 5 + src/lib/node_modules/rambda/src/identical.js | 7 + src/lib/node_modules/rambda/src/identity.js | 3 + src/lib/node_modules/rambda/src/ifElse.js | 18 + src/lib/node_modules/rambda/src/inc.js | 1 + src/lib/node_modules/rambda/src/includes.js | 16 + src/lib/node_modules/rambda/src/indexBy.js | 29 + src/lib/node_modules/rambda/src/indexOf.js | 9 + src/lib/node_modules/rambda/src/init.js | 11 + .../node_modules/rambda/src/intersection.js | 8 + .../node_modules/rambda/src/intersperse.js | 17 + src/lib/node_modules/rambda/src/is.js | 8 + src/lib/node_modules/rambda/src/isEmpty.js | 18 + src/lib/node_modules/rambda/src/isNil.js | 3 + src/lib/node_modules/rambda/src/isPromise.js | 5 + src/lib/node_modules/rambda/src/join.js | 5 + src/lib/node_modules/rambda/src/juxt.js | 3 + src/lib/node_modules/rambda/src/keys.js | 3 + src/lib/node_modules/rambda/src/last.js | 7 + .../node_modules/rambda/src/lastIndexOf.js | 9 + src/lib/node_modules/rambda/src/length.js | 8 + src/lib/node_modules/rambda/src/lens.js | 7 + src/lib/node_modules/rambda/src/lensIndex.js | 7 + src/lib/node_modules/rambda/src/lensPath.js | 7 + src/lib/node_modules/rambda/src/lensProp.js | 7 + src/lib/node_modules/rambda/src/map.js | 50 + src/lib/node_modules/rambda/src/match.js | 7 + src/lib/node_modules/rambda/src/mathMod.js | 8 + src/lib/node_modules/rambda/src/max.js | 5 + src/lib/node_modules/rambda/src/maxBy.js | 9 + src/lib/node_modules/rambda/src/maybe.js | 13 + src/lib/node_modules/rambda/src/mean.js | 5 + src/lib/node_modules/rambda/src/median.js | 17 + src/lib/node_modules/rambda/src/merge.js | 1 + src/lib/node_modules/rambda/src/mergeAll.js | 11 + .../node_modules/rambda/src/mergeDeepRight.js | 24 + src/lib/node_modules/rambda/src/mergeLeft.js | 7 + src/lib/node_modules/rambda/src/mergeRight.js | 8 + src/lib/node_modules/rambda/src/mergeWith.js | 29 + src/lib/node_modules/rambda/src/min.js | 5 + src/lib/node_modules/rambda/src/minBy.js | 9 + src/lib/node_modules/rambda/src/modify.js | 23 + src/lib/node_modules/rambda/src/modifyPath.js | 33 + src/lib/node_modules/rambda/src/modulo.js | 5 + src/lib/node_modules/rambda/src/move.js | 19 + src/lib/node_modules/rambda/src/multiply.js | 5 + src/lib/node_modules/rambda/src/negate.js | 3 + src/lib/node_modules/rambda/src/none.js | 9 + src/lib/node_modules/rambda/src/not.js | 3 + src/lib/node_modules/rambda/src/nth.js | 9 + src/lib/node_modules/rambda/src/objOf.js | 7 + src/lib/node_modules/rambda/src/of.js | 3 + src/lib/node_modules/rambda/src/omit.js | 20 + src/lib/node_modules/rambda/src/on.js | 16 + src/lib/node_modules/rambda/src/once.js | 24 + src/lib/node_modules/rambda/src/or.js | 5 + src/lib/node_modules/rambda/src/over.js | 14 + src/lib/node_modules/rambda/src/partial.js | 11 + .../node_modules/rambda/src/partialObject.js | 5 + src/lib/node_modules/rambda/src/partition.js | 44 + src/lib/node_modules/rambda/src/path.js | 25 + src/lib/node_modules/rambda/src/pathEq.js | 11 + src/lib/node_modules/rambda/src/pathOr.js | 11 + src/lib/node_modules/rambda/src/paths.js | 9 + src/lib/node_modules/rambda/src/pick.js | 21 + src/lib/node_modules/rambda/src/pickAll.js | 23 + src/lib/node_modules/rambda/src/pipe.js | 89 + src/lib/node_modules/rambda/src/pluck.js | 15 + src/lib/node_modules/rambda/src/prepend.js | 7 + src/lib/node_modules/rambda/src/product.js | 4 + src/lib/node_modules/rambda/src/prop.js | 7 + src/lib/node_modules/rambda/src/propEq.js | 13 + src/lib/node_modules/rambda/src/propIs.js | 10 + src/lib/node_modules/rambda/src/propOr.js | 12 + .../node_modules/rambda/src/propSatisfies.js | 10 + src/lib/node_modules/rambda/src/props.js | 13 + src/lib/node_modules/rambda/src/range.js | 18 + src/lib/node_modules/rambda/src/reduce.js | 33 + src/lib/node_modules/rambda/src/reject.js | 7 + src/lib/node_modules/rambda/src/repeat.js | 7 + src/lib/node_modules/rambda/src/replace.js | 9 + src/lib/node_modules/rambda/src/reverse.js | 10 + src/lib/node_modules/rambda/src/set.js | 13 + src/lib/node_modules/rambda/src/slice.js | 9 + src/lib/node_modules/rambda/src/sort.js | 7 + src/lib/node_modules/rambda/src/sortBy.js | 16 + src/lib/node_modules/rambda/src/split.js | 5 + src/lib/node_modules/rambda/src/splitAt.js | 21 + src/lib/node_modules/rambda/src/splitEvery.js | 18 + src/lib/node_modules/rambda/src/splitWhen.js | 25 + src/lib/node_modules/rambda/src/startsWith.js | 23 + src/lib/node_modules/rambda/src/subtract.js | 5 + src/lib/node_modules/rambda/src/sum.js | 3 + .../rambda/src/symmetricDifference.js | 12 + src/lib/node_modules/rambda/src/tail.js | 5 + src/lib/node_modules/rambda/src/take.js | 12 + src/lib/node_modules/rambda/src/takeLast.js | 19 + .../node_modules/rambda/src/takeLastWhile.js | 22 + src/lib/node_modules/rambda/src/takeWhile.js | 25 + src/lib/node_modules/rambda/src/tap.js | 7 + src/lib/node_modules/rambda/src/test.js | 9 + src/lib/node_modules/rambda/src/times.js | 12 + src/lib/node_modules/rambda/src/toLower.js | 3 + src/lib/node_modules/rambda/src/toPairs.js | 3 + src/lib/node_modules/rambda/src/toString.js | 3 + src/lib/node_modules/rambda/src/toUpper.js | 3 + src/lib/node_modules/rambda/src/transpose.js | 10 + src/lib/node_modules/rambda/src/trim.js | 3 + src/lib/node_modules/rambda/src/tryCatch.js | 18 + src/lib/node_modules/rambda/src/type.js | 12 + src/lib/node_modules/rambda/src/unapply.js | 5 + src/lib/node_modules/rambda/src/union.js | 14 + src/lib/node_modules/rambda/src/uniq.js | 13 + src/lib/node_modules/rambda/src/uniqBy.js | 13 + src/lib/node_modules/rambda/src/uniqWith.js | 35 + src/lib/node_modules/rambda/src/unless.js | 7 + src/lib/node_modules/rambda/src/unwind.js | 16 + src/lib/node_modules/rambda/src/update.js | 15 + src/lib/node_modules/rambda/src/values.js | 7 + src/lib/node_modules/rambda/src/view.js | 10 + src/lib/node_modules/rambda/src/when.js | 11 + src/lib/node_modules/rambda/src/where.js | 15 + src/lib/node_modules/rambda/src/whereAny.js | 12 + src/lib/node_modules/rambda/src/whereEq.js | 14 + src/lib/node_modules/rambda/src/without.js | 15 + src/lib/node_modules/rambda/src/xor.js | 5 + src/lib/node_modules/rambda/src/zip.js | 12 + src/lib/node_modules/rambda/src/zipObj.js | 13 + src/lib/node_modules/rambda/src/zipWith.js | 10 + src/lib/package.json | 26 + src/lib/{ => src}/accent-and-ps-utils.test.ts | 0 src/lib/{ => src}/accent-and-ps-utils.ts | 2 +- src/lib/{ => src}/accent-helpers.test.ts | 0 src/lib/{ => src}/accent-helpers.ts | 2 +- src/lib/{ => src}/convert-spelling.test.ts | 0 src/lib/{ => src}/convert-spelling.ts | 2 +- src/lib/{ => src}/default-text-options.ts | 2 +- src/lib/{ => src}/diacritics-helpers.test.ts | 0 src/lib/{ => src}/diacritics-helpers.ts | 0 src/lib/{ => src}/diacritics.test.ts | 2 +- src/lib/{ => src}/diacritics.ts | 2 +- src/lib/{ => src}/dictionary-models.js | 0 src/lib/{ => src}/dictionary.proto | 0 src/lib/{ => src}/dyn-comp-aux-verbs.ts | 2 +- src/lib/{ => src}/fields.ts | 2 +- src/lib/{ => src}/get-english-word.test.ts | 0 src/lib/{ => src}/get-english-word.ts | 2 +- src/lib/{ => src}/grammar-units.ts | 2 +- src/lib/{ => src}/human-readable.ts | 2 +- .../inflection-pattern.ts} | 19 +- src/lib/{ => src}/irregular-conjugations.ts | 2 +- src/lib/{ => src}/is-pashto.test.ts | 0 src/lib/{ => src}/is-pashto.ts | 0 src/lib/{ => src}/misc-helpers.test.ts | 2 +- src/lib/{ => src}/misc-helpers.ts | 2 +- src/lib/{ => src}/np-tools.ts | 5 +- src/lib/{ => src}/p-text-helpers.test.ts | 2 +- src/lib/{ => src}/p-text-helpers.ts | 2 +- src/lib/{ => src}/pashto-consonants.ts | 0 src/lib/{ => src}/pashto-inflector.test.ts | 2 +- src/lib/{ => src}/pashto-inflector.ts | 2 +- .../{ => src}/phonetics-to-diacritics.test.ts | 0 src/lib/{ => src}/phonetics-to-diacritics.ts | 0 .../{ => src}/phrase-building/blocks-utils.ts | 2 +- src/lib/{ => src}/phrase-building/compile.ts | 6 +- .../phrase-building/english-vp-rendering.ts | 2 +- .../src/phrase-building}/eps-reducer.ts | 10 +- .../src/phrase-building/make-selections.ts | 52 + src/lib/{ => src}/phrase-building/np-tools.ts | 4 +- .../{ => src}/phrase-building/render-adj.ts | 8 +- .../{ => src}/phrase-building/render-ap.ts | 2 +- .../phrase-building/render-common.ts | 4 +- .../phrase-building/render-complement.ts | 2 +- .../{ => src}/phrase-building/render-ep.ts | 4 +- .../{ => src}/phrase-building/render-np.ts | 4 +- .../phrase-building/render-sandwich.ts | 2 +- .../{ => src}/phrase-building/render-vp.ts | 6 +- .../src/phrase-building}/verb-selection.ts | 14 +- src/lib/{ => src}/phrase-building/vp-tools.ts | 17 +- .../src/phrase-building}/vps-reducer.ts | 29 +- src/lib/{ => src}/protobuf.test.ts | 2 +- src/lib/{ => src}/protobuf.ts | 2 +- src/lib/{ => src}/sandwiches.ts | 2 +- src/lib/{ => src}/shuffle-array.ts | 0 src/lib/{ => src}/simplify-phonetics.test.ts | 0 src/lib/{ => src}/simplify-phonetics.ts | 0 src/lib/{ => src}/standardize-pashto.test.ts | 0 src/lib/{ => src}/standardize-pashto.ts | 0 .../{ => src}/translate-phonetics-replacer.ts | 0 src/lib/{ => src}/translate-phonetics.test.ts | 0 src/lib/{ => src}/translate-phonetics.ts | 0 src/lib/{ => src}/type-predicates.ts | 6 +- src/lib/{ => src}/validate-entry.test.ts | 2 +- src/lib/{ => src}/validate-entry.ts | 2 +- src/lib/{ => src}/verb-conjugation.ts | 2 +- src/lib/{ => src}/verb-info.test.ts | 0 src/lib/{ => src}/verb-info.ts | 2 +- src/lib/yarn.lock | 8 + src/library.ts | 316 - src/rollup.config.js | 12 +- {nouns-adjs => vocab/nouns-adjs}/a-fem.js | 0 {nouns-adjs => vocab/nouns-adjs}/aa-fem.js | 0 .../nouns-adjs}/aanu-unisex.js | 0 {nouns-adjs => vocab/nouns-adjs}/adverbs.js | 0 {nouns-adjs => vocab/nouns-adjs}/basic-fem.js | 0 .../nouns-adjs}/basic-masc.js | 0 .../nouns-adjs}/basic-unisex.js | 0 {nouns-adjs => vocab/nouns-adjs}/e-fem.js | 0 {nouns-adjs => vocab/nouns-adjs}/ee-fem.js | 0 .../nouns-adjs}/exception-people-fem.js | 0 .../nouns-adjs}/exception-people-masc.js | 0 {nouns-adjs => vocab/nouns-adjs}/ey-masc.js | 0 .../nouns-adjs}/ey-stressed-unisex.js | 0 .../nouns-adjs}/ey-unstressed-unisex.js | 0 .../nouns-adjs}/loc-adverbs.js | 0 .../nouns-adjs}/non-inflecting.js | 0 .../nouns-adjs}/nouns-unisex.js | 0 {nouns-adjs => vocab/nouns-adjs}/o-fem.js | 0 .../nouns-adjs}/short-irreg-unisex.js | 0 {nouns-adjs => vocab/nouns-adjs}/u-masc.js | 0 {nouns-adjs => vocab/nouns-adjs}/uy-fem.js | 0 {nouns-adjs => vocab/nouns-adjs}/y-masc.js | 0 {verbs => vocab/verbs}/dyn-comp-trans.js | 0 {verbs => vocab/verbs}/simple-gramm-trans.js | 0 {verbs => vocab/verbs}/simple-intrans.js | 0 {verbs => vocab/verbs}/simple-trans.js | 0 .../verbs}/stative-comp-intrans.js | 0 {verbs => vocab/verbs}/stative-comp-trans.js | 0 1751 files changed, 148927 insertions(+), 1152 deletions(-) delete mode 100644 library-post-build.js delete mode 100644 library-tsconfig.json delete mode 100644 src/components.ts delete mode 100644 src/components/EntrySelect.tsx delete mode 100644 src/components/ep-explorer/EquativePicker.tsx rename src/{ => components}/images.d.ts (100%) create mode 100644 src/components/lib-tsconfig.json create mode 100644 src/components/library.ts create mode 120000 src/components/node_modules/.bin/loose-envify create mode 120000 src/components/node_modules/.bin/lz-string create mode 120000 src/components/node_modules/.bin/resolve create mode 100644 src/components/node_modules/.yarn-integrity create mode 100644 src/components/node_modules/@babel/code-frame/LICENSE create mode 100644 src/components/node_modules/@babel/code-frame/README.md create mode 100644 src/components/node_modules/@babel/code-frame/lib/index.js create mode 100644 src/components/node_modules/@babel/code-frame/package.json create mode 100644 src/components/node_modules/@babel/helper-module-imports/LICENSE create mode 100644 src/components/node_modules/@babel/helper-module-imports/README.md create mode 100644 src/components/node_modules/@babel/helper-module-imports/lib/import-builder.js create mode 100644 src/components/node_modules/@babel/helper-module-imports/lib/import-injector.js create mode 100644 src/components/node_modules/@babel/helper-module-imports/lib/index.js create mode 100644 src/components/node_modules/@babel/helper-module-imports/lib/is-module.js create mode 100644 src/components/node_modules/@babel/helper-module-imports/package.json create mode 100644 src/components/node_modules/@babel/helper-plugin-utils/LICENSE create mode 100644 src/components/node_modules/@babel/helper-plugin-utils/README.md create mode 100644 src/components/node_modules/@babel/helper-plugin-utils/lib/index.js create mode 100644 src/components/node_modules/@babel/helper-plugin-utils/lib/index.js.map create mode 100644 src/components/node_modules/@babel/helper-plugin-utils/package.json create mode 100644 src/components/node_modules/@babel/helper-string-parser/LICENSE create mode 100644 src/components/node_modules/@babel/helper-string-parser/README.md create mode 100644 src/components/node_modules/@babel/helper-string-parser/lib/index.js create mode 100644 src/components/node_modules/@babel/helper-string-parser/package.json create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/LICENSE create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/README.md create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/identifier.js create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/index.js create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/index.js.map create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/keyword.js create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/package.json create mode 100644 src/components/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js create mode 100644 src/components/node_modules/@babel/highlight/LICENSE create mode 100644 src/components/node_modules/@babel/highlight/README.md create mode 100644 src/components/node_modules/@babel/highlight/lib/index.js create mode 100644 src/components/node_modules/@babel/highlight/package.json create mode 100644 src/components/node_modules/@babel/plugin-syntax-jsx/LICENSE create mode 100644 src/components/node_modules/@babel/plugin-syntax-jsx/README.md create mode 100644 src/components/node_modules/@babel/plugin-syntax-jsx/lib/index.js create mode 100644 src/components/node_modules/@babel/plugin-syntax-jsx/package.json create mode 100644 src/components/node_modules/@babel/runtime/LICENSE create mode 100644 src/components/node_modules/@babel/runtime/README.md create mode 100644 src/components/node_modules/@babel/runtime/helpers/AsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/AwaitValue.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/OverloadYield.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/applyDecs.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/applyDecs2203.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/arrayLikeToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/arrayWithHoles.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/assertThisInitialized.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/asyncIterator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/asyncToGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classCallCheck.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classNameTDZError.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/construct.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/createClass.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/createSuper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/decorate.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/defaults.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/defineProperty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/AwaitValue.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/OverloadYield.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/applyDecs.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/asyncIterator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classCallCheck.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/construct.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/createClass.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/createSuper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/decorate.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/defaults.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/defineProperty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/extends.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/get.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/identity.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/inherits.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/instanceof.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/iterableToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/jsx.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/objectSpread.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/objectSpread2.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/package.json create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/readOnlyError.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/set.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/slicedToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/superPropBase.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/tdz.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/temporalRef.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/toArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/toPrimitive.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/typeof.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/extends.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/get.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/getPrototypeOf.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/identity.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/inherits.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/inheritsLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/initializerDefineProperty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/initializerWarningHelper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/instanceof.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/interopRequireDefault.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/interopRequireWildcard.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/isNativeFunction.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/iterableToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/jsx.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/maybeArrayLike.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/newArrowCheck.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/nonIterableRest.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/nonIterableSpread.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/objectSpread.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/objectSpread2.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/objectWithoutProperties.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/readOnlyError.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/regeneratorRuntime.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/set.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/setPrototypeOf.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/slicedToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/superPropBase.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/tdz.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/temporalRef.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/temporalUndefined.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/toArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/toConsumableArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/toPrimitive.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/toPropertyKey.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/typeof.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/wrapNativeSuper.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/wrapRegExp.js create mode 100644 src/components/node_modules/@babel/runtime/helpers/writeOnlyError.js create mode 100644 src/components/node_modules/@babel/runtime/package.json create mode 100644 src/components/node_modules/@babel/runtime/regenerator/index.js create mode 100644 src/components/node_modules/@babel/types/LICENSE create mode 100644 src/components/node_modules/@babel/types/README.md create mode 100644 src/components/node_modules/@babel/types/lib/asserts/assertNode.js create mode 100644 src/components/node_modules/@babel/types/lib/asserts/assertNode.js.map create mode 100644 src/components/node_modules/@babel/types/lib/asserts/generated/index.js create mode 100644 src/components/node_modules/@babel/types/lib/asserts/generated/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/ast-types/generated/index.js create mode 100644 src/components/node_modules/@babel/types/lib/ast-types/generated/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/generated/index.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/generated/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/generated/uppercase.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/generated/uppercase.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/react/buildChildren.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/react/buildChildren.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map create mode 100644 src/components/node_modules/@babel/types/lib/builders/validateNode.js create mode 100644 src/components/node_modules/@babel/types/lib/builders/validateNode.js.map create mode 100644 src/components/node_modules/@babel/types/lib/clone/clone.js create mode 100644 src/components/node_modules/@babel/types/lib/clone/clone.js.map create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneDeep.js create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneDeep.js.map create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneNode.js create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneNode.js.map create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js create mode 100644 src/components/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/addComment.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/addComment.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/addComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/addComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritInnerComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritLeadingComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritTrailingComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritsComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/inheritsComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/comments/removeComments.js create mode 100644 src/components/node_modules/@babel/types/lib/comments/removeComments.js.map create mode 100644 src/components/node_modules/@babel/types/lib/constants/generated/index.js create mode 100644 src/components/node_modules/@babel/types/lib/constants/generated/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/constants/index.js create mode 100644 src/components/node_modules/@babel/types/lib/constants/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/ensureBlock.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/ensureBlock.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toBlock.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toBlock.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toComputedKey.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toComputedKey.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toExpression.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toExpression.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toIdentifier.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toIdentifier.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toKeyAlias.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toKeyAlias.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toSequenceExpression.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/toStatement.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/toStatement.js.map create mode 100644 src/components/node_modules/@babel/types/lib/converters/valueToNode.js create mode 100644 src/components/node_modules/@babel/types/lib/converters/valueToNode.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/core.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/core.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/experimental.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/experimental.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/flow.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/flow.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/index.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/jsx.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/jsx.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/misc.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/misc.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/placeholders.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/placeholders.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/typescript.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/typescript.js.map create mode 100644 src/components/node_modules/@babel/types/lib/definitions/utils.js create mode 100644 src/components/node_modules/@babel/types/lib/definitions/utils.js.map create mode 100644 src/components/node_modules/@babel/types/lib/index-legacy.d.ts create mode 100644 src/components/node_modules/@babel/types/lib/index.d.ts create mode 100644 src/components/node_modules/@babel/types/lib/index.d.ts.map create mode 100644 src/components/node_modules/@babel/types/lib/index.js create mode 100644 src/components/node_modules/@babel/types/lib/index.js.flow create mode 100644 src/components/node_modules/@babel/types/lib/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/inherits.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/inherits.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/removeProperties.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/removeProperties.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map create mode 100644 src/components/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js create mode 100644 src/components/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map create mode 100644 src/components/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js create mode 100644 src/components/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map create mode 100644 src/components/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js create mode 100644 src/components/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map create mode 100644 src/components/node_modules/@babel/types/lib/traverse/traverse.js create mode 100644 src/components/node_modules/@babel/types/lib/traverse/traverse.js.map create mode 100644 src/components/node_modules/@babel/types/lib/traverse/traverseFast.js create mode 100644 src/components/node_modules/@babel/types/lib/traverse/traverseFast.js.map create mode 100644 src/components/node_modules/@babel/types/lib/utils/inherit.js create mode 100644 src/components/node_modules/@babel/types/lib/utils/inherit.js.map create mode 100644 src/components/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js create mode 100644 src/components/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map create mode 100644 src/components/node_modules/@babel/types/lib/utils/shallowEqual.js create mode 100644 src/components/node_modules/@babel/types/lib/utils/shallowEqual.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/generated/index.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/generated/index.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/is.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/is.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isBinding.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isBinding.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isBlockScoped.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isBlockScoped.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isImmutable.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isImmutable.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isLet.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isLet.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isNode.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isNode.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isNodesEquivalent.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isPlaceholderType.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isReferenced.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isReferenced.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isScope.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isScope.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isSpecifierDefault.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isType.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isType.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isValidES3Identifier.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isValidIdentifier.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/isVar.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/isVar.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/matchesPattern.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/matchesPattern.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/react/isCompatTag.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/react/isReactComponent.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map create mode 100644 src/components/node_modules/@babel/types/lib/validators/validate.js create mode 100644 src/components/node_modules/@babel/types/lib/validators/validate.js.map create mode 100644 src/components/node_modules/@babel/types/package.json create mode 100644 src/components/node_modules/@babel/types/scripts/generators/asserts.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/ast-types.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/builders.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/constants.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/docs.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/flow.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/typescript-legacy.js create mode 100644 src/components/node_modules/@babel/types/scripts/generators/validators.js create mode 100644 src/components/node_modules/@babel/types/scripts/package.json create mode 100644 src/components/node_modules/@babel/types/scripts/utils/formatBuilderName.js create mode 100644 src/components/node_modules/@babel/types/scripts/utils/lowerFirst.js create mode 100644 src/components/node_modules/@babel/types/scripts/utils/stringifyValidator.js create mode 100644 src/components/node_modules/@babel/types/scripts/utils/toFunctionName.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/LICENSE create mode 100644 src/components/node_modules/@emotion/babel-plugin/README.md create mode 100644 src/components/node_modules/@emotion/babel-plugin/package.json create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/core-macro.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/emotion-macro.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/index.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/styled-macro.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/add-import.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/create-node-env-conditional.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/get-styled-options.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/get-target-class-name.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/index.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/label.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/minify.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/object-to-string.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/source-maps.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/strings.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/transform-expression-with-styles.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/transformer-macro.js create mode 100644 src/components/node_modules/@emotion/babel-plugin/src/utils/transpiled-output-utils.js create mode 100644 src/components/node_modules/@emotion/cache/LICENSE create mode 100644 src/components/node_modules/@emotion/cache/README.md create mode 100644 src/components/node_modules/@emotion/cache/package.json create mode 100644 src/components/node_modules/@emotion/cache/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/cache/src/index.js create mode 100644 src/components/node_modules/@emotion/cache/src/stylis-plugins.js create mode 100644 src/components/node_modules/@emotion/cache/src/types.js create mode 100644 src/components/node_modules/@emotion/cache/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/hash/LICENSE create mode 100644 src/components/node_modules/@emotion/hash/README.md create mode 100644 src/components/node_modules/@emotion/hash/package.json create mode 100644 src/components/node_modules/@emotion/hash/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/hash/src/index.js create mode 100644 src/components/node_modules/@emotion/hash/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/memoize/LICENSE create mode 100644 src/components/node_modules/@emotion/memoize/package.json create mode 100644 src/components/node_modules/@emotion/memoize/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/memoize/src/index.js create mode 100644 src/components/node_modules/@emotion/memoize/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/react/LICENSE create mode 100644 src/components/node_modules/@emotion/react/README.md create mode 100644 src/components/node_modules/@emotion/react/_isolated-hnrs/package.json create mode 100644 src/components/node_modules/@emotion/react/jsx-dev-runtime/package.json create mode 100644 src/components/node_modules/@emotion/react/jsx-runtime/package.json create mode 100644 src/components/node_modules/@emotion/react/macro.d.ts create mode 100644 src/components/node_modules/@emotion/react/macro.js create mode 100644 src/components/node_modules/@emotion/react/macro.js.flow create mode 100644 src/components/node_modules/@emotion/react/package.json create mode 100644 src/components/node_modules/@emotion/react/src/_isolated-hnrs.d.ts create mode 100644 src/components/node_modules/@emotion/react/src/_isolated-hnrs.js create mode 100644 src/components/node_modules/@emotion/react/src/class-names.js create mode 100644 src/components/node_modules/@emotion/react/src/context.js create mode 100644 src/components/node_modules/@emotion/react/src/css.js create mode 100644 src/components/node_modules/@emotion/react/src/emotion-element.js create mode 100644 src/components/node_modules/@emotion/react/src/get-label-from-stack-trace.js create mode 100644 src/components/node_modules/@emotion/react/src/global.js create mode 100644 src/components/node_modules/@emotion/react/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/react/src/index.js create mode 100644 src/components/node_modules/@emotion/react/src/jsx-dev-runtime.d.ts create mode 100644 src/components/node_modules/@emotion/react/src/jsx-dev-runtime.js create mode 100644 src/components/node_modules/@emotion/react/src/jsx-runtime.d.ts create mode 100644 src/components/node_modules/@emotion/react/src/jsx-runtime.js create mode 100644 src/components/node_modules/@emotion/react/src/jsx.js create mode 100644 src/components/node_modules/@emotion/react/src/keyframes.js create mode 100644 src/components/node_modules/@emotion/react/src/theming.js create mode 100644 src/components/node_modules/@emotion/react/src/utils.js create mode 100644 src/components/node_modules/@emotion/react/types/css-prop.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/helper.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/jsx-dev-runtime.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/jsx-namespace.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/jsx-runtime.d.ts create mode 100644 src/components/node_modules/@emotion/react/types/theming.d.ts create mode 100644 src/components/node_modules/@emotion/serialize/LICENSE create mode 100644 src/components/node_modules/@emotion/serialize/package.json create mode 100644 src/components/node_modules/@emotion/serialize/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/serialize/src/index.js create mode 100644 src/components/node_modules/@emotion/serialize/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/sheet/LICENSE create mode 100644 src/components/node_modules/@emotion/sheet/README.md create mode 100644 src/components/node_modules/@emotion/sheet/package.json create mode 100644 src/components/node_modules/@emotion/sheet/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/sheet/src/index.js create mode 100644 src/components/node_modules/@emotion/sheet/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/unitless/LICENSE create mode 100644 src/components/node_modules/@emotion/unitless/README.md create mode 100644 src/components/node_modules/@emotion/unitless/package.json create mode 100644 src/components/node_modules/@emotion/unitless/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/unitless/src/index.js create mode 100644 src/components/node_modules/@emotion/use-insertion-effect-with-fallbacks/LICENSE create mode 100644 src/components/node_modules/@emotion/use-insertion-effect-with-fallbacks/README.md create mode 100644 src/components/node_modules/@emotion/use-insertion-effect-with-fallbacks/package.json create mode 100644 src/components/node_modules/@emotion/use-insertion-effect-with-fallbacks/src/index.js create mode 100644 src/components/node_modules/@emotion/utils/LICENSE create mode 100644 src/components/node_modules/@emotion/utils/package.json create mode 100644 src/components/node_modules/@emotion/utils/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/utils/src/index.js create mode 100644 src/components/node_modules/@emotion/utils/src/types.js create mode 100644 src/components/node_modules/@emotion/utils/types/index.d.ts create mode 100644 src/components/node_modules/@emotion/weak-memoize/LICENSE create mode 100644 src/components/node_modules/@emotion/weak-memoize/README.md create mode 100644 src/components/node_modules/@emotion/weak-memoize/package.json create mode 100644 src/components/node_modules/@emotion/weak-memoize/src/index.d.ts create mode 100644 src/components/node_modules/@emotion/weak-memoize/src/index.js create mode 100644 src/components/node_modules/@emotion/weak-memoize/types/index.d.ts create mode 100644 src/components/node_modules/@formkit/auto-animate/LICENSE create mode 100644 src/components/node_modules/@formkit/auto-animate/README.md create mode 100644 src/components/node_modules/@formkit/auto-animate/angular/index.d.ts create mode 100644 src/components/node_modules/@formkit/auto-animate/angular/index.mjs create mode 100644 src/components/node_modules/@formkit/auto-animate/index.d.ts create mode 100644 src/components/node_modules/@formkit/auto-animate/index.min.js create mode 100644 src/components/node_modules/@formkit/auto-animate/index.mjs create mode 100644 src/components/node_modules/@formkit/auto-animate/package.json create mode 100644 src/components/node_modules/@formkit/auto-animate/react/index.d.ts create mode 100644 src/components/node_modules/@formkit/auto-animate/react/index.mjs create mode 100644 src/components/node_modules/@formkit/auto-animate/vue/index.d.ts create mode 100644 src/components/node_modules/@formkit/auto-animate/vue/index.mjs create mode 100644 src/components/node_modules/@types/parse-json/LICENSE create mode 100644 src/components/node_modules/@types/parse-json/README.md create mode 100644 src/components/node_modules/@types/parse-json/index.d.ts create mode 100644 src/components/node_modules/@types/parse-json/package.json create mode 100755 src/components/node_modules/@types/prop-types/LICENSE create mode 100755 src/components/node_modules/@types/prop-types/README.md create mode 100755 src/components/node_modules/@types/prop-types/index.d.ts create mode 100755 src/components/node_modules/@types/prop-types/package.json create mode 100755 src/components/node_modules/@types/react-transition-group/CSSTransition.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/LICENSE create mode 100755 src/components/node_modules/@types/react-transition-group/README.md create mode 100755 src/components/node_modules/@types/react-transition-group/SwitchTransition.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/Transition.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/TransitionGroup.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/config.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/index.d.ts create mode 100755 src/components/node_modules/@types/react-transition-group/package.json create mode 100755 src/components/node_modules/@types/react/LICENSE create mode 100755 src/components/node_modules/@types/react/README.md create mode 100755 src/components/node_modules/@types/react/experimental.d.ts create mode 100755 src/components/node_modules/@types/react/global.d.ts create mode 100755 src/components/node_modules/@types/react/index.d.ts create mode 100755 src/components/node_modules/@types/react/jsx-dev-runtime.d.ts create mode 100755 src/components/node_modules/@types/react/jsx-runtime.d.ts create mode 100755 src/components/node_modules/@types/react/next.d.ts create mode 100755 src/components/node_modules/@types/react/package.json create mode 100755 src/components/node_modules/@types/scheduler/LICENSE create mode 100755 src/components/node_modules/@types/scheduler/README.md create mode 100755 src/components/node_modules/@types/scheduler/index.d.ts create mode 100755 src/components/node_modules/@types/scheduler/package.json create mode 100755 src/components/node_modules/@types/scheduler/tracing.d.ts create mode 100644 src/components/node_modules/ansi-styles/index.js create mode 100644 src/components/node_modules/ansi-styles/license create mode 100644 src/components/node_modules/ansi-styles/package.json create mode 100644 src/components/node_modules/ansi-styles/readme.md create mode 100644 src/components/node_modules/babel-plugin-macros/CHANGELOG.md create mode 100644 src/components/node_modules/babel-plugin-macros/LICENSE create mode 100644 src/components/node_modules/babel-plugin-macros/README.md create mode 120000 src/components/node_modules/babel-plugin-macros/node_modules/.bin/resolve create mode 100644 src/components/node_modules/babel-plugin-macros/package.json create mode 100644 src/components/node_modules/callsites/index.d.ts create mode 100644 src/components/node_modules/callsites/index.js create mode 100644 src/components/node_modules/callsites/license create mode 100644 src/components/node_modules/callsites/package.json create mode 100644 src/components/node_modules/callsites/readme.md create mode 100644 src/components/node_modules/chalk/index.js create mode 100644 src/components/node_modules/chalk/index.js.flow create mode 100644 src/components/node_modules/chalk/license create mode 100644 src/components/node_modules/chalk/node_modules/escape-string-regexp/index.js create mode 100644 src/components/node_modules/chalk/node_modules/escape-string-regexp/license create mode 100644 src/components/node_modules/chalk/node_modules/escape-string-regexp/package.json create mode 100644 src/components/node_modules/chalk/node_modules/escape-string-regexp/readme.md create mode 100644 src/components/node_modules/chalk/package.json create mode 100644 src/components/node_modules/chalk/readme.md create mode 100644 src/components/node_modules/chalk/templates.js create mode 100644 src/components/node_modules/chalk/types/index.d.ts create mode 100644 src/components/node_modules/classnames/HISTORY.md create mode 100644 src/components/node_modules/classnames/LICENSE create mode 100644 src/components/node_modules/classnames/README.md create mode 100644 src/components/node_modules/classnames/bind.d.ts create mode 100644 src/components/node_modules/classnames/bind.js create mode 100644 src/components/node_modules/classnames/dedupe.d.ts create mode 100644 src/components/node_modules/classnames/dedupe.js create mode 100644 src/components/node_modules/classnames/index.d.ts create mode 100644 src/components/node_modules/classnames/index.js create mode 100644 src/components/node_modules/classnames/package.json create mode 100644 src/components/node_modules/color-convert/CHANGELOG.md create mode 100644 src/components/node_modules/color-convert/LICENSE create mode 100644 src/components/node_modules/color-convert/README.md create mode 100644 src/components/node_modules/color-convert/conversions.js create mode 100644 src/components/node_modules/color-convert/index.js create mode 100644 src/components/node_modules/color-convert/package.json create mode 100644 src/components/node_modules/color-convert/route.js create mode 100644 src/components/node_modules/color-name/.eslintrc.json create mode 100644 src/components/node_modules/color-name/.npmignore create mode 100644 src/components/node_modules/color-name/LICENSE create mode 100644 src/components/node_modules/color-name/README.md create mode 100644 src/components/node_modules/color-name/index.js create mode 100644 src/components/node_modules/color-name/package.json create mode 100644 src/components/node_modules/color-name/test.js create mode 100644 src/components/node_modules/convert-source-map/LICENSE create mode 100644 src/components/node_modules/convert-source-map/README.md create mode 100644 src/components/node_modules/convert-source-map/index.js create mode 100644 src/components/node_modules/convert-source-map/package.json create mode 100644 src/components/node_modules/cosmiconfig/LICENSE create mode 100644 src/components/node_modules/cosmiconfig/README.md create mode 100644 src/components/node_modules/cosmiconfig/package.json create mode 100644 src/components/node_modules/csstype/LICENSE create mode 100644 src/components/node_modules/csstype/README.md create mode 100644 src/components/node_modules/csstype/index.d.ts create mode 100644 src/components/node_modules/csstype/index.js.flow create mode 100644 src/components/node_modules/csstype/package.json create mode 100644 src/components/node_modules/dom-helpers/LICENSE create mode 100644 src/components/node_modules/dom-helpers/README.md create mode 100644 src/components/node_modules/dom-helpers/activeElement/package.json create mode 100644 src/components/node_modules/dom-helpers/addClass/package.json create mode 100644 src/components/node_modules/dom-helpers/addEventListener/package.json create mode 100644 src/components/node_modules/dom-helpers/animate/package.json create mode 100644 src/components/node_modules/dom-helpers/animationFrame/package.json create mode 100644 src/components/node_modules/dom-helpers/attribute/package.json create mode 100644 src/components/node_modules/dom-helpers/camelize/package.json create mode 100644 src/components/node_modules/dom-helpers/camelizeStyle/package.json create mode 100644 src/components/node_modules/dom-helpers/canUseDOM/package.json create mode 100644 src/components/node_modules/dom-helpers/childElements/package.json create mode 100644 src/components/node_modules/dom-helpers/childNodes/package.json create mode 100644 src/components/node_modules/dom-helpers/cjs/activeElement.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/activeElement.js create mode 100644 src/components/node_modules/dom-helpers/cjs/addClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/addClass.js create mode 100644 src/components/node_modules/dom-helpers/cjs/addEventListener.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/addEventListener.js create mode 100644 src/components/node_modules/dom-helpers/cjs/animate.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/animate.js create mode 100644 src/components/node_modules/dom-helpers/cjs/animationFrame.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/animationFrame.js create mode 100644 src/components/node_modules/dom-helpers/cjs/attribute.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/attribute.js create mode 100644 src/components/node_modules/dom-helpers/cjs/camelize.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/camelize.js create mode 100644 src/components/node_modules/dom-helpers/cjs/camelizeStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/camelizeStyle.js create mode 100644 src/components/node_modules/dom-helpers/cjs/canUseDOM.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/canUseDOM.js create mode 100644 src/components/node_modules/dom-helpers/cjs/childElements.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/childElements.js create mode 100644 src/components/node_modules/dom-helpers/cjs/childNodes.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/childNodes.js create mode 100644 src/components/node_modules/dom-helpers/cjs/clear.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/clear.js create mode 100644 src/components/node_modules/dom-helpers/cjs/closest.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/closest.js create mode 100644 src/components/node_modules/dom-helpers/cjs/collectElements.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/collectElements.js create mode 100644 src/components/node_modules/dom-helpers/cjs/collectSiblings.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/collectSiblings.js create mode 100644 src/components/node_modules/dom-helpers/cjs/contains.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/contains.js create mode 100644 src/components/node_modules/dom-helpers/cjs/css.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/css.js create mode 100644 src/components/node_modules/dom-helpers/cjs/filterEventHandler.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/filterEventHandler.js create mode 100644 src/components/node_modules/dom-helpers/cjs/getComputedStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/getComputedStyle.js create mode 100644 src/components/node_modules/dom-helpers/cjs/getScrollAccessor.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/getScrollAccessor.js create mode 100644 src/components/node_modules/dom-helpers/cjs/hasClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/hasClass.js create mode 100644 src/components/node_modules/dom-helpers/cjs/height.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/height.js create mode 100644 src/components/node_modules/dom-helpers/cjs/hyphenate.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/hyphenate.js create mode 100644 src/components/node_modules/dom-helpers/cjs/hyphenateStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/hyphenateStyle.js create mode 100644 src/components/node_modules/dom-helpers/cjs/index.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/index.js create mode 100644 src/components/node_modules/dom-helpers/cjs/insertAfter.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/insertAfter.js create mode 100644 src/components/node_modules/dom-helpers/cjs/isDocument.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/isDocument.js create mode 100644 src/components/node_modules/dom-helpers/cjs/isInput.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/isInput.js create mode 100644 src/components/node_modules/dom-helpers/cjs/isTransform.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/isTransform.js create mode 100644 src/components/node_modules/dom-helpers/cjs/isVisible.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/isVisible.js create mode 100644 src/components/node_modules/dom-helpers/cjs/isWindow.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/isWindow.js create mode 100644 src/components/node_modules/dom-helpers/cjs/listen.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/listen.js create mode 100644 src/components/node_modules/dom-helpers/cjs/matches.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/matches.js create mode 100644 src/components/node_modules/dom-helpers/cjs/nextUntil.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/nextUntil.js create mode 100644 src/components/node_modules/dom-helpers/cjs/offset.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/offset.js create mode 100644 src/components/node_modules/dom-helpers/cjs/offsetParent.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/offsetParent.js create mode 100644 src/components/node_modules/dom-helpers/cjs/ownerDocument.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/ownerDocument.js create mode 100644 src/components/node_modules/dom-helpers/cjs/ownerWindow.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/ownerWindow.js create mode 100644 src/components/node_modules/dom-helpers/cjs/parents.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/parents.js create mode 100644 src/components/node_modules/dom-helpers/cjs/position.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/position.js create mode 100644 src/components/node_modules/dom-helpers/cjs/prepend.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/prepend.js create mode 100644 src/components/node_modules/dom-helpers/cjs/querySelectorAll.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/querySelectorAll.js create mode 100644 src/components/node_modules/dom-helpers/cjs/remove.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/remove.js create mode 100644 src/components/node_modules/dom-helpers/cjs/removeClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/removeClass.js create mode 100644 src/components/node_modules/dom-helpers/cjs/removeEventListener.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/removeEventListener.js create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollLeft.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollLeft.js create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollParent.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollParent.js create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollTo.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollTo.js create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollTop.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollTop.js create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollbarSize.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/scrollbarSize.js create mode 100644 src/components/node_modules/dom-helpers/cjs/siblings.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/siblings.js create mode 100644 src/components/node_modules/dom-helpers/cjs/text.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/text.js create mode 100644 src/components/node_modules/dom-helpers/cjs/toggleClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/toggleClass.js create mode 100644 src/components/node_modules/dom-helpers/cjs/transitionEnd.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/transitionEnd.js create mode 100644 src/components/node_modules/dom-helpers/cjs/triggerEvent.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/triggerEvent.js create mode 100644 src/components/node_modules/dom-helpers/cjs/types.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/width.d.ts create mode 100644 src/components/node_modules/dom-helpers/cjs/width.js create mode 100644 src/components/node_modules/dom-helpers/clear/package.json create mode 100644 src/components/node_modules/dom-helpers/closest/package.json create mode 100644 src/components/node_modules/dom-helpers/collectElements/package.json create mode 100644 src/components/node_modules/dom-helpers/collectSiblings/package.json create mode 100644 src/components/node_modules/dom-helpers/contains/package.json create mode 100644 src/components/node_modules/dom-helpers/css/package.json create mode 100644 src/components/node_modules/dom-helpers/esm/activeElement.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/activeElement.js create mode 100644 src/components/node_modules/dom-helpers/esm/addClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/addClass.js create mode 100644 src/components/node_modules/dom-helpers/esm/addEventListener.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/addEventListener.js create mode 100644 src/components/node_modules/dom-helpers/esm/animate.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/animate.js create mode 100644 src/components/node_modules/dom-helpers/esm/animationFrame.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/animationFrame.js create mode 100644 src/components/node_modules/dom-helpers/esm/attribute.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/attribute.js create mode 100644 src/components/node_modules/dom-helpers/esm/camelize.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/camelize.js create mode 100644 src/components/node_modules/dom-helpers/esm/camelizeStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/camelizeStyle.js create mode 100644 src/components/node_modules/dom-helpers/esm/canUseDOM.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/canUseDOM.js create mode 100644 src/components/node_modules/dom-helpers/esm/childElements.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/childElements.js create mode 100644 src/components/node_modules/dom-helpers/esm/childNodes.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/childNodes.js create mode 100644 src/components/node_modules/dom-helpers/esm/clear.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/clear.js create mode 100644 src/components/node_modules/dom-helpers/esm/closest.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/closest.js create mode 100644 src/components/node_modules/dom-helpers/esm/collectElements.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/collectElements.js create mode 100644 src/components/node_modules/dom-helpers/esm/collectSiblings.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/collectSiblings.js create mode 100644 src/components/node_modules/dom-helpers/esm/contains.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/contains.js create mode 100644 src/components/node_modules/dom-helpers/esm/css.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/css.js create mode 100644 src/components/node_modules/dom-helpers/esm/filterEventHandler.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/filterEventHandler.js create mode 100644 src/components/node_modules/dom-helpers/esm/getComputedStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/getComputedStyle.js create mode 100644 src/components/node_modules/dom-helpers/esm/getScrollAccessor.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/getScrollAccessor.js create mode 100644 src/components/node_modules/dom-helpers/esm/hasClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/hasClass.js create mode 100644 src/components/node_modules/dom-helpers/esm/height.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/height.js create mode 100644 src/components/node_modules/dom-helpers/esm/hyphenate.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/hyphenate.js create mode 100644 src/components/node_modules/dom-helpers/esm/hyphenateStyle.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/hyphenateStyle.js create mode 100644 src/components/node_modules/dom-helpers/esm/index.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/index.js create mode 100644 src/components/node_modules/dom-helpers/esm/insertAfter.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/insertAfter.js create mode 100644 src/components/node_modules/dom-helpers/esm/isDocument.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/isDocument.js create mode 100644 src/components/node_modules/dom-helpers/esm/isInput.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/isInput.js create mode 100644 src/components/node_modules/dom-helpers/esm/isTransform.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/isTransform.js create mode 100644 src/components/node_modules/dom-helpers/esm/isVisible.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/isVisible.js create mode 100644 src/components/node_modules/dom-helpers/esm/isWindow.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/isWindow.js create mode 100644 src/components/node_modules/dom-helpers/esm/listen.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/listen.js create mode 100644 src/components/node_modules/dom-helpers/esm/matches.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/matches.js create mode 100644 src/components/node_modules/dom-helpers/esm/nextUntil.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/nextUntil.js create mode 100644 src/components/node_modules/dom-helpers/esm/offset.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/offset.js create mode 100644 src/components/node_modules/dom-helpers/esm/offsetParent.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/offsetParent.js create mode 100644 src/components/node_modules/dom-helpers/esm/ownerDocument.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/ownerDocument.js create mode 100644 src/components/node_modules/dom-helpers/esm/ownerWindow.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/ownerWindow.js create mode 100644 src/components/node_modules/dom-helpers/esm/parents.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/parents.js create mode 100644 src/components/node_modules/dom-helpers/esm/position.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/position.js create mode 100644 src/components/node_modules/dom-helpers/esm/prepend.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/prepend.js create mode 100644 src/components/node_modules/dom-helpers/esm/querySelectorAll.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/querySelectorAll.js create mode 100644 src/components/node_modules/dom-helpers/esm/remove.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/remove.js create mode 100644 src/components/node_modules/dom-helpers/esm/removeClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/removeClass.js create mode 100644 src/components/node_modules/dom-helpers/esm/removeEventListener.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/removeEventListener.js create mode 100644 src/components/node_modules/dom-helpers/esm/scrollLeft.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/scrollLeft.js create mode 100644 src/components/node_modules/dom-helpers/esm/scrollParent.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/scrollParent.js create mode 100644 src/components/node_modules/dom-helpers/esm/scrollTo.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/scrollTo.js create mode 100644 src/components/node_modules/dom-helpers/esm/scrollTop.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/scrollTop.js create mode 100644 src/components/node_modules/dom-helpers/esm/scrollbarSize.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/scrollbarSize.js create mode 100644 src/components/node_modules/dom-helpers/esm/siblings.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/siblings.js create mode 100644 src/components/node_modules/dom-helpers/esm/text.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/text.js create mode 100644 src/components/node_modules/dom-helpers/esm/toggleClass.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/toggleClass.js create mode 100644 src/components/node_modules/dom-helpers/esm/transitionEnd.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/transitionEnd.js create mode 100644 src/components/node_modules/dom-helpers/esm/triggerEvent.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/triggerEvent.js create mode 100644 src/components/node_modules/dom-helpers/esm/types.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/width.d.ts create mode 100644 src/components/node_modules/dom-helpers/esm/width.js create mode 100644 src/components/node_modules/dom-helpers/filterEventHandler/package.json create mode 100644 src/components/node_modules/dom-helpers/getComputedStyle/package.json create mode 100644 src/components/node_modules/dom-helpers/getScrollAccessor/package.json create mode 100644 src/components/node_modules/dom-helpers/hasClass/package.json create mode 100644 src/components/node_modules/dom-helpers/height/package.json create mode 100644 src/components/node_modules/dom-helpers/hyphenate/package.json create mode 100644 src/components/node_modules/dom-helpers/hyphenateStyle/package.json create mode 100644 src/components/node_modules/dom-helpers/insertAfter/package.json create mode 100644 src/components/node_modules/dom-helpers/isDocument/package.json create mode 100644 src/components/node_modules/dom-helpers/isInput/package.json create mode 100644 src/components/node_modules/dom-helpers/isTransform/package.json create mode 100644 src/components/node_modules/dom-helpers/isVisible/package.json create mode 100644 src/components/node_modules/dom-helpers/isWindow/package.json create mode 100644 src/components/node_modules/dom-helpers/listen/package.json create mode 100644 src/components/node_modules/dom-helpers/matches/package.json create mode 100644 src/components/node_modules/dom-helpers/nextUntil/package.json create mode 100644 src/components/node_modules/dom-helpers/offset/package.json create mode 100644 src/components/node_modules/dom-helpers/offsetParent/package.json create mode 100644 src/components/node_modules/dom-helpers/ownerDocument/package.json create mode 100644 src/components/node_modules/dom-helpers/ownerWindow/package.json create mode 100644 src/components/node_modules/dom-helpers/package.json create mode 100644 src/components/node_modules/dom-helpers/parents/package.json create mode 100644 src/components/node_modules/dom-helpers/position/package.json create mode 100644 src/components/node_modules/dom-helpers/prepend/package.json create mode 100644 src/components/node_modules/dom-helpers/querySelectorAll/package.json create mode 100644 src/components/node_modules/dom-helpers/remove/package.json create mode 100644 src/components/node_modules/dom-helpers/removeClass/package.json create mode 100644 src/components/node_modules/dom-helpers/removeEventListener/package.json create mode 100644 src/components/node_modules/dom-helpers/scrollLeft/package.json create mode 100644 src/components/node_modules/dom-helpers/scrollParent/package.json create mode 100644 src/components/node_modules/dom-helpers/scrollTo/package.json create mode 100644 src/components/node_modules/dom-helpers/scrollTop/package.json create mode 100644 src/components/node_modules/dom-helpers/scrollbarSize/package.json create mode 100644 src/components/node_modules/dom-helpers/siblings/package.json create mode 100644 src/components/node_modules/dom-helpers/text/package.json create mode 100644 src/components/node_modules/dom-helpers/toggleClass/package.json create mode 100644 src/components/node_modules/dom-helpers/transitionEnd/package.json create mode 100644 src/components/node_modules/dom-helpers/triggerEvent/package.json create mode 100644 src/components/node_modules/dom-helpers/width/package.json create mode 100644 src/components/node_modules/error-ex/LICENSE create mode 100644 src/components/node_modules/error-ex/README.md create mode 100644 src/components/node_modules/error-ex/index.js create mode 100644 src/components/node_modules/error-ex/package.json create mode 100644 src/components/node_modules/escape-string-regexp/index.d.ts create mode 100644 src/components/node_modules/escape-string-regexp/index.js create mode 100644 src/components/node_modules/escape-string-regexp/license create mode 100644 src/components/node_modules/escape-string-regexp/package.json create mode 100644 src/components/node_modules/escape-string-regexp/readme.md create mode 100644 src/components/node_modules/find-root/.npmignore create mode 100644 src/components/node_modules/find-root/.travis.yml create mode 100644 src/components/node_modules/find-root/LICENSE.md create mode 100644 src/components/node_modules/find-root/README.md create mode 100644 src/components/node_modules/find-root/index.js create mode 100644 src/components/node_modules/find-root/package.json create mode 100644 src/components/node_modules/find-root/test/test.js create mode 100644 src/components/node_modules/fs-extra/LICENSE create mode 100644 src/components/node_modules/fs-extra/README.md create mode 100644 src/components/node_modules/fs-extra/lib/copy/copy-sync.js create mode 100644 src/components/node_modules/fs-extra/lib/copy/copy.js create mode 100644 src/components/node_modules/fs-extra/lib/copy/index.js create mode 100644 src/components/node_modules/fs-extra/lib/empty/index.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/file.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/index.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/link.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/symlink-paths.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/symlink-type.js create mode 100644 src/components/node_modules/fs-extra/lib/ensure/symlink.js create mode 100644 src/components/node_modules/fs-extra/lib/fs/index.js create mode 100644 src/components/node_modules/fs-extra/lib/index.js create mode 100644 src/components/node_modules/fs-extra/lib/json/index.js create mode 100644 src/components/node_modules/fs-extra/lib/json/jsonfile.js create mode 100644 src/components/node_modules/fs-extra/lib/json/output-json-sync.js create mode 100644 src/components/node_modules/fs-extra/lib/json/output-json.js create mode 100644 src/components/node_modules/fs-extra/lib/mkdirs/index.js create mode 100644 src/components/node_modules/fs-extra/lib/mkdirs/make-dir.js create mode 100644 src/components/node_modules/fs-extra/lib/mkdirs/utils.js create mode 100644 src/components/node_modules/fs-extra/lib/move/index.js create mode 100644 src/components/node_modules/fs-extra/lib/move/move-sync.js create mode 100644 src/components/node_modules/fs-extra/lib/move/move.js create mode 100644 src/components/node_modules/fs-extra/lib/output-file/index.js create mode 100644 src/components/node_modules/fs-extra/lib/path-exists/index.js create mode 100644 src/components/node_modules/fs-extra/lib/remove/index.js create mode 100644 src/components/node_modules/fs-extra/lib/remove/rimraf.js create mode 100644 src/components/node_modules/fs-extra/lib/util/stat.js create mode 100644 src/components/node_modules/fs-extra/lib/util/utimes.js create mode 100644 src/components/node_modules/fs-extra/package.json create mode 100644 src/components/node_modules/function-bind/.editorconfig create mode 100644 src/components/node_modules/function-bind/.eslintrc create mode 100644 src/components/node_modules/function-bind/.jscs.json create mode 100644 src/components/node_modules/function-bind/.npmignore create mode 100644 src/components/node_modules/function-bind/.travis.yml create mode 100644 src/components/node_modules/function-bind/LICENSE create mode 100644 src/components/node_modules/function-bind/README.md create mode 100644 src/components/node_modules/function-bind/implementation.js create mode 100644 src/components/node_modules/function-bind/index.js create mode 100644 src/components/node_modules/function-bind/package.json create mode 100644 src/components/node_modules/function-bind/test/.eslintrc create mode 100644 src/components/node_modules/function-bind/test/index.js create mode 100644 src/components/node_modules/graceful-fs/LICENSE create mode 100644 src/components/node_modules/graceful-fs/README.md create mode 100644 src/components/node_modules/graceful-fs/clone.js create mode 100644 src/components/node_modules/graceful-fs/graceful-fs.js create mode 100644 src/components/node_modules/graceful-fs/legacy-streams.js create mode 100644 src/components/node_modules/graceful-fs/package.json create mode 100644 src/components/node_modules/graceful-fs/polyfills.js create mode 100644 src/components/node_modules/has-flag/index.js create mode 100644 src/components/node_modules/has-flag/license create mode 100644 src/components/node_modules/has-flag/package.json create mode 100644 src/components/node_modules/has-flag/readme.md create mode 100644 src/components/node_modules/has/LICENSE-MIT create mode 100644 src/components/node_modules/has/README.md create mode 100644 src/components/node_modules/has/package.json create mode 100644 src/components/node_modules/has/src/index.js create mode 100644 src/components/node_modules/has/test/index.js create mode 100644 src/components/node_modules/hoist-non-react-statics/CHANGELOG.md create mode 100644 src/components/node_modules/hoist-non-react-statics/LICENSE.md create mode 100644 src/components/node_modules/hoist-non-react-statics/README.md create mode 100644 src/components/node_modules/hoist-non-react-statics/package.json create mode 100644 src/components/node_modules/hoist-non-react-statics/src/index.js create mode 100644 src/components/node_modules/import-fresh/index.d.ts create mode 100644 src/components/node_modules/import-fresh/index.js create mode 100644 src/components/node_modules/import-fresh/license create mode 100644 src/components/node_modules/import-fresh/package.json create mode 100644 src/components/node_modules/import-fresh/readme.md create mode 100644 src/components/node_modules/is-arrayish/.editorconfig create mode 100644 src/components/node_modules/is-arrayish/.istanbul.yml create mode 100644 src/components/node_modules/is-arrayish/.npmignore create mode 100644 src/components/node_modules/is-arrayish/.travis.yml create mode 100644 src/components/node_modules/is-arrayish/LICENSE create mode 100644 src/components/node_modules/is-arrayish/README.md create mode 100644 src/components/node_modules/is-arrayish/index.js create mode 100644 src/components/node_modules/is-arrayish/package.json create mode 100644 src/components/node_modules/is-core-module/.eslintrc create mode 100644 src/components/node_modules/is-core-module/.nycrc create mode 100644 src/components/node_modules/is-core-module/CHANGELOG.md create mode 100644 src/components/node_modules/is-core-module/LICENSE create mode 100644 src/components/node_modules/is-core-module/README.md create mode 100644 src/components/node_modules/is-core-module/core.json create mode 100644 src/components/node_modules/is-core-module/index.js create mode 100644 src/components/node_modules/is-core-module/package.json create mode 100644 src/components/node_modules/is-core-module/test/index.js create mode 100644 src/components/node_modules/js-tokens/CHANGELOG.md create mode 100644 src/components/node_modules/js-tokens/LICENSE create mode 100644 src/components/node_modules/js-tokens/README.md create mode 100644 src/components/node_modules/js-tokens/index.js create mode 100644 src/components/node_modules/js-tokens/package.json create mode 100644 src/components/node_modules/json-parse-even-better-errors/CHANGELOG.md create mode 100644 src/components/node_modules/json-parse-even-better-errors/LICENSE.md create mode 100644 src/components/node_modules/json-parse-even-better-errors/README.md create mode 100644 src/components/node_modules/json-parse-even-better-errors/index.js create mode 100644 src/components/node_modules/json-parse-even-better-errors/package.json create mode 100644 src/components/node_modules/jsonfile/CHANGELOG.md create mode 100644 src/components/node_modules/jsonfile/LICENSE create mode 100644 src/components/node_modules/jsonfile/README.md create mode 100644 src/components/node_modules/jsonfile/index.js create mode 100644 src/components/node_modules/jsonfile/package.json create mode 100644 src/components/node_modules/jsonfile/utils.js create mode 100644 src/components/node_modules/jsurl2/README.md create mode 100644 src/components/node_modules/jsurl2/lib/jsurl.js create mode 100644 src/components/node_modules/jsurl2/lib/jsurl2.js create mode 100644 src/components/node_modules/jsurl2/package.json create mode 100644 src/components/node_modules/jsurl2/v1.js create mode 100644 src/components/node_modules/lines-and-columns/LICENSE create mode 100644 src/components/node_modules/lines-and-columns/README.md create mode 100644 src/components/node_modules/lines-and-columns/build/index.d.ts create mode 100644 src/components/node_modules/lines-and-columns/build/index.js create mode 100644 src/components/node_modules/lines-and-columns/package.json create mode 100644 src/components/node_modules/loose-envify/LICENSE create mode 100644 src/components/node_modules/loose-envify/README.md create mode 100755 src/components/node_modules/loose-envify/cli.js create mode 100644 src/components/node_modules/loose-envify/custom.js create mode 100644 src/components/node_modules/loose-envify/index.js create mode 100644 src/components/node_modules/loose-envify/loose-envify.js create mode 100644 src/components/node_modules/loose-envify/package.json create mode 100644 src/components/node_modules/loose-envify/replace.js create mode 100644 src/components/node_modules/lz-string/LICENSE.txt create mode 100644 src/components/node_modules/lz-string/README.md create mode 100755 src/components/node_modules/lz-string/bin/bin.js create mode 100644 src/components/node_modules/lz-string/bower.json create mode 100644 src/components/node_modules/lz-string/libs/base64-string.js create mode 100644 src/components/node_modules/lz-string/libs/lz-string.js create mode 100644 src/components/node_modules/lz-string/libs/lz-string.min.js create mode 100644 src/components/node_modules/lz-string/package.json create mode 100644 src/components/node_modules/lz-string/reference/lz-string-1.0.2.js create mode 100644 src/components/node_modules/lz-string/tests/SpecRunner.html create mode 100644 src/components/node_modules/lz-string/tests/lib/jasmine-1.3.1/MIT.LICENSE create mode 100644 src/components/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine-html.js create mode 100644 src/components/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine.css create mode 100644 src/components/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine.js create mode 100644 src/components/node_modules/lz-string/tests/lz-string-spec.js create mode 100644 src/components/node_modules/lz-string/typings/lz-string.d.ts create mode 100644 src/components/node_modules/memoize-one/LICENSE create mode 100644 src/components/node_modules/memoize-one/README.md create mode 100644 src/components/node_modules/memoize-one/package.json create mode 100644 src/components/node_modules/memoize-one/src/are-inputs-equal.ts create mode 100644 src/components/node_modules/memoize-one/src/memoize-one.js.flow create mode 100644 src/components/node_modules/memoize-one/src/memoize-one.ts create mode 100644 src/components/node_modules/object-assign/index.js create mode 100644 src/components/node_modules/object-assign/license create mode 100644 src/components/node_modules/object-assign/package.json create mode 100644 src/components/node_modules/object-assign/readme.md create mode 100644 src/components/node_modules/parent-module/index.js create mode 100644 src/components/node_modules/parent-module/license create mode 100644 src/components/node_modules/parent-module/package.json create mode 100644 src/components/node_modules/parent-module/readme.md create mode 100644 src/components/node_modules/parse-json/index.js create mode 100644 src/components/node_modules/parse-json/license create mode 100644 src/components/node_modules/parse-json/package.json create mode 100644 src/components/node_modules/parse-json/readme.md create mode 100644 src/components/node_modules/path-parse/LICENSE create mode 100644 src/components/node_modules/path-parse/README.md create mode 100644 src/components/node_modules/path-parse/index.js create mode 100644 src/components/node_modules/path-parse/package.json create mode 100644 src/components/node_modules/path-type/index.d.ts create mode 100644 src/components/node_modules/path-type/index.js create mode 100644 src/components/node_modules/path-type/license create mode 100644 src/components/node_modules/path-type/package.json create mode 100644 src/components/node_modules/path-type/readme.md create mode 100644 src/components/node_modules/prop-types/LICENSE create mode 100644 src/components/node_modules/prop-types/README.md create mode 100644 src/components/node_modules/prop-types/checkPropTypes.js create mode 100644 src/components/node_modules/prop-types/factory.js create mode 100644 src/components/node_modules/prop-types/factoryWithThrowingShims.js create mode 100644 src/components/node_modules/prop-types/factoryWithTypeCheckers.js create mode 100644 src/components/node_modules/prop-types/index.js create mode 100644 src/components/node_modules/prop-types/lib/ReactPropTypesSecret.js create mode 100644 src/components/node_modules/prop-types/lib/has.js create mode 120000 src/components/node_modules/prop-types/node_modules/.bin/loose-envify create mode 100644 src/components/node_modules/prop-types/package.json create mode 100644 src/components/node_modules/prop-types/prop-types.js create mode 100644 src/components/node_modules/prop-types/prop-types.min.js create mode 100644 src/components/node_modules/react-is/LICENSE create mode 100644 src/components/node_modules/react-is/README.md create mode 100644 src/components/node_modules/react-is/build-info.json create mode 100644 src/components/node_modules/react-is/cjs/react-is.development.js create mode 100644 src/components/node_modules/react-is/cjs/react-is.production.min.js create mode 100644 src/components/node_modules/react-is/index.js create mode 100644 src/components/node_modules/react-is/package.json create mode 100644 src/components/node_modules/react-is/umd/react-is.development.js create mode 100644 src/components/node_modules/react-is/umd/react-is.production.min.js create mode 100644 src/components/node_modules/react-select/CHANGELOG.md create mode 100644 src/components/node_modules/react-select/README.md create mode 100644 src/components/node_modules/react-select/animated/package.json create mode 100644 src/components/node_modules/react-select/async-creatable/package.json create mode 100644 src/components/node_modules/react-select/async/package.json create mode 100644 src/components/node_modules/react-select/base/package.json create mode 100644 src/components/node_modules/react-select/creatable/package.json create mode 100644 src/components/node_modules/react-select/package.json create mode 100644 src/components/node_modules/react-transition-group/CSSTransition/package.json create mode 100644 src/components/node_modules/react-transition-group/LICENSE create mode 100644 src/components/node_modules/react-transition-group/README.md create mode 100644 src/components/node_modules/react-transition-group/ReplaceTransition/package.json create mode 100644 src/components/node_modules/react-transition-group/SwitchTransition/package.json create mode 100644 src/components/node_modules/react-transition-group/Transition/package.json create mode 100644 src/components/node_modules/react-transition-group/TransitionGroup/package.json create mode 100644 src/components/node_modules/react-transition-group/TransitionGroupContext/package.json create mode 100644 src/components/node_modules/react-transition-group/cjs/CSSTransition.js create mode 100644 src/components/node_modules/react-transition-group/cjs/ReplaceTransition.js create mode 100644 src/components/node_modules/react-transition-group/cjs/SwitchTransition.js create mode 100644 src/components/node_modules/react-transition-group/cjs/Transition.js create mode 100644 src/components/node_modules/react-transition-group/cjs/TransitionGroup.js create mode 100644 src/components/node_modules/react-transition-group/cjs/TransitionGroupContext.js create mode 100644 src/components/node_modules/react-transition-group/cjs/config.js create mode 100644 src/components/node_modules/react-transition-group/cjs/index.js create mode 100644 src/components/node_modules/react-transition-group/cjs/utils/ChildMapping.js create mode 100644 src/components/node_modules/react-transition-group/cjs/utils/PropTypes.js create mode 100644 src/components/node_modules/react-transition-group/cjs/utils/SimpleSet.js create mode 100644 src/components/node_modules/react-transition-group/cjs/utils/reflow.js create mode 100644 src/components/node_modules/react-transition-group/config/package.json create mode 100644 src/components/node_modules/react-transition-group/esm/CSSTransition.js create mode 100644 src/components/node_modules/react-transition-group/esm/ReplaceTransition.js create mode 100644 src/components/node_modules/react-transition-group/esm/SwitchTransition.js create mode 100644 src/components/node_modules/react-transition-group/esm/Transition.js create mode 100644 src/components/node_modules/react-transition-group/esm/TransitionGroup.js create mode 100644 src/components/node_modules/react-transition-group/esm/TransitionGroupContext.js create mode 100644 src/components/node_modules/react-transition-group/esm/config.js create mode 100644 src/components/node_modules/react-transition-group/esm/index.js create mode 100644 src/components/node_modules/react-transition-group/esm/utils/ChildMapping.js create mode 100644 src/components/node_modules/react-transition-group/esm/utils/PropTypes.js create mode 100644 src/components/node_modules/react-transition-group/esm/utils/SimpleSet.js create mode 100644 src/components/node_modules/react-transition-group/esm/utils/reflow.js create mode 120000 src/components/node_modules/react-transition-group/node_modules/.bin/loose-envify create mode 100644 src/components/node_modules/react-transition-group/package.json create mode 100644 src/components/node_modules/regenerator-runtime/LICENSE create mode 100644 src/components/node_modules/regenerator-runtime/README.md create mode 100644 src/components/node_modules/regenerator-runtime/package.json create mode 100644 src/components/node_modules/regenerator-runtime/path.js create mode 100644 src/components/node_modules/regenerator-runtime/runtime.js create mode 100644 src/components/node_modules/resolve-from/index.js create mode 100644 src/components/node_modules/resolve-from/license create mode 100644 src/components/node_modules/resolve-from/package.json create mode 100644 src/components/node_modules/resolve-from/readme.md create mode 100644 src/components/node_modules/resolve/.editorconfig create mode 100644 src/components/node_modules/resolve/.eslintrc create mode 100644 src/components/node_modules/resolve/.github/FUNDING.yml create mode 100644 src/components/node_modules/resolve/LICENSE create mode 100644 src/components/node_modules/resolve/SECURITY.md create mode 100644 src/components/node_modules/resolve/async.js create mode 100755 src/components/node_modules/resolve/bin/resolve create mode 100644 src/components/node_modules/resolve/example/async.js create mode 100644 src/components/node_modules/resolve/example/sync.js create mode 100644 src/components/node_modules/resolve/index.js create mode 100644 src/components/node_modules/resolve/lib/async.js create mode 100644 src/components/node_modules/resolve/lib/caller.js create mode 100644 src/components/node_modules/resolve/lib/core.js create mode 100644 src/components/node_modules/resolve/lib/core.json create mode 100644 src/components/node_modules/resolve/lib/homedir.js create mode 100644 src/components/node_modules/resolve/lib/is-core.js create mode 100644 src/components/node_modules/resolve/lib/node-modules-paths.js create mode 100644 src/components/node_modules/resolve/lib/normalize-options.js create mode 100644 src/components/node_modules/resolve/lib/sync.js create mode 100644 src/components/node_modules/resolve/package.json create mode 100644 src/components/node_modules/resolve/readme.markdown create mode 100644 src/components/node_modules/resolve/sync.js create mode 100644 src/components/node_modules/resolve/test/core.js create mode 100644 src/components/node_modules/resolve/test/dotdot.js create mode 100644 src/components/node_modules/resolve/test/dotdot/abc/index.js create mode 100644 src/components/node_modules/resolve/test/dotdot/index.js create mode 100644 src/components/node_modules/resolve/test/faulty_basedir.js create mode 100644 src/components/node_modules/resolve/test/filter.js create mode 100644 src/components/node_modules/resolve/test/filter_sync.js create mode 100644 src/components/node_modules/resolve/test/home_paths.js create mode 100644 src/components/node_modules/resolve/test/home_paths_sync.js create mode 100644 src/components/node_modules/resolve/test/mock.js create mode 100644 src/components/node_modules/resolve/test/mock_sync.js create mode 100644 src/components/node_modules/resolve/test/module_dir.js create mode 100644 src/components/node_modules/resolve/test/module_dir/xmodules/aaa/index.js create mode 100644 src/components/node_modules/resolve/test/module_dir/ymodules/aaa/index.js create mode 100644 src/components/node_modules/resolve/test/module_dir/zmodules/bbb/main.js create mode 100644 src/components/node_modules/resolve/test/module_dir/zmodules/bbb/package.json create mode 100644 src/components/node_modules/resolve/test/node-modules-paths.js create mode 100644 src/components/node_modules/resolve/test/node_path.js create mode 100644 src/components/node_modules/resolve/test/node_path/x/aaa/index.js create mode 100644 src/components/node_modules/resolve/test/node_path/x/ccc/index.js create mode 100644 src/components/node_modules/resolve/test/node_path/y/bbb/index.js create mode 100644 src/components/node_modules/resolve/test/node_path/y/ccc/index.js create mode 100644 src/components/node_modules/resolve/test/nonstring.js create mode 100644 src/components/node_modules/resolve/test/pathfilter.js create mode 100644 src/components/node_modules/resolve/test/pathfilter/deep_ref/main.js create mode 100644 src/components/node_modules/resolve/test/precedence.js create mode 100644 src/components/node_modules/resolve/test/precedence/aaa.js create mode 100644 src/components/node_modules/resolve/test/precedence/aaa/index.js create mode 100644 src/components/node_modules/resolve/test/precedence/aaa/main.js create mode 100644 src/components/node_modules/resolve/test/precedence/bbb.js create mode 100644 src/components/node_modules/resolve/test/precedence/bbb/main.js create mode 100644 src/components/node_modules/resolve/test/resolver.js create mode 100644 src/components/node_modules/resolve/test/resolver/baz/doom.js create mode 100644 src/components/node_modules/resolve/test/resolver/baz/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/baz/quux.js create mode 100644 src/components/node_modules/resolve/test/resolver/browser_field/a.js create mode 100644 src/components/node_modules/resolve/test/resolver/browser_field/b.js create mode 100644 src/components/node_modules/resolve/test/resolver/browser_field/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/cup.coffee create mode 100644 src/components/node_modules/resolve/test/resolver/dot_main/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/dot_main/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/dot_slash_main/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/dot_slash_main/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/false_main/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/false_main/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/foo.js create mode 100644 src/components/node_modules/resolve/test/resolver/incorrect_main/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/incorrect_main/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/invalid_main/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/malformed_package_json/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/malformed_package_json/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/mug.coffee create mode 100644 src/components/node_modules/resolve/test/resolver/mug.js create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/lerna.json create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js create mode 100644 src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js create mode 100644 src/components/node_modules/resolve/test/resolver/other_path/lib/other-lib.js create mode 100644 src/components/node_modules/resolve/test/resolver/other_path/root.js create mode 100644 src/components/node_modules/resolve/test/resolver/quux/foo/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/same_names/foo.js create mode 100644 src/components/node_modules/resolve/test/resolver/same_names/foo/index.js create mode 100644 src/components/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js create mode 100644 src/components/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep create mode 100644 src/components/node_modules/resolve/test/resolver/symlinked/package/bar.js create mode 100644 src/components/node_modules/resolve/test/resolver/symlinked/package/package.json create mode 100644 src/components/node_modules/resolve/test/resolver/without_basedir/main.js create mode 100644 src/components/node_modules/resolve/test/resolver_sync.js create mode 100644 src/components/node_modules/resolve/test/shadowed_core.js create mode 100644 src/components/node_modules/resolve/test/shadowed_core/node_modules/util/index.js create mode 100644 src/components/node_modules/resolve/test/subdirs.js create mode 100644 src/components/node_modules/resolve/test/symlinks.js create mode 100644 src/components/node_modules/safe-buffer/LICENSE create mode 100644 src/components/node_modules/safe-buffer/README.md create mode 100644 src/components/node_modules/safe-buffer/index.d.ts create mode 100644 src/components/node_modules/safe-buffer/index.js create mode 100644 src/components/node_modules/safe-buffer/package.json create mode 100644 src/components/node_modules/source-map/CHANGELOG.md create mode 100644 src/components/node_modules/source-map/LICENSE create mode 100644 src/components/node_modules/source-map/README.md create mode 100644 src/components/node_modules/source-map/lib/array-set.js create mode 100644 src/components/node_modules/source-map/lib/base64-vlq.js create mode 100644 src/components/node_modules/source-map/lib/base64.js create mode 100644 src/components/node_modules/source-map/lib/binary-search.js create mode 100644 src/components/node_modules/source-map/lib/mapping-list.js create mode 100644 src/components/node_modules/source-map/lib/quick-sort.js create mode 100644 src/components/node_modules/source-map/lib/source-map-consumer.js create mode 100644 src/components/node_modules/source-map/lib/source-map-generator.js create mode 100644 src/components/node_modules/source-map/lib/source-node.js create mode 100644 src/components/node_modules/source-map/lib/util.js create mode 100644 src/components/node_modules/source-map/package.json create mode 100644 src/components/node_modules/source-map/source-map.js create mode 100644 src/components/node_modules/stylis/LICENSE create mode 100644 src/components/node_modules/stylis/README.md create mode 100644 src/components/node_modules/stylis/index.js create mode 100644 src/components/node_modules/stylis/package.json create mode 100644 src/components/node_modules/stylis/src/Enum.js create mode 100644 src/components/node_modules/stylis/src/Middleware.js create mode 100644 src/components/node_modules/stylis/src/Parser.js create mode 100644 src/components/node_modules/stylis/src/Prefixer.js create mode 100644 src/components/node_modules/stylis/src/Serializer.js create mode 100644 src/components/node_modules/stylis/src/Tokenizer.js create mode 100644 src/components/node_modules/stylis/src/Utility.js create mode 100644 src/components/node_modules/supports-color/browser.js create mode 100644 src/components/node_modules/supports-color/index.js create mode 100644 src/components/node_modules/supports-color/license create mode 100644 src/components/node_modules/supports-color/package.json create mode 100644 src/components/node_modules/supports-color/readme.md create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/.eslintrc create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/.nycrc create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/LICENSE create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/README.md create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/browser.js create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/index.js create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/package.json create mode 100644 src/components/node_modules/supports-preserve-symlinks-flag/test/index.js create mode 100644 src/components/node_modules/to-fast-properties/index.js create mode 100644 src/components/node_modules/to-fast-properties/license create mode 100644 src/components/node_modules/to-fast-properties/package.json create mode 100644 src/components/node_modules/to-fast-properties/readme.md create mode 100644 src/components/node_modules/universalify/LICENSE create mode 100644 src/components/node_modules/universalify/README.md create mode 100644 src/components/node_modules/universalify/index.js create mode 100644 src/components/node_modules/universalify/package.json create mode 100644 src/components/node_modules/yaml/LICENSE create mode 100644 src/components/node_modules/yaml/README.md create mode 100644 src/components/node_modules/yaml/browser/index.js create mode 100644 src/components/node_modules/yaml/browser/map.js create mode 100644 src/components/node_modules/yaml/browser/pair.js create mode 100644 src/components/node_modules/yaml/browser/parse-cst.js create mode 100644 src/components/node_modules/yaml/browser/scalar.js create mode 100644 src/components/node_modules/yaml/browser/schema.js create mode 100644 src/components/node_modules/yaml/browser/seq.js create mode 100644 src/components/node_modules/yaml/browser/types.js create mode 100644 src/components/node_modules/yaml/browser/types/binary.js create mode 100644 src/components/node_modules/yaml/browser/types/omap.js create mode 100644 src/components/node_modules/yaml/browser/types/pairs.js create mode 100644 src/components/node_modules/yaml/browser/types/set.js create mode 100644 src/components/node_modules/yaml/browser/types/timestamp.js create mode 100644 src/components/node_modules/yaml/browser/util.js create mode 100644 src/components/node_modules/yaml/index.d.ts create mode 100644 src/components/node_modules/yaml/index.js create mode 100644 src/components/node_modules/yaml/map.js create mode 100644 src/components/node_modules/yaml/package.json create mode 100644 src/components/node_modules/yaml/pair.js create mode 100644 src/components/node_modules/yaml/parse-cst.d.ts create mode 100644 src/components/node_modules/yaml/parse-cst.js create mode 100644 src/components/node_modules/yaml/scalar.js create mode 100644 src/components/node_modules/yaml/schema.js create mode 100644 src/components/node_modules/yaml/seq.js create mode 100644 src/components/node_modules/yaml/types.d.ts create mode 100644 src/components/node_modules/yaml/types.js create mode 100644 src/components/node_modules/yaml/types.mjs create mode 100644 src/components/node_modules/yaml/types/binary.js create mode 100644 src/components/node_modules/yaml/types/omap.js create mode 100644 src/components/node_modules/yaml/types/pairs.js create mode 100644 src/components/node_modules/yaml/types/set.js create mode 100644 src/components/node_modules/yaml/types/timestamp.js create mode 100644 src/components/node_modules/yaml/util.d.ts create mode 100644 src/components/node_modules/yaml/util.js create mode 100644 src/components/node_modules/yaml/util.mjs create mode 100644 src/components/package.json create mode 100644 src/components/post-build.cjs rename src/components/{ => src}/ButtonSelect.tsx (100%) rename src/components/{ => src}/CompiledPTextDisplay.tsx (89%) rename src/components/{ => src}/ComplementPicker.tsx (98%) rename src/components/{ => src}/DisplayModeSelect.tsx (100%) create mode 100644 src/components/src/EntrySelect.tsx rename src/components/{ => src}/Examples.tsx (96%) rename src/components/{ => src}/Hider.tsx (97%) create mode 100644 src/components/src/HumanReadableInflectionPattern.tsx rename src/components/{ => src}/InflectionsTable.tsx (97%) rename src/components/{ => src}/InlinePs.tsx (92%) rename src/components/{ => src}/Keyframes.tsx (100%) rename src/components/{ => src}/Pashto.tsx (85%) rename src/components/{ => src}/PersInfsPicker.tsx (52%) rename src/components/{ => src}/PersonSelection.tsx (96%) rename src/components/{ => src}/Phonetics.tsx (86%) rename src/components/{ => src}/RenderedBlocksDisplay.tsx (96%) rename src/components/{ => src}/SingleItemDisplay.tsx (91%) rename src/components/{ => src}/TableCell.tsx (97%) rename src/components/{ => src}/VerbFormDisplay.tsx (97%) rename src/components/{ => src}/VerbTable.tsx (94%) rename src/components/{ => src}/ap-picker/APPicker.tsx (98%) rename src/components/{ => src}/ap-picker/AdverbPicker.tsx (80%) rename src/components/{ => src}/blocks/Block.tsx (98%) rename src/components/{ => src}/blocks/KidDisplay.tsx (78%) rename src/components/{ => src}/ep-explorer/EPDisplay.tsx (91%) rename src/components/{ => src}/ep-explorer/EPExplorer.tsx (91%) rename src/components/{ => src}/ep-explorer/EPPicker.tsx (91%) rename src/components/{ => src}/ep-explorer/EqChartsDisplay.tsx (69%) create mode 100644 src/components/src/ep-explorer/EquativePicker.tsx rename src/components/{ => src}/ep-explorer/eq-comp-picker/LocativeAdverbPicker.tsx (79%) rename src/{lib => components/src}/gender-colors.ts (100%) rename src/{lib => components/src}/jsx-map.test.tsx (100%) rename src/{lib => components/src}/jsx-map.tsx (98%) rename src/components/{ => src}/np-picker/AdjectiveManager.tsx (98%) rename src/components/{ => src}/np-picker/AdjectivePicker.tsx (90%) rename src/components/{ => src}/np-picker/NPNounPicker.tsx (97%) rename src/components/{ => src}/np-picker/NPParticiplePicker.tsx (80%) rename src/components/{ => src}/np-picker/NPPicker.tsx (98%) rename src/components/{ => src}/np-picker/NPPronounPicker.tsx (97%) rename src/components/{ => src}/np-picker/SandwichPicker.tsx (92%) rename src/components/{ => src}/np-picker/picker-tools.tsx (71%) rename src/{lib => components/src}/play-audio.ts (100%) rename src/{lib => components/src}/useStickyState.ts (100%) rename src/components/{ => src}/verb-info/VerbInfo.tsx (95%) rename src/components/{ => src}/verb-info/VerbInfoItemDisplay.tsx (95%) rename src/components/{ => src}/verb-info/VerbTypeInfo.tsx (99%) rename src/components/{ => src}/verb-info/dynamic-compound-intransitive.svg (100%) rename src/components/{ => src}/verb-info/dynamic-compound-transitive.svg (100%) rename src/components/{ => src}/verb-info/faded-tree.svg (100%) rename src/components/{ => src}/verb-info/generative-stative-compound-intransitive.svg (100%) rename src/components/{ => src}/verb-info/generative-stative-compound-transitive.svg (100%) rename src/components/{ => src}/verb-info/grammatically-transitive-past.svg (100%) rename src/components/{ => src}/verb-info/grammatically-transitive-present.svg (100%) rename src/components/{ => src}/verb-info/intransitive.svg (100%) rename src/components/{ => src}/verb-info/stative-compound-intransitive.svg (100%) rename src/components/{ => src}/verb-info/stative-compound-transitive.svg (100%) rename src/components/{ => src}/verb-info/transitive-past.svg (100%) rename src/components/{ => src}/verb-info/transitive-present.svg (100%) rename src/components/{ => src}/vp-explorer/AbbreviationFormSelector.tsx (97%) rename src/components/{ => src}/vp-explorer/CompoundDisplay.tsx (96%) rename src/components/{ => src}/vp-explorer/TensePicker.tsx (98%) rename src/components/{ => src}/vp-explorer/VPChartDisplay.tsx (84%) rename src/components/{ => src}/vp-explorer/VPDisplay.tsx (88%) rename src/components/{ => src}/vp-explorer/VPExplorer.tsx (94%) rename src/components/{ => src}/vp-explorer/VPExplorerExplanationModal.tsx (100%) rename src/components/{ => src}/vp-explorer/VPExplorerQuiz.tsx (94%) rename src/components/{ => src}/vp-explorer/VPPicker.tsx (95%) rename src/components/{ => src}/vp-explorer/VerbPicker.tsx (95%) rename src/components/{ => src}/vp-explorer/energy-drink.jpg (100%) rename src/components/{ => src}/vp-explorer/vp-structure-source.svg (100%) rename src/components/{ => src}/vp-explorer/vp-structure.svg (100%) create mode 100644 src/components/yarn.lock create mode 100644 src/lib/lib-tsconfig.json rename src/{functions.ts => lib/library.ts} (70%) create mode 100644 src/lib/node_modules/.yarn-integrity create mode 100644 src/lib/node_modules/rambda/CHANGELOG.md create mode 100644 src/lib/node_modules/rambda/LICENSE create mode 100644 src/lib/node_modules/rambda/README.md create mode 100644 src/lib/node_modules/rambda/immutable.d.ts create mode 100644 src/lib/node_modules/rambda/immutable.js create mode 100644 src/lib/node_modules/rambda/index.d.ts create mode 100644 src/lib/node_modules/rambda/package.json create mode 100644 src/lib/node_modules/rambda/src/F.js create mode 100644 src/lib/node_modules/rambda/src/T.js create mode 100644 src/lib/node_modules/rambda/src/_internals/baseSlice.js create mode 100644 src/lib/node_modules/rambda/src/_internals/cloneList.js create mode 100644 src/lib/node_modules/rambda/src/_internals/constants.js create mode 100644 src/lib/node_modules/rambda/src/_internals/createPath.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isArray.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isFalsy.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isInteger.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isIterable.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isObject.js create mode 100644 src/lib/node_modules/rambda/src/_internals/isTruthy.js create mode 100644 src/lib/node_modules/rambda/src/_internals/keys.js create mode 100644 src/lib/node_modules/rambda/src/_internals/objectIs.js create mode 100644 src/lib/node_modules/rambda/src/_internals/set.js create mode 100644 src/lib/node_modules/rambda/src/add.js create mode 100644 src/lib/node_modules/rambda/src/adjust.js create mode 100644 src/lib/node_modules/rambda/src/all.js create mode 100644 src/lib/node_modules/rambda/src/allPass.js create mode 100644 src/lib/node_modules/rambda/src/always.js create mode 100644 src/lib/node_modules/rambda/src/and.js create mode 100644 src/lib/node_modules/rambda/src/any.js create mode 100644 src/lib/node_modules/rambda/src/anyPass.js create mode 100644 src/lib/node_modules/rambda/src/append.js create mode 100644 src/lib/node_modules/rambda/src/apply.js create mode 100644 src/lib/node_modules/rambda/src/applySpec.js create mode 100644 src/lib/node_modules/rambda/src/assoc.js create mode 100644 src/lib/node_modules/rambda/src/assocPath.js create mode 100644 src/lib/node_modules/rambda/src/bind.js create mode 100644 src/lib/node_modules/rambda/src/both.js create mode 100644 src/lib/node_modules/rambda/src/chain.js create mode 100644 src/lib/node_modules/rambda/src/clamp.js create mode 100644 src/lib/node_modules/rambda/src/clone.js create mode 100644 src/lib/node_modules/rambda/src/complement.js create mode 100644 src/lib/node_modules/rambda/src/compose.js create mode 100644 src/lib/node_modules/rambda/src/concat.js create mode 100644 src/lib/node_modules/rambda/src/cond.js create mode 100644 src/lib/node_modules/rambda/src/converge.js create mode 100644 src/lib/node_modules/rambda/src/count.js create mode 100644 src/lib/node_modules/rambda/src/countBy.js create mode 100644 src/lib/node_modules/rambda/src/curry.js create mode 100644 src/lib/node_modules/rambda/src/curryN.js create mode 100644 src/lib/node_modules/rambda/src/dec.js create mode 100644 src/lib/node_modules/rambda/src/defaultTo.js create mode 100644 src/lib/node_modules/rambda/src/difference.js create mode 100644 src/lib/node_modules/rambda/src/dissoc.js create mode 100644 src/lib/node_modules/rambda/src/divide.js create mode 100644 src/lib/node_modules/rambda/src/drop.js create mode 100644 src/lib/node_modules/rambda/src/dropLast.js create mode 100644 src/lib/node_modules/rambda/src/dropLastWhile.js create mode 100644 src/lib/node_modules/rambda/src/dropRepeats.js create mode 100644 src/lib/node_modules/rambda/src/dropRepeatsWith.js create mode 100644 src/lib/node_modules/rambda/src/dropWhile.js create mode 100644 src/lib/node_modules/rambda/src/either.js create mode 100644 src/lib/node_modules/rambda/src/endsWith.js create mode 100644 src/lib/node_modules/rambda/src/eqProps.js create mode 100644 src/lib/node_modules/rambda/src/equals.js create mode 100644 src/lib/node_modules/rambda/src/evolve.js create mode 100644 src/lib/node_modules/rambda/src/filter.js create mode 100644 src/lib/node_modules/rambda/src/find.js create mode 100644 src/lib/node_modules/rambda/src/findIndex.js create mode 100644 src/lib/node_modules/rambda/src/findLast.js create mode 100644 src/lib/node_modules/rambda/src/findLastIndex.js create mode 100644 src/lib/node_modules/rambda/src/flatten.js create mode 100644 src/lib/node_modules/rambda/src/flip.js create mode 100644 src/lib/node_modules/rambda/src/forEach.js create mode 100644 src/lib/node_modules/rambda/src/fromPairs.js create mode 100644 src/lib/node_modules/rambda/src/groupBy.js create mode 100644 src/lib/node_modules/rambda/src/groupWith.js create mode 100644 src/lib/node_modules/rambda/src/has.js create mode 100644 src/lib/node_modules/rambda/src/hasPath.js create mode 100644 src/lib/node_modules/rambda/src/head.js create mode 100644 src/lib/node_modules/rambda/src/identical.js create mode 100644 src/lib/node_modules/rambda/src/identity.js create mode 100644 src/lib/node_modules/rambda/src/ifElse.js create mode 100644 src/lib/node_modules/rambda/src/inc.js create mode 100644 src/lib/node_modules/rambda/src/includes.js create mode 100644 src/lib/node_modules/rambda/src/indexBy.js create mode 100644 src/lib/node_modules/rambda/src/indexOf.js create mode 100644 src/lib/node_modules/rambda/src/init.js create mode 100644 src/lib/node_modules/rambda/src/intersection.js create mode 100644 src/lib/node_modules/rambda/src/intersperse.js create mode 100644 src/lib/node_modules/rambda/src/is.js create mode 100644 src/lib/node_modules/rambda/src/isEmpty.js create mode 100644 src/lib/node_modules/rambda/src/isNil.js create mode 100644 src/lib/node_modules/rambda/src/isPromise.js create mode 100644 src/lib/node_modules/rambda/src/join.js create mode 100644 src/lib/node_modules/rambda/src/juxt.js create mode 100644 src/lib/node_modules/rambda/src/keys.js create mode 100644 src/lib/node_modules/rambda/src/last.js create mode 100644 src/lib/node_modules/rambda/src/lastIndexOf.js create mode 100644 src/lib/node_modules/rambda/src/length.js create mode 100644 src/lib/node_modules/rambda/src/lens.js create mode 100644 src/lib/node_modules/rambda/src/lensIndex.js create mode 100644 src/lib/node_modules/rambda/src/lensPath.js create mode 100644 src/lib/node_modules/rambda/src/lensProp.js create mode 100644 src/lib/node_modules/rambda/src/map.js create mode 100644 src/lib/node_modules/rambda/src/match.js create mode 100644 src/lib/node_modules/rambda/src/mathMod.js create mode 100644 src/lib/node_modules/rambda/src/max.js create mode 100644 src/lib/node_modules/rambda/src/maxBy.js create mode 100644 src/lib/node_modules/rambda/src/maybe.js create mode 100644 src/lib/node_modules/rambda/src/mean.js create mode 100644 src/lib/node_modules/rambda/src/median.js create mode 100644 src/lib/node_modules/rambda/src/merge.js create mode 100644 src/lib/node_modules/rambda/src/mergeAll.js create mode 100644 src/lib/node_modules/rambda/src/mergeDeepRight.js create mode 100644 src/lib/node_modules/rambda/src/mergeLeft.js create mode 100644 src/lib/node_modules/rambda/src/mergeRight.js create mode 100644 src/lib/node_modules/rambda/src/mergeWith.js create mode 100644 src/lib/node_modules/rambda/src/min.js create mode 100644 src/lib/node_modules/rambda/src/minBy.js create mode 100644 src/lib/node_modules/rambda/src/modify.js create mode 100644 src/lib/node_modules/rambda/src/modifyPath.js create mode 100644 src/lib/node_modules/rambda/src/modulo.js create mode 100644 src/lib/node_modules/rambda/src/move.js create mode 100644 src/lib/node_modules/rambda/src/multiply.js create mode 100644 src/lib/node_modules/rambda/src/negate.js create mode 100644 src/lib/node_modules/rambda/src/none.js create mode 100644 src/lib/node_modules/rambda/src/not.js create mode 100644 src/lib/node_modules/rambda/src/nth.js create mode 100644 src/lib/node_modules/rambda/src/objOf.js create mode 100644 src/lib/node_modules/rambda/src/of.js create mode 100644 src/lib/node_modules/rambda/src/omit.js create mode 100644 src/lib/node_modules/rambda/src/on.js create mode 100644 src/lib/node_modules/rambda/src/once.js create mode 100644 src/lib/node_modules/rambda/src/or.js create mode 100644 src/lib/node_modules/rambda/src/over.js create mode 100644 src/lib/node_modules/rambda/src/partial.js create mode 100644 src/lib/node_modules/rambda/src/partialObject.js create mode 100644 src/lib/node_modules/rambda/src/partition.js create mode 100644 src/lib/node_modules/rambda/src/path.js create mode 100644 src/lib/node_modules/rambda/src/pathEq.js create mode 100644 src/lib/node_modules/rambda/src/pathOr.js create mode 100644 src/lib/node_modules/rambda/src/paths.js create mode 100644 src/lib/node_modules/rambda/src/pick.js create mode 100644 src/lib/node_modules/rambda/src/pickAll.js create mode 100644 src/lib/node_modules/rambda/src/pipe.js create mode 100644 src/lib/node_modules/rambda/src/pluck.js create mode 100644 src/lib/node_modules/rambda/src/prepend.js create mode 100644 src/lib/node_modules/rambda/src/product.js create mode 100644 src/lib/node_modules/rambda/src/prop.js create mode 100644 src/lib/node_modules/rambda/src/propEq.js create mode 100644 src/lib/node_modules/rambda/src/propIs.js create mode 100644 src/lib/node_modules/rambda/src/propOr.js create mode 100644 src/lib/node_modules/rambda/src/propSatisfies.js create mode 100644 src/lib/node_modules/rambda/src/props.js create mode 100644 src/lib/node_modules/rambda/src/range.js create mode 100644 src/lib/node_modules/rambda/src/reduce.js create mode 100644 src/lib/node_modules/rambda/src/reject.js create mode 100644 src/lib/node_modules/rambda/src/repeat.js create mode 100644 src/lib/node_modules/rambda/src/replace.js create mode 100644 src/lib/node_modules/rambda/src/reverse.js create mode 100644 src/lib/node_modules/rambda/src/set.js create mode 100644 src/lib/node_modules/rambda/src/slice.js create mode 100644 src/lib/node_modules/rambda/src/sort.js create mode 100644 src/lib/node_modules/rambda/src/sortBy.js create mode 100644 src/lib/node_modules/rambda/src/split.js create mode 100644 src/lib/node_modules/rambda/src/splitAt.js create mode 100644 src/lib/node_modules/rambda/src/splitEvery.js create mode 100644 src/lib/node_modules/rambda/src/splitWhen.js create mode 100644 src/lib/node_modules/rambda/src/startsWith.js create mode 100644 src/lib/node_modules/rambda/src/subtract.js create mode 100644 src/lib/node_modules/rambda/src/sum.js create mode 100644 src/lib/node_modules/rambda/src/symmetricDifference.js create mode 100644 src/lib/node_modules/rambda/src/tail.js create mode 100644 src/lib/node_modules/rambda/src/take.js create mode 100644 src/lib/node_modules/rambda/src/takeLast.js create mode 100644 src/lib/node_modules/rambda/src/takeLastWhile.js create mode 100644 src/lib/node_modules/rambda/src/takeWhile.js create mode 100644 src/lib/node_modules/rambda/src/tap.js create mode 100644 src/lib/node_modules/rambda/src/test.js create mode 100644 src/lib/node_modules/rambda/src/times.js create mode 100644 src/lib/node_modules/rambda/src/toLower.js create mode 100644 src/lib/node_modules/rambda/src/toPairs.js create mode 100644 src/lib/node_modules/rambda/src/toString.js create mode 100644 src/lib/node_modules/rambda/src/toUpper.js create mode 100644 src/lib/node_modules/rambda/src/transpose.js create mode 100644 src/lib/node_modules/rambda/src/trim.js create mode 100644 src/lib/node_modules/rambda/src/tryCatch.js create mode 100644 src/lib/node_modules/rambda/src/type.js create mode 100644 src/lib/node_modules/rambda/src/unapply.js create mode 100644 src/lib/node_modules/rambda/src/union.js create mode 100644 src/lib/node_modules/rambda/src/uniq.js create mode 100644 src/lib/node_modules/rambda/src/uniqBy.js create mode 100644 src/lib/node_modules/rambda/src/uniqWith.js create mode 100644 src/lib/node_modules/rambda/src/unless.js create mode 100644 src/lib/node_modules/rambda/src/unwind.js create mode 100644 src/lib/node_modules/rambda/src/update.js create mode 100644 src/lib/node_modules/rambda/src/values.js create mode 100644 src/lib/node_modules/rambda/src/view.js create mode 100644 src/lib/node_modules/rambda/src/when.js create mode 100644 src/lib/node_modules/rambda/src/where.js create mode 100644 src/lib/node_modules/rambda/src/whereAny.js create mode 100644 src/lib/node_modules/rambda/src/whereEq.js create mode 100644 src/lib/node_modules/rambda/src/without.js create mode 100644 src/lib/node_modules/rambda/src/xor.js create mode 100644 src/lib/node_modules/rambda/src/zip.js create mode 100644 src/lib/node_modules/rambda/src/zipObj.js create mode 100644 src/lib/node_modules/rambda/src/zipWith.js create mode 100644 src/lib/package.json rename src/lib/{ => src}/accent-and-ps-utils.test.ts (100%) rename src/lib/{ => src}/accent-and-ps-utils.ts (96%) rename src/lib/{ => src}/accent-helpers.test.ts (100%) rename src/lib/{ => src}/accent-helpers.ts (99%) rename src/lib/{ => src}/convert-spelling.test.ts (100%) rename src/lib/{ => src}/convert-spelling.ts (98%) rename src/lib/{ => src}/default-text-options.ts (81%) rename src/lib/{ => src}/diacritics-helpers.test.ts (100%) rename src/lib/{ => src}/diacritics-helpers.ts (100%) rename src/lib/{ => src}/diacritics.test.ts (99%) rename src/lib/{ => src}/diacritics.ts (99%) rename src/lib/{ => src}/dictionary-models.js (100%) rename src/lib/{ => src}/dictionary.proto (100%) rename src/lib/{ => src}/dyn-comp-aux-verbs.ts (99%) rename src/lib/{ => src}/fields.ts (94%) rename src/lib/{ => src}/get-english-word.test.ts (100%) rename src/lib/{ => src}/get-english-word.ts (97%) rename src/lib/{ => src}/grammar-units.ts (99%) rename src/lib/{ => src}/human-readable.ts (98%) rename src/lib/{inflection-pattern.tsx => src/inflection-pattern.ts} (51%) rename src/lib/{ => src}/irregular-conjugations.ts (99%) rename src/lib/{ => src}/is-pashto.test.ts (100%) rename src/lib/{ => src}/is-pashto.ts (100%) rename src/lib/{ => src}/misc-helpers.test.ts (98%) rename src/lib/{ => src}/misc-helpers.ts (99%) rename src/lib/{ => src}/np-tools.ts (93%) rename src/lib/{ => src}/p-text-helpers.test.ts (99%) rename src/lib/{ => src}/p-text-helpers.ts (99%) rename src/lib/{ => src}/pashto-consonants.ts (100%) rename src/lib/{ => src}/pashto-inflector.test.ts (99%) rename src/lib/{ => src}/pashto-inflector.ts (99%) rename src/lib/{ => src}/phonetics-to-diacritics.test.ts (100%) rename src/lib/{ => src}/phonetics-to-diacritics.ts (100%) rename src/lib/{ => src}/phrase-building/blocks-utils.ts (99%) rename src/lib/{ => src}/phrase-building/compile.ts (99%) rename src/lib/{ => src}/phrase-building/english-vp-rendering.ts (99%) rename src/{components/ep-explorer => lib/src/phrase-building}/eps-reducer.ts (95%) create mode 100644 src/lib/src/phrase-building/make-selections.ts rename src/lib/{ => src}/phrase-building/np-tools.ts (99%) rename src/lib/{ => src}/phrase-building/render-adj.ts (91%) rename src/lib/{ => src}/phrase-building/render-ap.ts (96%) rename src/lib/{ => src}/phrase-building/render-common.ts (97%) rename src/lib/{ => src}/phrase-building/render-complement.ts (97%) rename src/lib/{ => src}/phrase-building/render-ep.ts (98%) rename src/lib/{ => src}/phrase-building/render-np.ts (99%) rename src/lib/{ => src}/phrase-building/render-sandwich.ts (95%) rename src/lib/{ => src}/phrase-building/render-vp.ts (99%) rename src/{components/vp-explorer => lib/src/phrase-building}/verb-selection.ts (94%) rename src/lib/{ => src}/phrase-building/vp-tools.ts (96%) rename src/{components/vp-explorer => lib/src/phrase-building}/vps-reducer.ts (94%) rename src/lib/{ => src}/protobuf.test.ts (95%) rename src/lib/{ => src}/protobuf.ts (96%) rename src/lib/{ => src}/sandwiches.ts (98%) rename src/lib/{ => src}/shuffle-array.ts (100%) rename src/lib/{ => src}/simplify-phonetics.test.ts (100%) rename src/lib/{ => src}/simplify-phonetics.ts (100%) rename src/lib/{ => src}/standardize-pashto.test.ts (100%) rename src/lib/{ => src}/standardize-pashto.ts (100%) rename src/lib/{ => src}/translate-phonetics-replacer.ts (100%) rename src/lib/{ => src}/translate-phonetics.test.ts (100%) rename src/lib/{ => src}/translate-phonetics.ts (100%) rename src/lib/{ => src}/type-predicates.ts (97%) rename src/lib/{ => src}/validate-entry.test.ts (99%) rename src/lib/{ => src}/validate-entry.ts (99%) rename src/lib/{ => src}/verb-conjugation.ts (99%) rename src/lib/{ => src}/verb-info.test.ts (100%) rename src/lib/{ => src}/verb-info.ts (99%) create mode 100644 src/lib/yarn.lock delete mode 100644 src/library.ts rename {nouns-adjs => vocab/nouns-adjs}/a-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/aa-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/aanu-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/adverbs.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/basic-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/basic-masc.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/basic-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/e-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/ee-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/exception-people-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/exception-people-masc.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/ey-masc.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/ey-stressed-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/ey-unstressed-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/loc-adverbs.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/non-inflecting.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/nouns-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/o-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/short-irreg-unisex.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/u-masc.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/uy-fem.js (100%) rename {nouns-adjs => vocab/nouns-adjs}/y-masc.js (100%) rename {verbs => vocab/verbs}/dyn-comp-trans.js (100%) rename {verbs => vocab/verbs}/simple-gramm-trans.js (100%) rename {verbs => vocab/verbs}/simple-intrans.js (100%) rename {verbs => vocab/verbs}/simple-trans.js (100%) rename {verbs => vocab/verbs}/stative-comp-intrans.js (100%) rename {verbs => vocab/verbs}/stative-comp-trans.js (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5f1ef1e..9a466fe 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,4 +29,9 @@ jobs: yarn install yarn build-library yarn test + cd lib + npm install + npm publish + cd ../components + npm install npm publish \ No newline at end of file diff --git a/.gitignore b/.gitignore index fa30a96..cd401c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +# compiled library files +dist + # dependencies /node_modules /.pnp @@ -28,4 +31,4 @@ yarn-debug.log* yarn-error.log* /src/verbs.ts -/src/noun-adjs.ts +/src/nouns-adjs.ts diff --git a/get-words.js b/get-words.js index 1a5e33b..e380e93 100644 --- a/get-words.js +++ b/get-words.js @@ -8,20 +8,20 @@ const fs = require("fs"); const fetch = require("node-fetch"); const path = require("path"); -const verbCollectionPath = path.join(".", "verbs"); -const nounAdjCollectionPath = path.join(".", "nouns-adjs"); +const verbCollectionPath = path.join(".", "vocab", "verbs"); +const nounAdjCollectionPath = path.join(".", "vocab", "nouns-adjs"); const verbTsFiles = fs.readdirSync(verbCollectionPath); const nounAdjTsFiles = fs.readdirSync(nounAdjCollectionPath); -const protoModels = require("./src/lib/dictionary-models.js"); +const protoModels = require("./src/lib/src/dictionary-models.js"); const Pbf = require("pbf"); const allVerbTsS = [...new Set(verbTsFiles.reduce((arr, fileName) => { - const TsS = require("./verbs/"+fileName); + const TsS = require("./vocab/verbs/"+fileName); return [...arr, ...TsS]; }, []))]; const allNounAdjTsS = [...new Set(nounAdjTsFiles.reduce((arr, fileName) => { - const TsS = require("./nouns-adjs/"+fileName).map(x => x.ts); + const TsS = require("./vocab/nouns-adjs/"+fileName).map(x => x.ts); return [...arr, ...TsS]; }, []))]; diff --git a/library-post-build.js b/library-post-build.js deleted file mode 100644 index d207149..0000000 --- a/library-post-build.js +++ /dev/null @@ -1,30 +0,0 @@ -const pkg = require("./package.json"); -const glob = require("glob"); -const fs = require("fs-extra"); -const path = require("path"); - -fs.mkdir("dist/node_modules", {}, (err) => { - if (err) throw err; - const required = Object.keys(pkg.dependencies); - required.forEach((m) => { - fs.copySync(`node_modules/${m}`, `dist/node_modules/${m}`); - }); - glob("src/components/verb-info/*.svg", (err, files) => { - if (err) throw err; - files.forEach((file) => { - fs.copySync(file, `dist/components/verb-info/${path.basename(file)}`); - }); - }); - glob("src/components/vp-explorer/*.svg", (err, files) => { - if (err) throw err; - files.forEach((file) => { - fs.copySync(file, `dist/components/vp-explorer/${path.basename(file)}`); - }); - }); - glob("src/components/vp-explorer/*.jpg", (err, files) => { - if (err) throw err; - files.forEach((file) => { - fs.copySync(file, `dist/components/vp-explorer/${path.basename(file)}`); - }); - }); -}); diff --git a/library-tsconfig.json b/library-tsconfig.json deleted file mode 100644 index 3182996..0000000 --- a/library-tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "downlevelIteration": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "ES6", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "declaration": true, - "jsx": "react-jsx", - "outDir": "dist" - }, - "files": [ - "src/functions.ts", - "src/components.ts", - "src/library.ts", - "src/images.d.ts" - ] -} diff --git a/package.json b/package.json index 3c33691..613bd0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "4.9.14", + "version": "4.9.15", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", @@ -25,15 +25,8 @@ "publishConfig": { "registry": "https://npm.lingdocs.com" }, - "dependencies": { - "classnames": "^2.2.6", - "jsurl2": "^2.1.0", - "lz-string": "^1.4.4", - "pbf": "^3.2.1", - "rambda": "^6.7.0", - "react-select": "^4.3.1" - }, "devDependencies": { + "pbf": "^3.2.1", "@fortawesome/fontawesome-free": "^5.15.2", "@rollup/plugin-commonjs": "^22.0.2", "@rollup/plugin-image": "^2.0.6", @@ -47,7 +40,6 @@ "@types/pbf": "^3.0.2", "@types/react": "^17.0.3", "@types/react-dom": "^17.0.2", - "@types/react-select": "^5.0.1", "bootstrap": "^4.6.0", "fs-extra": "^9.1.0", "glob": "^7.1.6", @@ -58,22 +50,16 @@ "react-scripts": "4.0.3", "rimraf": "^3.0.2", "rollup": "^2.79.1", - "rollup-plugin-multi-input": "^1.3.1", "typescript": "^4.2.3", "web-vitals": "^1.0.1" }, - "peerDependencies": { - "react": "^17.0.1", - "react-bootstrap": "^1.5.1", - "react-dom": "^17.0.1" - }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "build-website": "node get-words.js && npm run build", - "build-library": "node get-words.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && node library-post-build.js && rollup -c", + "build-library": "cd src/components && rimraf dist && tsc --project lib-tsconfig.json && cd ../lib && rimraf dist && tsc --project lib-tsconfig.json && cd .. && rollup -c", "test-ci": "npm run test -- --watchAll=false", "get-words": "node get-words.js" }, diff --git a/src/App.tsx b/src/App.tsx index 5284e4d..07e031c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,25 +9,25 @@ import { useEffect } from "react"; import verbs from "./verbs"; import nounsAdjs from "./nouns-adjs"; -import Pashto from "./components/Pashto"; -import Phonetics from "./components/Phonetics"; -import { getVerbInfo } from "./lib/verb-info"; -import ButtonSelect from "./components/ButtonSelect"; +import Pashto from "./components/src/Pashto"; +import Phonetics from "./components/src/Phonetics"; +import { getVerbInfo } from "./lib/src/verb-info"; +import ButtonSelect from "./components/src/ButtonSelect"; import { clamp -} from "./lib/p-text-helpers"; +} from "./lib/src/p-text-helpers"; import { randomNumber, -} from "./lib/misc-helpers"; +} from "./lib/src/misc-helpers"; import { Modal } from "react-bootstrap"; import * as T from "./types"; -import { isAdjectiveEntry, isAdverbEntry, isLocativeAdverbEntry, isNounEntry } from "./lib/type-predicates"; -import defualtTextOptions from "./lib/default-text-options"; -import PhraseBuilder from "./components/vp-explorer/VPExplorer"; -import useStickyState from "./lib/useStickyState"; -import EPExplorer from "./components/ep-explorer/EPExplorer"; +import { isAdjectiveEntry, isAdverbEntry, isLocativeAdverbEntry, isNounEntry } from "./lib/src/type-predicates"; +import defualtTextOptions from "./lib/src/default-text-options"; +import PhraseBuilder from "./components/src/vp-explorer/VPExplorer"; +import useStickyState from "./components/src/useStickyState"; +import EPExplorer from "./components/src/ep-explorer/EPExplorer"; type VerbType = "simple" | "stative compound" | "dynamic compound"; const verbTypes: VerbType[] = [ diff --git a/src/components.ts b/src/components.ts deleted file mode 100644 index c0cbb45..0000000 --- a/src/components.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2021 lingdocs.com - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -import InflectionsTable from "./components/InflectionsTable"; -import Pashto from "./components/Pashto"; -import Phonetics from "./components/Phonetics"; -import InlinePs from "./components/InlinePs"; -import ButtonSelect from "./components/ButtonSelect"; -import VerbFormDisplay from "./components/VerbFormDisplay"; -import VerbTable from "./components/VerbTable"; -import EPDisplay from "./components/ep-explorer/EPDisplay"; -import Examples from "./components/Examples"; -import Hider from "./components/Hider"; -import EntrySelect from "./components/EntrySelect"; -import VerbInfo, { RootsAndStems } from "./components/verb-info/VerbInfo"; -import VPExplorer from "./components/vp-explorer/VPExplorer"; -import { makeVPSelectionState } from "./components/vp-explorer/verb-selection"; -import { vpsReducer } from "./components/vp-explorer/vps-reducer"; -import type { VpsReducerAction as VpsA } from "./components/vp-explorer/vps-reducer"; -import useStickyState from "./lib/useStickyState"; -import Block, { NPBlock, APBlock } from "./components/blocks/Block"; -import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal"; -import CompiledPTextDisplay from "./components/CompiledPTextDisplay"; -import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay"; -import NPPicker from "./components/np-picker/NPPicker"; -import EPPicker from "./components/ep-explorer/EPPicker"; -import EPExplorer from "./components/ep-explorer/EPExplorer"; -import APPicker from "./components/ap-picker/APPicker"; -import VPDisplay from "./components/vp-explorer/VPDisplay"; -import VPPicker from "./components/vp-explorer/VPPicker"; - -export { - useStickyState, - roleIcon, - vpsReducer, - makeVPSelectionState, - EPExplorer, - VPExplorer, - Examples, - VerbFormDisplay, - VerbTable, - VerbInfo, - RootsAndStems, - InflectionsTable, - Pashto, - Phonetics, - InlinePs, - ButtonSelect, - Hider, - EntrySelect, - NPPicker, - APPicker, - NPBlock, - APBlock, - Block, - EPDisplay, - VPDisplay, - EPPicker, - VPPicker, - CompiledPTextDisplay, - RenderedBlocksDisplay, -} - -export type VpsReducerAction = VpsA; \ No newline at end of file diff --git a/src/components/EntrySelect.tsx b/src/components/EntrySelect.tsx deleted file mode 100644 index 9514fc0..0000000 --- a/src/components/EntrySelect.tsx +++ /dev/null @@ -1,182 +0,0 @@ -import * as T from "../types"; -import { StyleHTMLAttributes } from "react"; -// import Select, { StylesConfig } from "react-select"; -// import AsyncSelect from "react-select/async"; -// import { -// makeSelectOption, -// makeVerbSelectOption, -// } from "./np-picker/picker-tools"; - -// export const customStyles: StylesConfig = { -// menuPortal: (base: any) => ({ -// ...base, -// zIndex: 99999, -// }), -// menu: (base: any) => ({ -// ...base, -// zIndex: 999999, -// }), -// option: (provided: any, state: any) => ({ -// ...provided, -// padding: "10px 5px", -// color: "#121418", -// }), -// input: (base: any) => ({ -// ...base, -// padding: 0, -// }), -// } - -function EntrySelect(props: { - entryFeeder: T.EntryFeederSingleType, - value: E | undefined, - onChange: (value: E | undefined) => void, - name: string | undefined, - isVerbSelect?: boolean, - opts: T.TextOptions, - style?: StyleHTMLAttributes, -}) { - return
not here
; -// const divStyle = props.style || { width: "13rem" }; -// const placeholder = "entries" in props ? "Select…" : "Search Pashto"; -// function makeOption(e: E | T.DictionaryEntry) { -// if ("entry" in e) { -// return (props.isVerbSelect ? makeVerbSelectOption : makeSelectOption)(e, props.opts); -// } -// return makeSelectOption(e, props.opts); -// } -// const value = props.value ? makeOption(props.value) : undefined; -// if ("search" in props.entryFeeder) { -// const search = props.entryFeeder.search; -// const getByTs = props.entryFeeder.getByTs; -// const options = (searchString: string) => -// new Promise<{ value: string, label: string | JSX.Element }[]>(resolve => { -// resolve(search(searchString).map(makeOption)); -// }); -// const onChange = (v: { label: string | JSX.Element, value: string } | null) => { -// if (!v) { -// props.onChange(undefined); -// return; -// } -// const s = getByTs(parseInt(v.value)); -// if (!s) return; -// props.onChange(s); -// } -// return
-// -//
; -// } -// const entries = props.entryFeeder; -// const options = entries -// .sort((a, b) => { -// if ("entry" in a) { -// return a.entry.p.localeCompare("p" in b ? b.p : b.entry.p, "af-PS") -// } -// return a.p.localeCompare("p" in b ? b.p : b.entry.p, "af-PS"); -// }) -// .map(makeOption); -// const onChange = (v: { label: string | JSX.Element, value: string } | null) => { -// if (!v) { -// props.onChange(undefined); -// return; -// } -// const s = entries.find(e => ( -// ("entry" in e) -// ? e.entry.ts.toString() === v.value -// : e.ts.toString() === v.value -// )); -// if (!s) return; -// props.onChange(s); -// } -// return
-// -//
-} - -// function sandwichSideEq(s1: T.PsString | undefined, s2: T.PsString | undefined): boolean { -// if (s1 === undefined && s2 === undefined) { -// return true -// } -// if (typeof s1 === "object" && typeof s2 === "object" && s1.p === s2.p) { -// return true; -// } -// return false; -// } - -// function makeSandwichOption(s: T.Sandwich): { label: string, value: string } { -// return { -// label: `${s.before ? s.before.p : ""} ... ${s.after ? s.after.p : ""} (${s.e})`, -// value: JSON.stringify(s), -// }; -// } - -export default EntrySelect; \ No newline at end of file diff --git a/src/components/ep-explorer/EquativePicker.tsx b/src/components/ep-explorer/EquativePicker.tsx deleted file mode 100644 index 30717a2..0000000 --- a/src/components/ep-explorer/EquativePicker.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import * as T from "../../types" -// // import Select from "react-select"; -// import ButtonSelect from "../ButtonSelect"; - -// const zIndexProps = { -// menuPortalTarget: document.body, -// styles: { menuPortal: (base: any) => ({ ...base, zIndex: 9999 }) }, -// }; - -// const options: { label: string | JSX.Element, value: T.EquativeTense }[] = [{ -// label: "Present", -// value: "present", -// }, { -// label: "Habitual", -// value: "habitual", -// }, { -// label: "Subjunctive", -// value: "subjunctive", -// }, { -// label: "Future", -// value: "future", -// }, { -// label: "Past", -// value: "past", -// }, { -// label: `"Would Be"`, -// value: "wouldBe", -// }, { -// label: "Past Subjunctive", -// value: "pastSubjunctive", -// }, { -// label: `"Would Have Been"`, -// value: "wouldHaveBeen", -// }]; - -function EquativePicker({ equative, onChange, hideNegative }: { - equative: { tense: T.EquativeTense, negative: boolean }, - onChange: (e: { tense: T.EquativeTense, negative: boolean }) => void, - hideNegative?: boolean, -}) { - return
not here
; - // function onTenseSelect(o: { value: T.EquativeTense } | null) { - // const value = o?.value ? o.value : undefined; - // if (!value) { - // return; - // } - // onChange({ - // ...equative, - // tense: value, - // }); - // } - // function moveTense(dir: "forward" | "back") { - // return () => { - // const currIndex = options.findIndex(tn => tn.value === equative.tense) - // if (currIndex === -1) { - // console.error("error moving tense", dir); - // return; - // } - // const newIndex = dir === "forward" - // ? ((currIndex + 1) % options.length) - // : (currIndex === 0 ? (options.length - 1) : (currIndex - 1)) - // const newTense = options[newIndex]; - // onChange({ - // ...equative, - // tense: newTense.value, - // }); - // }; - // } - // function onPosNegSelect(value: "true" | "false") { - // onChange({ - // ...equative, - // negative: value === "true", - // }); - // } - // return
- //
- //
Tense:
- // ` element in `DummyInput` component + +## 5.2.2 + +### Patch Changes + +- [`940a50b1`](https://github.com/JedWatson/react-select/commit/940a50b1a579b279b82c1efc5608a92eb422919e) [#4928](https://github.com/JedWatson/react-select/pull/4928) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fix usage with esModuleInterop disabled + +- [`54f9538e`](https://github.com/JedWatson/react-select/commit/54f9538e350bae4e11aa11311731cb95eb56d669) [#4941](https://github.com/JedWatson/react-select/pull/4941) Thanks [@prichey](https://github.com/prichey)! - Use React's AriaAttributes type directly rather than recreating + +- [`e97d45c0`](https://github.com/JedWatson/react-select/commit/e97d45c04bbc91e9e2ff9509f0d9c16fc4e4234e) [#4908](https://github.com/JedWatson/react-select/pull/4908) Thanks [@vjee](https://github.com/vjee)! - Make 3rd argument of CommonProps['setValue'] optional. + +## 5.2.1 + +### Patch Changes + +- [`f172d7f9`](https://github.com/JedWatson/react-select/commit/f172d7f9c20b82db14e795d578ee4802475d2bdc) [#4886](https://github.com/JedWatson/react-select/pull/4886) Thanks [@Akridian](https://github.com/Akridian)! - Hooks for creation of custom Selects are now exported from main entry + +## 5.2.0 + +### Minor Changes + +- [`6c7a3d1e`](https://github.com/JedWatson/react-select/commit/6c7a3d1e07b7d6a8f484a829e69b20eae5a92b91) [#4785](https://github.com/JedWatson/react-select/pull/4785) Thanks [@Rall3n](https://github.com/Rall3n)! - Add `prevInputValue` to action meta + +- [`b522ac65`](https://github.com/JedWatson/react-select/commit/b522ac658f85701ecf413436f3cf8d8d49117c82) [#4860](https://github.com/JedWatson/react-select/pull/4860) Thanks [@ebonow](https://github.com/ebonow)! - Fix animated MultiValue transitions when being removed and change method used to generate unique keys for Option components. Closes #4844 , closes #4602 + +### Patch Changes + +- [`417e7217`](https://github.com/JedWatson/react-select/commit/417e721786af309ede9b35983a18df89363cd1c5) [#4842](https://github.com/JedWatson/react-select/pull/4842) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Remove src directory from published package + +- [`480ea85b`](https://github.com/JedWatson/react-select/commit/480ea85bed6f7c90c45d14884b4ec1105d92971a) [#4846](https://github.com/JedWatson/react-select/pull/4846) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Add missing index to MultiValue props type + +- [`b8e34472`](https://github.com/JedWatson/react-select/commit/b8e34472d352a87e9687027a5c3f4ed767984177) [#4854](https://github.com/JedWatson/react-select/pull/4854) Thanks [@mikunpham](https://github.com/mikunpham)! - Make input container css re-compute whenever input value changes due to a bug from `@emotion/react` in development env. + +## 5.1.0 + +### Minor Changes + +- [8b38d49b](https://github.com/JedWatson/react-select/commit/8b38d49b4a779c653f70b502a61f7c64220fa44d) [#4807](https://github.com/JedWatson/react-select/pull/4807) Thanks [@hcharley](https://github.com/hcharley)! - Export AsyncCreatableProps from creatable entrypoint + +- [46eeda1a](https://github.com/JedWatson/react-select/commit/46eeda1a6829af168ae24b49a251d12e410706ab) [#4801](https://github.com/JedWatson/react-select/pull/4801) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Export more types from main entry point + +### Patch Changes + +- [fdd01e66](https://github.com/JedWatson/react-select/commit/fdd01e664400b684b83c2b1c629bd3c76b152236) [#4833](https://github.com/JedWatson/react-select/pull/4833) Thanks [@ebonow](https://github.com/ebonow)! - Value container display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input + +- [0937604f](https://github.com/JedWatson/react-select/commit/0937604ffcec5d56dd4918ae728feee345e1c78c) [#4823](https://github.com/JedWatson/react-select/pull/4823) Thanks [@mikunpham](https://github.com/mikunpham)! - Fix the issue where input contents are moved to the left due to multiple space characters. + +- [ec80b577](https://github.com/JedWatson/react-select/commit/ec80b577665f2bd9b2cff9d7ca34723b6b65e5b8) [#4803](https://github.com/JedWatson/react-select/pull/4803) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Import CSSObject from @emotion/react instead of @emotion/serialize + +## 5.0.0 + +### Major Changes + +- [ef87c3ac](https://github.com/JedWatson/react-select/commit/ef87c3ac7fd453800595eebebb85f1107f78d34c) [#4683](https://github.com/JedWatson/react-select/pull/4683) Thanks [@JedWatson](https://github.com/JedWatson)! - React-Select has been converted from Flow to TypeScript. + + Other changes for v5 include usage of `forwardRef`, new hooks for `stateManager`, `async` and `creatable` components, and more reliable filtering implementation with new options in the creatable variant. + +### Patch Changes + +- [10225290](https://github.com/JedWatson/react-select/commit/10225290f9b1c9a722fc96fa4c74d91bfbeb7df8) [#4720](https://github.com/JedWatson/react-select/pull/4720) - Updated the layout for the singleValue input/placeholder/container so that it works better when used in flex layouts. + +- [53f1972b](https://github.com/JedWatson/react-select/commit/53f1972b2d76443a63df18eb538ccbf68787e362) [#4731](https://github.com/JedWatson/react-select/pull/4731) Thanks [@JedWatson](https://github.com/JedWatson)! - MultiValue key now includes a hyphen between the value and the index to prevent edge cases where you could get a duplicate key error + +- [b41f4ceb](https://github.com/JedWatson/react-select/commit/b41f4cebbcaa8714bcf36cf24357f580a74c6a16) [#4704](https://github.com/JedWatson/react-select/pull/4704) Thanks [@Rall3n](https://github.com/Rall3n)! - Fix findDOMNode deprecation by adding refs to transition components + +- [4b028829](https://github.com/JedWatson/react-select/commit/4b028829721bcd9014d70ee8dce1efbaf6373cd0) [#4634](https://github.com/JedWatson/react-select/pull/4634) - The readonly attribute has been removed from the DummyInput to improve accessibility + +- [7fcec537](https://github.com/JedWatson/react-select/commit/7fcec537e75b80b3084b64db76150cfef9d2ee2f) [#4697](https://github.com/JedWatson/react-select/pull/4697) - Add the role of combobox and the required ARIA attributes to the Input and DummyInput components to allow JAWS support and a better screen reader experience overall. + +- [ca2c0e5b](https://github.com/JedWatson/react-select/commit/ca2c0e5b18f0c862e7cb5956d0f56104ffa4255f) [#4756](https://github.com/JedWatson/react-select/pull/4756) Thanks [@fdcds](https://github.com/fdcds)! - Add `option` field to type of `CreateOptionActionMeta` + +- [9e82aadc](https://github.com/JedWatson/react-select/commit/9e82aadcd1931f730235d317a2299a681da8c373) [#4676](https://github.com/JedWatson/react-select/pull/4676) - The following improvements have been made for screen reader users: + + - NVDA now announces the context text when initially focused + - Selected option/s (single and multi) are now announced when initially focused + - VoiceOver now announces the context text when re-focusing + - The clear action is now announced + - Placeholder text is now announced + - Mobile VoiceOver is now able to remove selected multi options + +- [638f5455](https://github.com/JedWatson/react-select/commit/638f545517d320fe70ca954511a71e96956abae3) [#4702](https://github.com/JedWatson/react-select/pull/4702) Thanks [@Methuselah96](https://github.com/Methuselah96)! - The Option generic is no longer required to extend the OptionBase type + +- [23cea0b5](https://github.com/JedWatson/react-select/commit/23cea0b513525bdf6282e3d03e66eff38da9e993) [#4782](https://github.com/JedWatson/react-select/pull/4782) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fix type of loadingMessage prop to allow it to return any ReactNode + +## 5.0.0-beta.1 + +### Patch Changes + +- [10225290](https://github.com/JedWatson/react-select/commit/10225290f9b1c9a722fc96fa4c74d91bfbeb7df8) [#4720](https://github.com/JedWatson/react-select/pull/4720) - Updated the layout for the singleValue input/placeholder/container so that it works better when used in flex layouts. + +- [53f1972b](https://github.com/JedWatson/react-select/commit/53f1972b2d76443a63df18eb538ccbf68787e362) [#4731](https://github.com/JedWatson/react-select/pull/4731) Thanks [@JedWatson](https://github.com/JedWatson)! - MultiValue key now includes a hyphen between the value and the index to prevent edge cases where you could get a duplicate key error + +- [b41f4ceb](https://github.com/JedWatson/react-select/commit/b41f4cebbcaa8714bcf36cf24357f580a74c6a16) [#4704](https://github.com/JedWatson/react-select/pull/4704) Thanks [@Rall3n](https://github.com/Rall3n)! - Fix findDOMNode deprecation by adding refs to transition components + +- [7fcec537](https://github.com/JedWatson/react-select/commit/7fcec537e75b80b3084b64db76150cfef9d2ee2f) [#4697](https://github.com/JedWatson/react-select/pull/4697) - Add the role of combobox and the required ARIA attributes to the Input and DummyInput components to allow JAWS support and a better screen reader experience overall. + +- [9e82aadc](https://github.com/JedWatson/react-select/commit/9e82aadcd1931f730235d317a2299a681da8c373) [#4676](https://github.com/JedWatson/react-select/pull/4676) - The following improvements have been made for screen reader users: + + - NVDA now announces the context text when initially focused + - Selected option/s (single and multi) are now announced when initially focused + - VoiceOver now announces the context text when re-focusing + - The clear action is now announced + - Placeholder text is now announced + - Mobile VoiceOver is now able to remove selected multi options + +- [638f5455](https://github.com/JedWatson/react-select/commit/638f545517d320fe70ca954511a71e96956abae3) [#4702](https://github.com/JedWatson/react-select/pull/4702) Thanks [@Methuselah96](https://github.com/Methuselah96)! - The Option generic is no longer required to extend the OptionBase type + +## 5.0.0-beta.0 + +### Major Changes + +- [ef87c3ac](https://github.com/JedWatson/react-select/commit/ef87c3ac7fd453800595eebebb85f1107f78d34c) [#4489](https://github.com/JedWatson/react-select/pull/4489) Thanks [@Methuselah96](https://github.com/Methuselah96)! - React-Select has been converted from Flow to TypeScript. + + Other changes for v5 include usage of `forwardRef`, new hooks for `stateManager`, `async` and `creatable` components, and more reliable filtering implementation with new options in the creatable variant. + +- [#4625](https://github.com/JedWatson/react-select/pull/4625) Thanks [@ebonow](https://github.com/ebonow)! - Remove dependency on AutoSizeInput + - BREAKING CHANGES: + - IE11 no longer works as it does not fully support CSS grid + - Renaming the .prefix\_\_input now targets the input and NOT the container. Unfortunate but overdue and perhaps opens the door to completely decoupling the input from needing a container if autosizing is not important. + +### Patch Changes + +- [4b028829](https://github.com/JedWatson/react-select/commit/4b028829721bcd9014d70ee8dce1efbaf6373cd0) [#4634](https://github.com/JedWatson/react-select/pull/4634) - The readonly attribute has been removed from the DummyInput to improve accessibility + +--- + +## 4.3.1 + +### Patch Changes + +- [2c915d10](https://github.com/JedWatson/react-select/commit/2c915d10b5ce7b7f48aa0903fa838f9c294c434d) [#4577](https://github.com/JedWatson/react-select/pull/4577) - Bump @emotion/cache to v11.4.0 which fixes an issue where different versions of Emotion running at the same time causes styles to disappear in production. + +## 4.3.0 + +### Minor Changes + +- [035294f4](https://github.com/JedWatson/react-select/commit/035294f457921423c9237861f7c73584bdecbcc4) [#3360](https://github.com/JedWatson/react-select/pull/3360) Thanks [@JedWatson](https://github.com/JedWatson)! - Now pass the focusedOption to the MenuList Component as a prop + +### Patch Changes + +- [7a414a7c](https://github.com/JedWatson/react-select/commit/7a414a7c7a1f8e2902e43bd476e3db17a8dce049) [#3262](https://github.com/JedWatson/react-select/pull/3262) Thanks [@JedWatson](https://github.com/JedWatson)! - The Menu bottom is no longer scrolled into view when menuShouldScrollIntoView=false + +## 4.2.1 + +### Patch Changes + +- [ca3c41bb](https://github.com/JedWatson/react-select/commit/ca3c41bb55e2666589bbbb69d1153357191d07a4) [#4478](https://github.com/JedWatson/react-select/pull/4478) Thanks [@ebonow](https://github.com/ebonow)! - Check passive events polyfill for the existence of window for SSR + +## 4.2.0 + +### Minor Changes + +- [2ffed9c6](https://github.com/JedWatson/react-select/commit/2ffed9c6c40c9d5b81d7c8faf7bfc995976299ec) [#4444](https://github.com/JedWatson/react-select/pull/4444) Thanks [@Rall3n](https://github.com/Rall3n)! - Use accessor props to get value and label in `compareOption` + +- [2baf5a9d](https://github.com/JedWatson/react-select/commit/2baf5a9df2f4f56f9c9374fcb879cb5259a6d8d0) [#4414](https://github.com/JedWatson/react-select/pull/4414) Thanks [@ebonow](https://github.com/ebonow)! - Add ariaLiveMessages prop for internationalization and other customizations + +- [7cdb8a6b](https://github.com/JedWatson/react-select/commit/7cdb8a6b4d9de89a599b3aee8b6d90a44a931ea6) [#4391](https://github.com/JedWatson/react-select/pull/4391) Thanks [@ebonow](https://github.com/ebonow)! - Pass and sanitize CommonProps passed to Group and Input components + +### Patch Changes + +- [c955415c](https://github.com/JedWatson/react-select/commit/c955415cd3724489423dd8e84d6dab5ace24c984) [#4437](https://github.com/JedWatson/react-select/pull/4437) Thanks [@ebonow](https://github.com/ebonow)! - Set event listeners to be non-passive to remove Chrome console warnings + +- [3ca22b2f](https://github.com/JedWatson/react-select/commit/3ca22b2f49ad4f05f98ec8a565d74c483c0b98aa) [#3827](https://github.com/JedWatson/react-select/pull/3827) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Memoize stripDiacritics in createFilter for the input with memoize-one so that stripDiacritics is not called for the same string as many times as there are options every time the input changes + + Inspired by https://blog.johnnyreilly.com/2019/04/react-select-with-less-typing-lag.html + +- [dce3863f](https://github.com/JedWatson/react-select/commit/dce3863ff2ba8dfb50f505d81a2e70cf2d7a97e7) [#4423](https://github.com/JedWatson/react-select/pull/4423) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Remove browser alias fields in order to fix SSR apps + +- [ec7c0728](https://github.com/JedWatson/react-select/commit/ec7c0728c5bfe98a81ab557699147ae244f7a073) [#4443](https://github.com/JedWatson/react-select/pull/4443) Thanks [@ebonow](https://github.com/ebonow)! - Allow tabIndex prop Type to be number or string + +## 4.1.0 + +### Minor Changes + +- [b5f9b0c5](https://github.com/JedWatson/react-select/commit/b5f9b0c59d7ac8559f88287ba73f0495b4c8eed2) [#4342](https://github.com/JedWatson/react-select/pull/4342) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Standardized innerProps and className props on customizable components + +- [19b76342](https://github.com/JedWatson/react-select/commit/19b763428d6df254f0b9662f18a698dd3c59d83b) [#3911](https://github.com/JedWatson/react-select/pull/3911) Thanks [@eugenet8k](https://github.com/eugenet8k)! - Add `removedValues` to `onChange` event meta when the action is `clear` (when the user clears the value in the Select) + +### Patch Changes + +- [f600d13f](https://github.com/JedWatson/react-select/commit/f600d13f5981c9e54e78247fdd82f62555373cff) [#4422](https://github.com/JedWatson/react-select/pull/4422) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fix finding focusable options for groups + +- [a016c878](https://github.com/JedWatson/react-select/commit/a016c87821d9289ef9c317c0c397d64a0824ce16) [#4420](https://github.com/JedWatson/react-select/pull/4420) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Bump dependency on @babel/runtime in order to fix compatibility issues with Webpack 5 + +- [10b5f5a5](https://github.com/JedWatson/react-select/commit/10b5f5a5edc93becb6b46f22666305ec8c1b7de3) [#4404](https://github.com/JedWatson/react-select/pull/4404) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Remove unnecessary dependency on @emotion/css + +## 4.0.2 + +### Patch Changes + +- [44f285b0](https://github.com/JedWatson/react-select/commit/44f285b0d4a50e16713b9aa3746d73d80dee2c91) [#4399](https://github.com/JedWatson/react-select/pull/4399) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fixed building focusable options from groups + +## 4.0.1 + +### Patch Changes + +- [645feb3e](https://github.com/JedWatson/react-select/commit/645feb3e34776a5f181b32f603027df5ca709b7d) [#4396](https://github.com/JedWatson/react-select/pull/4396) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fixed keys for options within groups + +## 4.0.0 + +### Major Changes + +- [02050675](https://github.com/JedWatson/react-select/commit/020506755728f607a77145e2a00458526596496f) [#4339](https://github.com/JedWatson/react-select/pull/4339) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Standardized value passed to onChange + +- [26b6325c](https://github.com/JedWatson/react-select/commit/26b6325c95113591e568451bc2296f98318a8dd9) [#4283](https://github.com/JedWatson/react-select/pull/4283) Thanks [@majgaard](https://github.com/majgaard)! - Upgrades Emotion dependency to v11.0.0 + + BREAKING CHANGE: The NonceProvider component now requires a `cacheKey` prop that corresponds to the `key` for the Emotion cache. + +- [b2488bb5](https://github.com/JedWatson/react-select/commit/b2488bb561ed08c822bc1a828d2d9fd957f25bdf) [#4313](https://github.com/JedWatson/react-select/pull/4313) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Removed usages of UNSAFE React methods + +### Patch Changes + +- [2d5496d5](https://github.com/JedWatson/react-select/commit/2d5496d52b6650b57352a0ea0dfcab383567f3ac) [#4388](https://github.com/JedWatson/react-select/pull/4388) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Removed memoization of buildMenuOptions + +## 3.2.0 + +### Minor Changes + +- [c615e93d](https://github.com/JedWatson/react-select/commit/c615e93dbca15b9f9c6c3e6437744ca53703347f) [#4084](https://github.com/JedWatson/react-select/pull/4084) Thanks [@JedWatson](https://github.com/JedWatson)! - Changed the `cx` and `getValue` props that are passed to components into instance properties, which means they now pass a referential equality check on subsequent renders. + + This is helpful, for example, when you're optimising the performance of rendering custom Option components - see [#3055](https://github.com/JedWatson/react-select/issues/3055) + +- [72f6036f](https://github.com/JedWatson/react-select/commit/72f6036fa6f425837c8c2326bf91dff7bd7f6147) [#4306](https://github.com/JedWatson/react-select/pull/4306) Thanks [@bladey](https://github.com/bladey)! - Remove duplicate prop createOptionPosition + +### Patch Changes + +- [ee638d46](https://github.com/JedWatson/react-select/commit/ee638d4615e789090ea860d2e1c9f4d95a829d50) [#4275](https://github.com/JedWatson/react-select/pull/4275) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Adds react ^17.0.0 to peer dependencies for React 17 support + +- [a0133f19](https://github.com/JedWatson/react-select/commit/a0133f19f45eb2dc9a2faebd74e18f44da7d509b) [#4154](https://github.com/JedWatson/react-select/pull/4154) Thanks [@brenshanny](https://github.com/brenshanny)! - Creatable: Fixed removing MultiValues that have identical values. See issue #4137 for details. + +- [d1e660c6](https://github.com/JedWatson/react-select/commit/d1e660c6b261d7fd60a85a6eca2ee9e3e0348ea2) [#4213](https://github.com/JedWatson/react-select/pull/4213) Thanks [@eythort](https://github.com/eythort)! - Added a guard to the `ScrollCaptor` component to check that `el` exists before calling `removeEventListener`, fixes intermittent errors + +- [a1e1db25](https://github.com/JedWatson/react-select/commit/a1e1db255aceda301d9705d0639e7ca0302bd079) [#4373](https://github.com/JedWatson/react-select/pull/4373) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Fixed value passed to onChange when clearing value + +- [2ad29d61](https://github.com/JedWatson/react-select/commit/2ad29d615bc769c3b3dc4177eb0007a267369748) [#4136](https://github.com/JedWatson/react-select/pull/4136) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Base aria-live message on tabSelectsValue prop + +- [ad890f27](https://github.com/JedWatson/react-select/commit/ad890f279300b6baaca55a642141999a79af8883) [#4326](https://github.com/JedWatson/react-select/pull/4326) Thanks [@Methuselah96](https://github.com/Methuselah96)! - Updated react-input-autosize to v3.0.0 + +- [b28d9922](https://github.com/JedWatson/react-select/commit/b28d99222ab191db27482c6219f8c8b12ef753d8) [#3990](https://github.com/JedWatson/react-select/pull/3990) Thanks [@nikitaindik](https://github.com/nikitaindik)! - Fixed onCreateOption is not always called for Creatable + +- [24ba8702](https://github.com/JedWatson/react-select/commit/24ba8702b93885790ee919de8c01ea8f44d1c354) [#4289](https://github.com/JedWatson/react-select/pull/4289) Thanks [@slimklim](https://github.com/slimklim)! - Added `innerProps` prop to the built-in `MenuList` component to reduce the need for additional DOM nodes or forking internal code when passing additional props to the DOM element the MenuList component is rendering. + + See issue [#4265](https://github.com/JedWatson/react-select/issues/4265) for an explanation. + +## 3.1.1 + +### Patch Changes + +- [c8d74bd5](https://github.com/JedWatson/react-select/commit/c8d74bd5710b1db6736837fb4334a59e46614a27) [#3979](https://github.com/JedWatson/react-select/pull/3979) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Fix repository field + +- [c8447f48](https://github.com/JedWatson/react-select/commit/c8447f480f8b9ca04386bee08e8d3a6fbb4f07c8) [#4034](https://github.com/JedWatson/react-select/pull/4034) Thanks [@sophiebits](https://github.com/sophiebits)! - Improve performance of option filtering when ignoreAccents is enabled (the default) + +- [7af1aafb](https://github.com/JedWatson/react-select/commit/7af1aafb2314db02544b7970784b868e97ec4824) [#4295](https://github.com/JedWatson/react-select/pull/4295) Thanks [@JedWatson](https://github.com/JedWatson)! - Fix menuplacement context + +- [32ad5c04](https://github.com/JedWatson/react-select/commit/32ad5c040bdd96cd1ca71010c2558842d684629c) [#3892](https://github.com/JedWatson/react-select/pull/3892) Thanks [@flexdinesh](https://github.com/flexdinesh)! - Fix react-select ignoring HTML5 "form" attribute + +- [6af14fbb](https://github.com/JedWatson/react-select/commit/6af14fbbc8ab42f2d17721732c9fe221d47c9e30) [#3897](https://github.com/JedWatson/react-select/pull/3897) Thanks [@lorisdev](https://github.com/lorisdev)! - Removes the call to `onMenuOpen` on every input change + + If you were relying on this undesired behavior it may be a breaking change. + Please upgrade accordingly. + +- [0eb1ef96](https://github.com/JedWatson/react-select/commit/0eb1ef9625de907fddaf29516cec3bd93bf9c5f7) Thanks [@JedWatson](https://github.com/JedWatson)! - Fixes touch issues in IE11 + +- [ad608c8f](https://github.com/JedWatson/react-select/commit/ad608c8f1f445e70a082bae755dd30bda5b5f205) [#3928](https://github.com/JedWatson/react-select/pull/3928) Thanks [@dpordomingo](https://github.com/dpordomingo)! - Update MenuPlacer context usage in order to the new React Context API + +## 3.1.0 + +### Minor Changes + +- [4cf6c43c](https://github.com/JedWatson/react-select/commit/4cf6c43cc17a01b043fb60b33cad355d433fdf8c) [#3690](https://github.com/JedWatson/react-select/pull/3690) Thanks [@JedWatson](https://github.com/JedWatson)! - Add `isLoading` prop support to the AsyncSelect component (see #3690) + +### Patch Changes + +- [83b48de4](https://github.com/JedWatson/react-select/commit/83b48de4a18263b361744fc5e89d9b9845b26e4f) [#3868](https://github.com/JedWatson/react-select/pull/3868) Thanks [@Tirzono](https://github.com/Tirzono)! - Fix for not focusing the selected value when the menu opens +- [563b046a](https://github.com/JedWatson/react-select/commit/563b046a57a94c47950e62cedc4ce1c489f19f91) [#3794](https://github.com/JedWatson/react-select/pull/3794) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Convert class components that don't have to be class components to function components to reduce bundle size +- [c7e9c697](https://github.com/JedWatson/react-select/commit/c7e9c697dada15ce3ff9a767bf914ad890080433) [#3682](https://github.com/JedWatson/react-select/pull/3682) Thanks [@JedWatson](https://github.com/JedWatson)! - Allow the input component to be a `textarea` element +- [3c7de0de](https://github.com/JedWatson/react-select/commit/3c7de0de52826fe74d303a01475c43fe88256156) [#3090](https://github.com/JedWatson/react-select/pull/3090) Thanks [@akiselev](https://github.com/akiselev)! - Add aria attributes to dummy input +- [d2a820ef](https://github.com/JedWatson/react-select/commit/d2a820efc70835adf864169eebc76947783a15e2) [#3537](https://github.com/JedWatson/react-select/pull/3537) Thanks [@jdelStrother](https://github.com/jdelStrother)! - Fix Flow issues. Refer to the linked PR for more details on the specific issues. +- [fc52085b](https://github.com/JedWatson/react-select/commit/fc52085b969b1b6f53adf29d52469db9560b828c) [#3662](https://github.com/JedWatson/react-select/pull/3662) Thanks [@eemeli](https://github.com/eemeli)! - Update react-transition-group to ^4.3.0 +- [edb18dd3](https://github.com/JedWatson/react-select/commit/edb18dd3d65b8fbc342bde9e805c5e3293ab6e37) [#3797](https://github.com/JedWatson/react-select/pull/3797) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Enable Babel loose mode to improve bundle size + +## 3.0.8 + +### Patch Changes + +- [a575a3c4](https://github.com/JedWatson/react-select/commit/a575a3c41798696620c77e8098c1150b4adda6cb) [#3727](https://github.com/JedWatson/react-select/pull/3727) Thanks [@tonytangau](https://github.com/tonytangau)! - Adding an `index` prop to `MultiValue` components +- [916f0d2c](https://github.com/JedWatson/react-select/commit/916f0d2c651189bfeff2289d8d3cc597e06cb2ea) [#3644](https://github.com/JedWatson/react-select/pull/3644) Thanks [@TrySound](https://github.com/TrySound)! - Remove usage of `raf` package and replace with `window.requestAnimationFrame` because React already depends on `requestAnimationFrame` +- [cba15309](https://github.com/JedWatson/react-select/commit/cba15309c4d7523ab6a785c8d5c0c7ec1048e22f) [#3676](https://github.com/JedWatson/react-select/pull/3676) Thanks [@wiesys](https://github.com/wiesys)! - Fix `loadingMessage` and `noOptionsMessage` properties in `Styles` flow type +- [32f9475e](https://github.com/JedWatson/react-select/commit/32f9475e6d43a71000a3906da9e6d2d30710efd2) [#3790](https://github.com/JedWatson/react-select/pull/3790) Thanks [@JedWatson](https://github.com/JedWatson)! - Remove unnecessary dependency on `classnames` package +- [1731175d](https://github.com/JedWatson/react-select/commit/1731175d790530b9dbfa787e3fffaff3fb0e44a0) [#3733](https://github.com/JedWatson/react-select/pull/3733) Thanks [@ddc67cd](https://github.com/ddc67cd)! - Pass `name` to `onChange` meta in `Creatable` to make it consistent with onChange in standard `Select` + +## 3.0.7 + +### Patch Changes + +- [df864f2](https://github.com/JedWatson/react-select/commit/df864f2) - Include updated yarn.lock + +## 3.0.6 + +### Patch Changes + +- [3e0a7a7](https://github.com/JedWatson/react-select/commit/3e0a7a7) - \* remove emotion 9 dep from mono repo (this wasn't being used anywhere) + - update dep on react-input-autosize to 2.2.2 (adds UNSAFE prefix to deprecated lifecycles) (resolves #3773) + +## 3.0.5 + +### Patch Changes + +- [270cc01](https://github.com/JedWatson/react-select/commit/270cc01) [#3719](https://github.com/JedWatson/react-select/pulls/3719) Thanks [@jossmac](https://github.com/jossmac)! - Leverage currentColor for loading indicator dots -- makes styling easier, and more consistent, for consumers +- [bab8af1](https://github.com/JedWatson/react-select/commit/bab8af1) - Update lifecycle methods with UNSAFE prefix + +## 3.0.4 + +### Patch Changes + +- [cd8c3090](https://github.com/JedWatson/react-select/commit/cd8c3090) [#3586](https://github.com/JedWatson/react-select/pull/3586) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Add base entrypoint back + +- [#3569](https://github.com/JedWatson/react-select/pull/3569) Thanks [@vadimka123](https://github.com/vadimka123) - Performance improvement: menu items are built when the menu opens, not in the constructor + +- [#3326](https://github.com/JedWatson/react-select/pull/3326) Thanks [@stevemao](https://github.com/stevemao) Fix for iOS focus management when clearing the select value + +- [#3532](https://github.com/JedWatson/react-select/pull/3532) Thanks [@alisonhall](https://github.com/alisonhall)! - Change aria-live assertive to polite + +## 3.0.3 + +- Remove base entrypoint to fix rollup dependency resolution issue + +## 3.0.2 + +- fix erroneous build + +## 3.0.1 + +- [patch][](https://github.com/JedWatson/react-select/commit/): + + - Add README.md file for npm + +## 3.0.0 + +- [major][9ad152b](https://github.com/JedWatson/react-select/commit/9ad152b) [#3574](https://github.com/JedWatson/react-select/pulls/3574) Thanks [@gwyneplaine](https://github.com/gwyneplaine): + - Upgrade emotion dependency from 9.x to 10.x [#3321](https://github.com/JedWatson/react-select/pull/3321) + - Normalize Values [#3416](https://github.com/JedWatson/react-select/pull/3416) + - Separate entrypoints for Async, Creatable and makeAnimated [#3541](https://github.com/JedWatson/react-select/pull/3541) + - UMD builds deprecated + - required react peer-dependecy of 16.8 + +## v2.4.4 / 2019-05-27 + +### BugFixes + +- [#3540] Fixed active styles previously being applied to disabled options. Thanks [@risenforces](https://github.com/risenforces) +- [#3563] Fixed IME composition bugs in non Chrome browsers. Thanks [@jwilander](https://github.com/jwilander) + +## v2.4.3 / 2019-03-17 + +### Bugfixes + +- [#3492](https://github.com/JedWatson/react-select/pull/3492) Add labels to fields to make inspection. [@destructobeam](https://github.com/destructobeam) +- [#3442](https://github.com/JedWatson/react-select/pull/3442) Ignore keydown events on `Enter` in IME. [@sat0yu](https://github.com/sat0yu). +- [#3343](https://github.com/JedWatson/react-select/pull/3343) fix lint issues. [@JoshMcCullough](https://github.com/JoshMcCullough). +- [#3498](https://github.com/JedWatson/react-select/pull/3498) Fix async type. [@mufasa71](https://github.com/mufasa71) +- [#3436](https://github.com/JedWatson/react-select/pull/3436) Allow Node as placeholder [@eemeli](https://github.com/eemeli). + +## v2.4.2 / 2019-03-11 + +### Bug fixes + +- [#3446](https://github.com/JedWatson/react-select/pull/3446) Fix bug with select input value not being selectable. Thanks [kangweichan](https://github.com/kangweichan). +- [#3445](https://github.com/JedWatson/react-select/pull/3446) Fix accessibility bug. Disabled options are now focusable and announced by screen-readers but not selectable. Thanks [sarahbethfederman](https://github.com/sarahbethfederman). + +## Updates + +- Fixed typo in style docs. Thanks [thiagodebastos](https://github.com/thiagodebastos). +- [#3460](https://github.com/JedWatson/react-select/pull/3460) Added description for actionTypes to docs. Thanks [mikekellyio](https://github.com/mikekellyio) + +## v2.4.1 / 2019-02-18 + +### Bug fixes + +- [#3432](https://github.com/JedWatson/react-select/pull/3432) Fix bug with select menu's not working on mobile. + +## v2.4.0 / 2019-02-15 + +### Bug fixes + +- [#3427](https://github.com/JedWatson/react-select/pull/3427) remove focusOption() invocation on ENTER press if the menu is not open. +- [#3402](https://github.com/JedWatson/react-select/pull/3402) fix menu scroll being reset on focus of a select with an open menu in ie11. See [#3342](https://github.com/JedWatson/react-select/issues/3342) for details. Thanks [timothypage](https://github.com/timothypage) +- [#3420](https://github.com/JedWatson/react-select/pull/3420) fixed select menu being opened on click, when openMenuOnClick is false. Thanks [caleb](https://github.com/caleb) and [rscotten](https://github.com/rscotten) +- [#3419](https://github.com/JedWatson/react-select/pull/3419) fixed bug with ScrollCaptor operating on an undefined scrollTarget. Thanks [iulian-radu-at](https://github.com/iulian-radu-at) +- [#3411](https://github.com/JedWatson/react-select/pull/3411) fix bug where Enter key press on select with a closed menu wouldn't propagate up. Resolves [#2217](https://github.com/JedWatson/react-select/issues/2217). +- [#3407](https://github.com/JedWatson/react-select/pull/3407) remove unnecessary aria-roles from menu and options. This is now all handled by our aria-live implementation. Resolves [#3355](https://github.com/JedWatson/react-select/issues/3355). Thanks [sarahbethfederman](https://github.com/sarahbethfederman). +- [#3393](https://github.com/JedWatson/react-select/pull/3393), fix aria live announcement text for removing a selected option. Thanks [msharkeyiii](https://github.com/msharkeyiii). +- [#3350](https://github.com/JedWatson/react-select/pull/3350) Updated to 0.91 of flow. Updated types to pass stricter type checking, in later versions of flow. Thanks [DragonWW](https://github.com/DragorWW) + +### Updates + +- [#3370](https://github.com/JedWatson/react-select/pull/3370) Updated memoize-one dependency to 5.0.0. Thanks [adam187](https://github.com/adam187) +- [#3366](https://github.com/JedWatson/react-select/pull/3366/files) Update build tooling, to leverage babel 7. Thanks [DragonWW](https://github.com/DragorWW) + +## v2.3.0 / 2019-01-18 + +### Bug fixes + +- [#3315](https://github.com/JedWatson/react-select/pull/3315) add RAF call to Collapse component getRef() such that getBoundingClientRect() is invoked consistently. +- [#3275](https://github.com/JedWatson/react-select/pull/3275/files) wrap String invocation around inputValue to avoid calling toLowerCase on invalid elements. thanks [tavareshenrique](https://github.com/tavareshenrique) +- [#3357](https://github.com/JedWatson/react-select/pull/3357), fix loadOptions call in Async select to always pass in a string for the inputValue. +- [#3346](https://github.com/JedWatson/react-select/pull/3346) Revert work done in CSP nonce PR [#3260](https://github.com/JedWatson/react-select/pull/3260) to unblock react-select usage in an SSR setting. Users who need nonce support still, please pin your version of react-select at 2.2.0. Nonce support will be re-added in 3.0.0 along with an upgrade to emotion 10; which includes nonce support without having to provide a custom emotion instance. + +### Features + +- [#3115](https://github.com/JedWatson/react-select/pull/3115) menu-is-open modifier added to control class when the menu is open. [@s20lee](https://github.com/s20lee) + +## v2.2.0 / 2018-12-28 + +### Bug Fixes + +- [#3296](https://github.com/JedWatson/react-select/pull/3296) Fix for tab interactions when in composition mode with an IME. Thanks [yshr446](https://github.com/yshr446) for the PR. +- [#3302](https://github.com/JedWatson/react-select/pull/3302) Fix to breaking android and mobile safari touch bug [#2755](https://github.com/JedWatson/react-select/issues/2755), by adding more conscientious checks to the onTouchStart and onTouchMove listeners. Thanks [xakep139](https://github.com/xakep139) for the PR. +- [#3303](https://github.com/JedWatson/react-select/pull/3303) Input and GroupHeading components now get passed the selectProps prop, thanks [maxmarchuk](https://github.com/maxmarchuk) for the PR. +- [#3260](https://github.com/JedWatson/react-select/pull/3260) As a result of the CSP nonce support feature, the emotion instance is now cached and passed down to all internal components, meaning that users looking to heavily customise their Select components can do so without externally importing emotion, and nonce instances are respected per select instance. Please see [this segment](https://react-select.com/styles#cx-and-custom-components) in the docs for a more detailed explanation. +- [#3299](https://github.com/JedWatson/react-select/pull/3299) fix to assistive text on menu open. + +### Feature + +- [#3260](https://github.com/JedWatson/react-select/pull/3260) Add CSP nonce support to Select, thanks [Avaq](https://github.com/Avaq) and [Andarist](https://github.com/Andarist) for the heavy lifting. + +## v2.1.2 / 2018-11-22 + +### Bug fixes + +- [#3161] Initialize state with `inputValue` when `defaultOptions` is true in AsyncSelect, resolves [#3160](https://github.com/JedWatson/react-select/issues/3160), thanks [@cutterbl](https://github.com/cutterbl) +- [#3096] Placeholder component now also receives the isFocused state value as a prop. Thanks [@Nelrohd](https://github.com/Nelrohd) +- [#3060] Fix bug where trying to set the cursor somewhere in an input value would close the menu. Thanks [@stijndeschuymer](https://github.com/stijndeschuymer) +- [#3163] Fixed bug where isDisabled wasn't being reflected onto the DummyInput, which meant that disabled non searchable selects were still focusable. Thanks [@gm0t](https://github.com/gm0t) +- [#3216] Fixes bug where clearing with backspace in a single select would result in an empty array, as opposed to the expected empty object. Thanks [@IanVS](https://github.com/IanVS) +- [#3013] Fixes bug where the menu would close on trying to scroll using the scroll bar in IE11. Thanks [@rakid](https://github.com/rakid) + +### Misc + +- A big shoutout to everyone who helped contribute to the docs. In no particular order [@acrawford13](https://github.com/JedWatson/react-select/commits?author=acrawford13), [@kirillku](https://github.com/kirillku), [@ajaymathur](https://github.com/ajaymathur), [@mgalgs](https://github.com/mgalgs), [@cutterbl](https://github.com/cutterbl), [@JonathanWbn](https://github.com/JonathanWbn), [@mwood23](https://github.com/mwood23), [@stevemao](https://github.com/stevemao), [@jossmac](https://github.com/jossmac), and anyone else I've missed. +- Thanks to [@IanVS](https://github.com/IanVS) for cleaning up our cypress tests. + +## v2.1.1 / 2018-10-24 + +### Bug fixes + +- [#3132] Strip theme props from default Input and GroupHeading components, as they were polluting the DOM. +- [#3131] Add support for the 'Delete' key in the internal onKeyDown method. Same functionality as 'Backspace'. +- [#3100] Update flow-types and normalised default prop declarations in indicators. Thanks [iseredov](https://github.com/iseredov) + +### Updates + +- [#3083] Added sideEffects property to package.json to support tree-shaking in webpack 4.x. Thanks [SimenB](https://github.com/SimenB). +- [#3078] Update jest dependency to 23.6.0. Thanks [papandreou](https://github.com/papandreou) +- [#3065] Update babel-plugin-emotion to 9.2.10. Thanks [mtzhang](https://github.com/mtzhang) +- [#3108] Update docs to include instructions for replicating the simple-value use case within react-select v2. Thanks [elboletaire](https://github.com/elboletaire) + +## v2.1.0 / 2018-10-03 + +- [#2839] Added support for theming via theme prop. Thanks [akx](https://github.com/akx) +- [#2874] Fixed flow-types of MultiValue components. Thanks [mike1808](https://github.com/mike1808) +- [#2903] Fix missing form input when there isn't a selected value. Thanks [alvinsj](https://github.com/alvinsj) +- [#2934] Reduced theme colors to a sane value set to make the exported theme more easy to consume and configure. Thanks [jossmac](https://github.com/jossmac) +- [#2876] Added overflow hidden to valueContainer to stop overflowing text in the control. Thanks [mike1808](https://github.com/mike1808) +- [#2975] Separated menu placement logic from menu primitive. Thanks [jossmac](https://github.com/jossmac). + +## v2.0.0 / 2018-07-23 + +- async select now accepts a filterOptions function as a prop [#2822](https://github.com/JedWatson/react-select/pull/2822) +- [BREAKING] react-select now exports react-select.esm.js from dist instead of react-select.es.js [#2641](https://github.com/JedWatson/react-select/pull/2641) +- [BREAKING] innerRef assignments in custom components must now be made from the root of the prop object, as opposed to reaching into innerProps. This is part of the work to normalize the behaviour circa custom components. [#2824](https://github.com/JedWatson/react-select/pull/2824) +- className and classNamePrefix deprecation warning and backward compatibility removed. className now only affects the select container, classNamePrefix prefixes all internal components. [#2820](https://github.com/JedWatson/react-select/pull/2820) +- Added `closeMenuOnScroll` prop, which can either be a `boolean` or a `function`, if set to `true` the select menu will close on scroll of the document/body. If a function is supplied, it must take the following shape `(event: ScrollEvent) => boolean`, the boolean value will be used to resolve whether the menu should be closed or stay open. [#2809](https://github.com/JedWatson/react-select/pull/2809), thanks [Vynlar](https://github.com/Vynlar) for this. +- Added fix to support IME inputs. [#2767](https://github.com/JedWatson/react-select/pull/2767), thanks [shamabe](https://github.com/shamabe) +- Removed primitives, and normalise multi-value components to be in line with existing component customisation patterns. [#2821](https://github.com/JedWatson/react-select/pull/2821) +- Normalised isOptionDisabled to be inline with its sibling prop isOptionSelected. [#2821](https://github.com/JedWatson/react-select/pull/2695) Thanks [SimeonC](https://github.com/SimeonC) +- [#2814](https://github.com/JedWatson/react-select/pull/2814) Added memoization to custom components within Select.js as well as in the exported makeAnimated factory method. Thanks to [Alex Reardon's](https://github.com/alexreardon) [memoize-one](https://github.com/alexreardon/memoize-one) +- [#2652](https://github.com/JedWatson/react-select/pull/2652), Async Select now re-evaluates defaultOptions on componentWillReceiveProps. Thanks [jesstelford](https://github.com/jesstelford) + +## v2.0.0-beta.7 / 2018-07-03 + +- Removed old aria-attributes in Option, MenuList and other components in favor of an aria-live-region implementation. `screenReaderStatus` prop is still at the moment untouched, and `aria-labelledby` and `aria-label` props are still available and retain their functionality. See [#2581](https://github.com/JedWatson/react-select/pull/2581). +- Internal ref `input` is now `inputRef` for consistency. +- Internal ref `menuRef` is now `menuListRef` for consistency. +- Fixed bug with MultiValueRemove interaction not working in mobile [#2762](https://github.com/JedWatson/react-select/pull/2762), thanks [chuckbergeron](https://github.com/chuckbergeron). +- Added makeAnimated function export, that takes passed in components and wraps them in higher order components that expose animated functionality. [#2724](https://github.com/JedWatson/react-select/pull/2724) +- Added functionality to not render the menu if `noOptionsMessage` or `loadingMessage` are set to null. [#2754](https://github.com/JedWatson/react-select/pull/2754) +- Fixed bug with mobile menu being blocked when `menuShouldBlockScroll` is true. + [#2756](https://github.com/JedWatson/react-select/pull/2756) +- Enabled hideSelectedOptions functionality for single-select as well. Changed logic so that if isMulti is true and hideSelectedOptions is not defined, we will hide selected options by default. Explicitly setting hideSelectedOptions will override this behaviour. https://github.com/JedWatson/react-select/pull/2753 +- Updates to flow types, thanks [mike1808](https://github.com/mike1808), [himerus](https://github.com/himerus), + [teamable-software](https://github.com/teamable-software) and +- Bumped internal flow-bin dependency to 0.72.0, [#2646](https://github.com/JedWatson/react-select/pull/2646) thanks [lunij](https://github.com/lunij) +- Fixed [#2701](https://github.com/JedWatson/react-select/issues/2701), use of un-polyfilled array.includes() in Select.js, this has now been subbed out for a IE compatible implementation. +- [#2733](https://github.com/JedWatson/react-select/issues/2733), fixed classname bug to do with prefixing classes with modifiers. +- [#2723](https://github.com/JedWatson/react-select/issues/2732), fixed emotion compilation bug blocking loadingDot rendering. +- [#2749](https://github.com/JedWatson/react-select/pull/2749) fixed typo in docs. thanks [JuhQ](https://github.com/juhq) +- [#2717](https://github.com/JedWatson/react-select/pull/2717) added selected value to onChange to accommodate multi-select, thanks [SimeonC](https://github.com/simeonc) + +## v2.0.0-beta.6 / 2018-05-23 + +- Fixed bug with `css` attribute being wrongly applied to a DOM element in SingleValue. Thanks [guigs](http://github.com/guigs) +- Added `removedValue` to the `actionMeta` of the `remove-value` action that's passed into the `onChange` prop. +- Reverted previous change of `innerRef` in `innerProps` of custom Components to `ref`. The property is now once again named `innerRef`. This is mostly to resolve issues with styled-components not passing `ref` down to wrapped dom elements, however this is also a safer pattern to apply as it requires users providing their own custom components to explicitly associate the passed down ref with the requisite dom element. +- selectValue now filters items based on the getOptionValue method. Thanks (inv8der)[http://github.com/inv8der] +- Added `createOptionPosition` to creatable select to allow users to specify where the createOption element appears in the menu. +- Added touch handling logic to detect user intent to scroll the page when interacting with the select control. + +## v2.0.0-beta.5 / 2018-05-18 + +- Added `controlShouldRenderValue` prop, defaults to true. Setting it to false disables rendering values in the control. Thanks[Joss Mackison](http://github.com/jossmac) + +## v2.0.0-beta.4 / 2018-05-15 + +- Fixed bug where transition props were being spread onto the DummyInput causing react warnings in the console. Thanks [Mike Gardner](https://github.com/MikeLimeRocket) + +## v2.0.0-beta.3 / 2018-05-14 + +**Note**: There is an important change in this release to the behaviour of `className`. + +Previously, `className` would control the class names applied to internal components +as well as the containing element. Now, the `className` prop only controls the class +name of the containing element, and the new prop `classNamePrefix` controls classes +applies to internal components. + +Until 2.0.0 final is released, we have added backwards compatibility and a deprecation +warning to cover this change. + +- Added `classNamePrefix` prop, which now controls the class names applied to internal components +- Refactored cx internal implementation to reduce specificity of css-in-jss base styles. +- `maxValueHeight` prop removed +- Added `--is-disabled` className modifier to Option component, thanks [eemeli](https://github.com/eemeli) +- Fixed various IE11 issues, see [#2583](https://github.com/JedWatson/react-select/issues/2583) +- Added multi-value keyboard navigation using left and right arrows. +- Simplified flow distribution, thanks [falconmick](https://github.com/falconmick) +- Added fix to ensure focus is on the Input when the menu opens + +## v2.0.0-beta.2 / 2018-04-25 + +- Switched from glam to [emotion](https://emotion.sh) for css-in-js +- Input colour can now be changed +- Use of React 16 Fragment removed, 2.0.0 should work with React 15 +- SSR support improved +- Indicator icons are now exported + +## v2.0.0-beta.1 / 2018-04-20 + +- Added `tabIndex` prop +- Added `classNames` prop +- Added upgrade guide from v1 --> v2 +- Fixed bug with overflowing long values in the control +- Fixed ie11 bug to do with absolutely positioned children in flex parent. +- Documentation ie11, styling and copy improvements + +## v2.0.0-alpha.11 / 2018-04-12 + +Minor fix since last alpha: + +- Fixed a flow type issue that was causing issues for consumers + +## v2.0.0-alpha.10 / 2018-04-10 + +Minor fix since last alpha: + +- Fixed an issue with `dist/react-select.es.js` where `babelHelpers` weren't defined + +## v2.0.0-alpha.9 / 2018-04-10 + +Ongoing rewrite. Major changes since last alpha: + +- Added `openMenuOnClick` and `openMenuOnFocus` props +- Significant test coverage and documentation improvements +- Added `onMenuScrollToTop` and `onMenuScrollToBottom` event props +- `scrollMenuIntoView` prop renamed `menuShouldScrollIntoView` +- `onKeyDown` now based on event.key not event.keyCode +- Component ids no longer have double separators +- Fixed a Firefox bug with `position: absolute` and `display: flex` +- Added support for fixed position menu and scroll blocking +- Fixed issue with transition group props being passed to child components +- Fixed issue with portalled menu display when `menuPlacement="top"` + +## v2.0.0-alpha.8 / 2018-02-20 + +Ongoing rewrite. Major changes since last alpha: + +- Made `focus` and `blur` methods work consistently when composing HOCs +- Added `menuPortalTarget` prop which portals the menu, with a `MenuPortal` component and `menuPortal` style key +- Allow the `MultiValueRemove` component children to be changed +- Lots of new tests, updates to documentation and examples + +## v2.0.0-alpha.7 / 2018-02-14 + +Ongoing rewrite. Major changes since last alpha: + +- Significantly improved touch and mobile support +- New positioning behaviour for the Menu +- Added `scrollMenuIntoView` prop, which does exactly what you'd expect +- Added action meta to the `onInputChange` event handler arguments +- `Creatable` Component Added +- `AsyncCreatable` Component Added +- Fixed an issue with the layout that would trigger a Firefox repaint bug +- Improved behaviour when the `isDisabled` prop value is changed +- The `IndicatorSeparator` isn't rendered when there is no `DropdownIndicator` +- Converted `StateManager` to a higher order component +- New website, docs, and more tests! (still WIP) +- Examples can now be launched in CodeSandbox, thanks to [Ben Conolly](https://github.com/noviny) + +## v2.0.0-alpha.6 / 2018-02-14 + +Ongoing rewrite. Major changes since last alpha: + +- `menuIsOpen`, `inputValue` and `value` are now controllable props that default to internal state +- Fixed missing loading indicator +- Added "open in code sandbox" to all examples +- Switched menu rendering from li to div tags for better screen reader usability +- Removed unused primitives and simplified indicator components +- Improved accessibility of groups and options, cleaned up Group implementation +- Fixed some input alignment issues +- Added right-to-left support with `isRtl` prop +- Support blocking page scroll at menu boundaries with `captureMenuScroll` prop +- Added automatic menu flipping at window boundaries with `menuPlacement` and `menuShouldFlip` props +- Added `isSearchable` prop to support simple (not searchable) select inputs +- Added `pageSize` prop + +## v2.0.0-alpha.5 / 2018-02-07 + +Ongoing rewrite. Major changes since last alpha: + +- Fixed an issue where animated values would show ellipsis while leaving +- Long single values are now also correctly truncated + +## v2.0.0-alpha.4 / 2018-02-06 + +Ongoing rewrite. Major changes since last alpha: + +- Added support for Promises in the Async component +- Added `setValue` method on the Select class +- More consistent use of `innerProps` for internal components +- Internal components are now provided a consistent set of props and API +- Improved handling of keyboard and mouse interaction for options in the menu +- Default filtering behaviour now has parity with v1 +- New `createFilter` method lets you customise the filter options +- Some unnecessary components have been removed for better performance +- Long values are now truncated + +## v2.0.0-alpha.3 / 2018-02-02 + +Ongoing rewrite. Major changes since last alpha: + +- Added `getOptionValue`, `getOptionLabel` and `formatOptionLabel` props +- Added `isOptionSelected` and `isOptionDisabled` props +- Added `name` and `delimiter` props to support hidden html inputs for forms +- Added `loadingMessage`, `noOptionsMessage` and `screenReaderStatus` props so messages can be customised +- Customisable components are now passed `innerProps` for simpler implementation +- Cleaned up internal Components and made sure they can all be styled +- Implemented customisable filtering function with support for case and diacritics +- Fixed various css bugs and vendor prefixing issues +- Accessibility improvements + +## v2.0.0-alpha.2 / 2018-01-25 + +Ongoing rewrite. Major changes since last alpha: + +- `Async` component added +- `styles` prop added to Select component +- `isLoading` prop to Select component and new indicator added +- Support added for disabled options +- Internal components cleaned up +- Cypress tests added +- CSS class names added to default components +- Accessibility improvements + +## v2.0.0-alpha.1 / 2018-01-12 + +Complete rewrite, docs and upgrade notes on changes from v1 to come later. + +## v1.2.1 / 2018-01-13 + +- Fixed blocking the Del key when deleteRemoves is false, thanks [Nachtigall, Jens (init)](https://github.com/jnachtigall) - [see PR](https://github.com/JedWatson/react-select/pull/2291) +- Fixed inline-block rendering for arrowRenderer without autosize, thanks [Harry Kao](https://github.com/harrykao) - [see PR](https://github.com/JedWatson/react-select/pull/2276) +- Fixed dropdown menu positioning issues in IE 11, thanks [jharris4](https://github.com/jharris4) - [see PR](https://github.com/JedWatson/react-select/pull/2273) +- Added missing rule to the `scss` stylesheet, thanks [Jordan Whitfield](https://github.com/mantissa7) - [see PR](https://github.com/JedWatson/react-select/pull/2280) + > > > > > > > master + +## v1.2.0 / 2018-01-08 + +- Source cleanup, thanks to [Yuri S](https://github.com/yuri-sakharov) and + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2262) +- Switched from babel-preset-es2015 to babel-preset-env, thanks + [Rambabu Yadlapalli](https://github.com/RamYadlapalli) - + [see PR](https://github.com/JedWatson/react-select/pull/2254) +- Fixed focused option. Issue #2237, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2245) +- Fix onSelectResetsInput bug from keyboard navigation, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2259) +- Fixed all warnings on running tests, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2231) +- Added missing tests for Option.js and refactored Option-test.js., thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2249) +- Added missing tests for Async.js, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2250) +- Fixed console error in GitHub users example, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2244) +- Fixed readme example. Issue #2235, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2246) +- Regression fix for single select with onSelectResetsInput=false, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2226) +- Pass placeholder prop to ValueComponent, thanks + [Aravind Srivatsan](https://github.com/aravindsrivats) - + [see PR](https://github.com/JedWatson/react-select/pull/2225) +- Refactored handleKeyDown switch, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2228) +- onSelectResetsInput regression fixed, thanks + [Jed Watson](https://github.com/dehamilton) - + [see PR](https://github.com/JedWatson/react-select/pull/2215) +- Don't open drop down menu when clear values, thanks + [Jed Watson](https://github.com/Chopinsky) - + [see PR](https://github.com/JedWatson/react-select/pull/2198) +- Clear input value on receiving props with another value., thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2183) +- Fix/is option unique crash, thanks [Jacob Zuo](https://github.com/Chopinsky) - + [see PR](https://github.com/JedWatson/react-select/pull/2185) +- Use react-input-autosize v2.1.2 for guard against undefined window, thanks + [DStyleZ](https://github.com/sximba) - + [see PR](https://github.com/JedWatson/react-select/pull/2187) +- Fix issue #2182, thanks [Kurt Hoyt](https://github.com/kurtinatlanta) - + [see PR](https://github.com/JedWatson/react-select/pull/2213) +- Documenting behavior of onBlurResetsInput in the readme., thanks + [hobbsl](https://github.com/levininja) - + [see PR](https://github.com/JedWatson/react-select/pull/2212) +- Use onSelectResetsInput for single select, thanks + [lachiet](https://github.com/lachiet) - + [see PR](https://github.com/JedWatson/react-select/pull/2205) +- Fix state value in README example, thanks + [Srishan Bhattarai](https://github.com/srishanbhattarai) - + [see PR](https://github.com/JedWatson/react-select/pull/2192) +- document breaking change of removing getInputValue, thanks + [Turadg Aleahmad](https://github.com/turadg) - + [see PR](https://github.com/JedWatson/react-select/pull/2195) +- Fixed search for invalid label and/or value, thanks + [Yuri S](https://github.com/yuri-sakharov) - + [see PR](https://github.com/JedWatson/react-select/pull/2179) + +## v1.1.0 / 2017-11-28 + +- added; more props are passed to the Option component: `focusOption`, + `inputValue`, `selectValue`, `removeValue` +- added; the `inputValue` is passed as the third argument to the + `optionRenderer` +- fixed; issues opening the menu correctly for multiselect when + `autosize={false}` +- fixed; removed `event.stopPropagation()` from Select's `clearValue` and + `onClick` handlers, thanks [Thomas Burke](https://github.com/etburke) +- fixed; `handleMouseDownOnArrow` when `openOnClick={false}`, thanks + [elias ghali](https://github.com/elghali) +- fixed; conditional scrolling into view of focused option, thanks + [Michael Lewis](https://github.com/mtlewis) + +## v1.0.1 / 2017-11-24 + +- reintroduced source files for scss and less stylesheets into the npm package + +## v1.0.0 / 2017-11-23 + +- breaking; removed `getInputValue` function - + [see PR](https://github.com/JedWatson/react-select/pull/2108) +- reverted spacebar-selects-option behaviour for searchable selects, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2163) +- fixed behaviour where async doesn't handle onInputChange returning a value, + thanks [Anton](https://github.com/tehbi4) - + [see PR](https://github.com/JedWatson/react-select/pull/2133) +- fixed Creatable bug where the first enter keypress is ignored when + `promptTextCreator` returns only the label, thanks + [George Karagkiaouris](https://github.com/karaggeorge) - + [see PR](https://github.com/JedWatson/react-select/pull/2140) +- Utility functions are now exported from the es6 build, thanks + [Deiru](https://github.com/Deiru2k) - + [see PR](https://github.com/JedWatson/react-select/pull/2154) +- Update aria-only class to have absolute positioning, thanks + [Jacob Hilker](https://github.com/JHilker) - + [see PR](https://github.com/JedWatson/react-select/pull/1243) +- gives possibility to use ref property for Creatable, thanks + [blacktemplar](https://github.com/blacktemplar) - + [see PR](https://github.com/JedWatson/react-select/pull/1646) +- Adds lint and test pre-commit hooks, thanks + [carymcpoland](https://github.com/mcpolandc) - + [see PR](https://github.com/JedWatson/react-select/pull/2077) +- Disable some browser-specific behaviours that break the input, thanks + [Jed Watson](https://github.com/JedWatson) - + [see PR](https://github.com/JedWatson/react-select/pull/2101) +- onOpen: run after dom has rendered, thanks + [Karl-Aksel Puulmann](https://github.com/macobo) - + [see PR](https://github.com/JedWatson/react-select/pull/#1756) +- fix not clearing when given invalid values, from #1756, thanks + [Mário][https://github.com/ticklemynausea] - + [see PR](https://github.com/JedWatson/react-select/pull/2100) +- Exports Option Component, thanks + [Erkelens, Jan Paul](https://github.com/jperkelens) - + [see PR](https://github.com/JedWatson/react-select/pull/2097) +- Fix/numeric multi select, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2086) +- removeSelected prop (round 2), for optionally keeping selected values in + dropdown, thanks [Jed Watson](https://github.com/banderson) - + [see PR](https://github.com/JedWatson/react-select/pull/1891) +- pass removeValue() and always pass valueArray, thanks + [kcliu](https://github.com/kcliu) - + [see PR](https://github.com/JedWatson/react-select/pull/1850) +- Accessibility Enhancements - Aria tags, Space/Enter keys, thanks + [sushmabadam](https://github.com/sushmabadam) - + [see PR](https://github.com/JedWatson/react-select/pull/1428) +- added rtl support, thanks [Dekel](https://github.com/dekelb) - + [see PR](https://github.com/JedWatson/react-select/pull/1613) +- Add inputValue to menuRenderer, thanks + [headcanon](https://github.com/chronick) - + [see PR](https://github.com/JedWatson/react-select/pull/1732) +- fix typo in handleKeyDown method, thanks + [jasonchangxo](https://github.com/jasonchangxo) - + [see PR](https://github.com/JedWatson/react-select/pull/2088) +- Fix/numeric multi select, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2086) +- expose children in AsyncCreatable.js, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2084) +- replace trim fn loop with regex, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2085) +- Trim search text from beginning and the end. (fixes #1861), thanks + [Serkan Ozer](https://github.com/serkanozer) - + [see PR](https://github.com/JedWatson/react-select/pull/1862) +- Add variable for focused input background, thanks + [Aron Strandberg](https://github.com/aronstrandberg) - + [see PR](https://github.com/JedWatson/react-select/pull/1998) +- Added id in the input select, thanks + [thecreazy](https://github.com/thecreazy) - + [see PR](https://github.com/JedWatson/react-select/pull/2027) +- adding a nvmrc file and adding coverage to eslintignore, thanks + [Dave Birch](https://github.com/uxtx) - + [see PR](https://github.com/JedWatson/react-select/pull/1137) +- Updated the comment for the deleteRemoves option., thanks + [Abul Dider](https://github.com/dider7) - + [see PR](https://github.com/JedWatson/react-select/pull/2078) +- implemented optional rendering of arrow, thanks + [rolandjohann](https://github.com/rolandjohann) - + [see PR](https://github.com/JedWatson/react-select/pull/1761) +- Skip rendering arrow wrapper when custom arrow renderer returns falsy value, + thanks [Mike Lewis](https://github.com/mtlewis) - + [see PR](https://github.com/JedWatson/react-select/pull/2055) +- do not show clear button if value is an empty string, thanks + [Marie Godon](https://github.com/mariegodon) - + [see PR](https://github.com/JedWatson/react-select/pull/2074) +- Set isLoading to false if cache hit, thanks + [timhwang21](https://github.com/timhwang21) - + [see PR](https://github.com/JedWatson/react-select/pull/2042) +- Add aria-labels to Options, thanks + [jasonchangxo](https://github.com/jasonchangxo) - + [see PR](https://github.com/JedWatson/react-select/pull/2036) +- Adds source links to each example, thanks + [Damon Bauer](https://github.com/damonbauer) - + [see PR](https://github.com/JedWatson/react-select/pull/2051) +- Issue #2056: onInputChange should return modified value, thanks + [Caleb Scholze](https://github.com/cscholze) - + [see PR](https://github.com/JedWatson/react-select/pull/2057) +- Remove option `addLabelText` from README and propTypes, thanks + [Jannes Jeising](https://github.com/jjeising) - + [see PR](https://github.com/JedWatson/react-select/pull/2040) +- GitHub has a capital H, thanks + [David Baumgold](https://github.com/singingwolfboy) - + [see PR](https://github.com/JedWatson/react-select/pull/2053) +- refactor componentWillUnmount(), thanks + [riophae](https://github.com/riophae) - + [see PR](https://github.com/JedWatson/react-select/pull/2064) +- Slim down NPM package, thanks [Valentin Agachi](https://github.com/avaly) - + [see PR](https://github.com/JedWatson/react-select/pull/2062) +- Update contributing doc, thanks [Gregg Brewster](https://github.com/greggb) - + [see PR](https://github.com/JedWatson/react-select/pull/2059) +- strip proptypes in production build (fixes #1882), thanks + [Jochen Berger](https://github.com/jochenberger) - + [see PR](https://github.com/JedWatson/react-select/pull/2003) +- Support Webpack 2, Webpack 3, rollup., thanks + [Matthew Schnee](https://github.com/mschnee) - + [see PR](https://github.com/JedWatson/react-select/pull/2020) +- Add missing semicolon, thanks + [jochenberger](https://github.com/jochenberger) - + [see PR](https://github.com/JedWatson/react-select/pull/2018) +- autofocus --> autoFocus, thanks + [Charles Lee](https://github.com/gwyneplaine) - + [see PR](https://github.com/JedWatson/react-select/pull/2002) +- Async> cache async response regardless of req order, thanks + [Timothy Hwang](https://github.com/timhwang21) - + [see PR](https://github.com/JedWatson/react-select/pull/2012) +- Make this work in preact., thanks [liaoxuezhi](https://github.com/2betop) - + [see PR](https://github.com/JedWatson/react-select/pull/2013) +- Correct release candidate version on README, thanks + [Damon Aw](https://github.com/daemonsy) - + [see PR](https://github.com/JedWatson/react-select/pull/2017) +- Fix test name, thanks [jochenberger](https://github.com/jochenberger) - + [see PR](https://github.com/JedWatson/react-select/pull/2005) +- Fixing css states to be scoped with Select selector, closes #1951., thanks + [Adam Girton](https://github.com/agirton) - + [see PR](https://github.com/JedWatson/react-select/pull/2000) +- fix typo, thanks [jochenberger](https://github.com/jochenberger) - + [see PR](https://github.com/JedWatson/react-select/pull/1999) + +## v1.0.0-rc.10 / 2017-09-13 + +- changed; `openAfterFocus` prop has been renamed to `openOnClick`, and now + defaults to `true` +- fixed; React.PropTypes deprecation warning, thanks + [Jeremy Liberman](https://github.com/MrLeebo) +- improved; scrolling behaviour when navigating the menu with the keyboard, + thanks [boatkorachal](https://github.com/boatkorachal) +- fixed; error with the `Async` cache when you type `"hasOwnProperty"`, thanks + [SuhushinAS](https://github.com/SuhushinAS) + +## v1.0.0-rc.9 / 2017-09-13 + +- fixed; clearable padding style, thanks + [Minori Miyauchi](https://github.com/mmiyauchi) +- fixed; removed use of `Object.assign`, fixes IE compatibility +- added; new `closeOnSelect` prop (defaults to `true`) that controls whether the + menu is closed when an option is selected, thanks to + [Michael Elgar](https://github.com/melgar) for the original idea +- changed; by default, the menu for multi-selects now closes when an option is + selected +- changed; `Async` component no longer always clears options when one is + selected (although the menu is now closed by default). Use + `closeOnSelect={false} onSelectResetsInput={false}` to leave the menu open. +- fixed; `Async` component always called `onChange` even when it wasn't provided +- fixed; input lag for the `Async` component when results are returned from + cache +- fixed; required was not being updated without an onChange handler +- fixed; peer dependencies for `prop-types`, thanks + [Michaël De Boey](https://github.com/MichaelDeBoey) +- fixed; internal optimisations, thanks + [Kieran Boyle](https://github.com/dysfunc) +- added; `Value` component is now exported, thanks + [Prof Gra](https://github.com/Grahack) +- fixed; callback fired after `Async` component unmounts, thanks + [Andrew Russell](https://github.com/DeadHeadRussell) +- fixed; wrapping on Firefox in SCSS files, thanks + [Michael Williamson](https://github.com/mwilliamson) + +## v1.0.0-rc.8 / 2017-09-12 + +- fixed; `onMenuScrollToBottom` does not work in chrome 58.0, thanks + [Simon Hartcher](https://github.com/deevus) +- fixed; missing es6 module build for `js:next` entrypoint +- updated; `react-input-autosize@2.0.0` including several fixes for react-select + (see + [changes](https://github.com/JedWatson/react-input-autosize/blob/master/HISTORY.md)) + +## v1.0.0-rc.7 / 2017-09-11 + +- fixed; issue with `lib` build preventing use in ES2015 environments + +## v1.0.0-rc.6 / 2017-09-10 + +- fixed; changing `required` prop from `true` to `false` now works as expected, + thanks [George Karagkiaouris](https://github.com/karaggeorge) +- added; new prop `onSelectResetsInput` controls whether the input value is + cleared when options are selected, thanks + [David Roeca](https://github.com/davidroeca) and + [Alexander Nosov](https://github.com/nosovsh) +- fixed; tabindex parent bug fix for Edge, thanks + [George Payne](https://github.com/George-A-Payne) +- fixed; update selectize link in README.md, thanks + [kerumen](https://github.com/kerumen) +- added; standard issue template, thanks [agirton](https://github.com/agirton) +- added; new build process using rollup and webpack. Removed grunt. thanks + [gwyneplaine](https://github.com/gwyneplaine) +- fixed; updated contributor docs with the correct node version reference + [gwyneplaine](https://github.com/gwyneplaine) +- fixed; missing method binds in Option, thanks + [agirton](https://github.com/agirton) +- fixed; converted components to use es6 classes, thanks + [jochenberger](https://github.com/jochenberger) +- fixed; console.log example in usage docs, thanks + [rohmanhm](https://github.com/rohmanhm) +- fixed; hide create option after closing menu, thanks + [andreme](https://github.com/andreme) +- fixed; remove circular reference, thanks [agirton](https://github.com/agirton) +- fixed; readme typo, thanks [ieldanr](https:/github.com/ieldanr) +- fixed; add missing function binds in Option component, thanks + [agirton](https://github.com/agirton) and + [blacktemplar](https://github.com/blacktemplar) +- fixed; re-added fix to + [#1580](https://github.com/JedWatson/react-select/issues/1580), thanks + [agirton](https://github.com/agirton) +- fixed; avoid mutating user inputs when ignoring case/accents, thanks + [not-an-aardvark](https://github.com/not-an-aardvark) +- fixed; issues synchronising options props in `Async`, thanks + [cbergmiller](https://github.com/cbergmiller) +- fixed; backspace handling for non-multi select controls, thanks + [Jeremy Liberman](https://github.com/MrLeebo) + +## v1.0.0-rc.5 / 2017-05-25 + +- fixed; Allow `falsey` values to be clearable, thanks + [Simon Gaestel](https://github.com/sgaestel) +- fixed; issue where Firefox would crash due to incorrect use of `aria-owns` + attribute, thanks [Max Hubenthal](https://github.com/mhubenthal) +- fixed; regression where options not using the value key couldn't be focused, + thanks [Benjamin Piouffle](https://github.com/Betree) + +## v1.0.0-rc.4 / 2017-05-14 + +- fixed; no more warning when using React 15.5, thanks + [Adam Girton](https://github.com/agirton) +- fixed; issue comparing objects in `getFocusableOptionIndex`, thanks + [rndm2](https://github.com/rndm2) +- fixed; missing .focus() method in `Creatable`, thanks + [Anton Alexandrenok](https://github.com/the-spyke) +- added; support for `aria-describedby` attribute, thanks + [Eric Lee](https://github.com/ericj17) +- added; `.is-clearable` className when clearable is true, thanks + [Dan Diaz](https://github.com/dan-diaz) + +## v1.0.0-rc.3 / 2017-02-01 + +- added; `arrowRenderer` prop, thanks [Brian Vaughn](https://github.com/bvaughn) +- added; child-function support to `Async` and `Creatable` components so that + they can compose each other (or future HOCs), thanks + [Brian Vaughn](https://github.com/bvaughn) +- added; `asyncCreatable` HOC that combines `Async` and `Creatable` so they can + be used together, thanks [Brian Vaughn](https://github.com/bvaughn) +- added; undocumented arguments for `menuRenderer`, thanks + [Julian Krispel-Samsel](https://github.com/juliankrispel) +- fixed; Do not focus and open menu when disabled, thanks + [nhducit](https://github.com/nhducit) +- fixed; Scrolling with arrow-keys is not working correctly, thanks + [Damian Pieczynski](https://github.com/piecyk) +- added; "select all text" functionality `Shift+Home|Del`, thanks + [Damian Pieczynski](https://github.com/piecyk) +- added; support for `boolean` values, thanks + [Aaron Hardy](https://github.com/Aaronius) +- fixed; Remove duplicated `promptTextCreator` field from readme, thanks + [Jih-Chi Lee](https://github.com/jihchi) +- fixed; Adding back ref that was removed in rc2, thanks + [Martin Jujou](https://github.com/jooj123) +- fixed; `Creatable` component doesn't allow input key down handling, thanks + [Ivan Leonenko](https://github.com/IvanLeonenko) +- added; Allow react nodes to be passed as loadingPlaceholder, thanks + [Daniel Heath](https://github.com/DanielHeath) +- fixed; IE8 compatibility issues, thanks + [Kirill Mesnyankin](https://github.com/strayiker) +- improved; Allow users to specify noResultsText, thanks + [Daniel Heath](https://github.com/DanielHeath) +- added; Only remove options if a loading placeholder is available, thanks + [Daniel Heath](https://github.com/DanielHeath) +- fixed; firefox display items in two rows due to reflow, thanks + [Daniel Heath](https://github.com/DanielHeath) +- fixed; `Creatable` readme typo, thanks [Ben](https://github.com/rockingskier) +- fixed; explain way to implement `allowCreate` functionality with `Creatable` + to readme, thanks [mayerwin](https://github.com/mayerwin) +- added; delete key removes an item when there is no input, thanks + [forum-is](https://github.com/forum-is) +- added; `onNewOptionClick` handler for `Creatable`, thanks + [Lee Siong Chan](https://github.com/leesiongchan) +- fixed; `onInputChange` consistent for `Creatable`, thanks + [Lee Siong Chan](https://github.com/leesiongchan) +- fixed; `menuRenderer` is treated consistently between `Creatable` and + `Select`, thanks [Brian Vaughn](https://github.com/bvaughn) +- fixed; `asyncCreatable` options parsing will not parse undefined values into + props, thanks [Romain Dardour](https://github.com/unity) +- added; pass `inputProps` to `inputRenderer`, thanks + [Alec Winograd](https://github.com/awinograd) +- fixed; no exception when clearing an Async field that is not set to multi, + thanks [Patrik Stutz](https://github.com/VanCoding) +- added; allow rendering a custom clear component, thanks + [Conor Hastings](https://github.com/conorhastings) +- fixed; document `ignoreAccents`, thanks + [Domenico Matteo](https://github.com/dmatteo) +- fixed; arrowing up or down in `Select` with 0 options does not throw type + error, thanks [Alex Howard](https://github.com/thezanke) +- fixed; `Creatable` handles null children prop, thanks + [Jack Coulter](https://github.com/jscinoz) +- added; provide `isOpen` to arrowRenderer, thanks + [Kuan](https://github.com/khankuan) +- fixed; re-added the `focus()` method on `Select.Async`, thanks, + [Maarten Claes](https://github.com/mcls) +- fixed; focus the next available option after a selection, not the top option, + thanks [Nicolas Raynaud](https://github.com/nraynaud) + +Note there has also been a breaking change to the props for the `Async` +component: both `minimumInput` and `searchingText` have been removed. See #1226 +for more details. Apologies for doing this in an RC release, but we had to trade +off between resolving some important bugs and breaking the API, and figured it +was better to do this before declaring 1.0.0 stable. + +## v1.0.0-rc.1 / 2016-09-04 + +- fixed; reset value to `[]` when `multi=true`, thanks + [Michael Williamson](https://github.com/mwilliamson) +- added; pass index to `renderLabel` method, thanks + [nhducit](https://github.com/nhducit) +- fixed; uncontrolled to controlled component warning in React 15.3 +- fixed; props cleanup, thanks + [Forbes Lindesay](https://github.com/ForbesLindesay) +- fixed; issue where a value of the number `0` would be assumed to be no value, + thanks [Hanwen Cheng](https://github.com/hanwencheng) +- fixed; internal refs converted to callbacks instead of strings, thanks + [Johnny Nguyen](https://github.com/gojohnnygo) +- added; optional `instanceId` prop for server-side rendering, thanks + [Jevin Anderson](https://github.com/JevinAnderson) +- added; `onCloseResetsInput` prop, thanks + [Frankie](https://github.com/frankievx) +- added; `Creatable` component, replaces pre-1.0 `allowCreate` prop, thanks + [Brian Vaughn](https://github.com/bvaughn) + +## v1.0.0-beta14 / 2016-07-17 + +- fixed; `react-input-autosize` has been updated to `1.1.0`, which includes + fixes for the new warnings that React 15.2 logs +- fixed; "Unknown prop `inputClassName` on
tag" warning, thanks + [Max Stoiber](https://github.com/mxstbr) +- fixed; Removed unnecessary `onUnfocus`, thanks + [Johnny Nguyen](https://github.com/gojohnnygo) +- added; Support for react components in `searchPromptText`, thanks + [Matt](https://github.com/hellaeon) +- fixed; focus bug on iOS, thanks + [Tony deCatanzaro](https://github.com/tonydecat) +- fixed; Async bugs with Promises, thanks + [Vladimir](https://github.com/VladimirPal) and + [Ian Firkin](https://github.com/lobsteropteryx) +- fixed; `searchingText` bug, thanks + [Tony deCatanzaro](https://github.com/tonydecat) +- improved; More antive-like input behaviour, thanks + [Johnny Nguyen](https://github.com/gojohnnygo) +- fixed; Added missing unit (px) to `minWidth` attribute, thanks + [Ian Witherow](https://github.com/ianwitherow) +- added; Support for assistive technologies, thanks + [Dave Brotherstone](https://github.com/bruderstein) +- fixed; React error if `onChange` callback causes a root component to unmount, + thanks [Nathan Norton](https://github.com/Xesued) +- fixed; Open menu is now closed if `disabled` becomes true, thanks + [Jason Moon](https://github.com/jsnmoon) +- fixed; Prevent `getFocusableOptionIndex` from returning a disabled option, + thanks [Brian Powers](https://github.com/brianspowers) +- added; Home, End, Page Up/Down support, thanks + [Jason Kadrmas](https://github.com/blackjk3) +- fixed; Don't render `backspaceToRemoveMessage` if `backspaceRemoves` is set to + false, thanks [Ryan Zec](https://github.com/ryanzec) +- fixed; Issue with an outline appearing on the auto sized input, thanks + [Ryan Zec](https://github.com/ryanzec) +- fixed; Events don't propagate when `esc` is pressed, thanks + [Yoshihide Jimbo](https://github.com/jmblog) +- fixed; Update `required` prop based on nextProps on update, thanks + [Matt Shwery](https://github.com/mshwery) +- fixed; On focus check whether input ref is a real input or an input component, + thanks [Peter Brant](https://github.com/pbrant) and + [Greg Poole](https://github.com/gpoole) + +Also a big thanks to [Brian Vaughn](https://github.com/bvaughn) for his help +triaging issues for this release! + +## v1.0.0-beta13 / 2016-05-30 + +- added; `inputRenderer` prop, allows you to override the input component, + thanks [Sean Burke](https://github.com/leftmostcat) +- added; `openOnFocus` prop, causes the menu to always open when the select + control is focused, thanks + [HuysentruytRuben](https://github.com/HuysentruytRuben) +- added; `react-virtualised-select` HOC example, thanks + [Brian Vaughn](https://github.com/bvaughn) +- added; `tabSelectsValue` prop can be set to false to prevent selection of + focused option when tab is pressed, thanks + [Byron Anderson](https://github.com/byronanderson) +- added; ability to override `resetValue` when clearing the control, thanks + [Alexander Luberg](https://github.com/LubergAlexander) +- added; input can be updated with `onInputChange`, thanks + [Brett DeWoody](https://github.com/brettdewoody) +- added; Styles for .is-selected class, thanks + [Danny Herran](https://github.com/dherran) +- fixed; `noResultsText` prop type is now `stringOrNode` for Async component, + thanks [Michael Groeneman](https://github.com/mgroeneman) +- fixed; `onInputChange` is wrapped by Async component, thanks + [Eric O'Connell](https://github.com/drd) +- fixed; `scrollMenuIntoView` behaviour in IE10, thanks + [Ivan Jager](https://github.com/aij) +- fixed; isEqualNode replaced with strict equality check, thanks + [Alexandre Balhier](https://github.com/abalhier) +- fixed; issue with value object not being passed to `handleRequired`, thanks + [Andrew Hite](https://github.com/andyhite) +- fixed; the menu-outer container is no longer rendered when it does not contain + anything, thanks [Kuan](https://github.com/khankuan) +- improved; better support for IE8 in styles, thanks + [Rockallite Wulf](https://github.com/rockallite) + +## v1.0.0-beta12 / 2016-04-02 + +- added; `menuRenderer` method and example for efficiently rendering thousands + of options, thanks [Brian Vaughn](https://github.com/bvaughn) +- added; `optionClassName` prop, thanks [Max Tyler](https://github.com/iam4x) + +## v1.0.0-beta11 / 2016-03-09 + +- updated dependencies to allow use with React 15.x +- changed; multiple selected values are now submitted using multiple inputs, + thanks [Trinh Hoang Nhu](https://github.com/james4388) +- added; `joinValues` prop to revert the above change and submit multiple values + in a single field with the delimiter + +## v1.0.0-beta10 / 2016-02-23 + +- fixed build issues with v1.0.0-beta9 + +## v1.0.0-beta9 / 2016-02-12 + +- added; onBlurResetsInput prop, thanks + [Sly Bridges](https://github.com/slybridges) +- changed; Enter selects and retains focus, Tab selects and shifts focus, thanks + [RDX](https://github.com/rdsubhas) +- fixed; Hide noResultsText when value is falsy, thanks + [Fernando Alex Helwanger](https://github.com/fhelwanger) +- added; `required` prop, adds HTML5 required attribute, thanks + [Domenico Matteo](https://github.com/dmatteo) +- fixed; Touch drag behaviour, thanks + [Pavel Tarnopolsky](https://github.com/Paveltarno) +- added; `onOpen` and `onClose` event props, thanks + [Jacob Page](https://github.com/DullReferenceException) +- fixed; Pressing Enter on open Select should stop propagation, thanks + [Jeremy Liberman](https://github.com/MrLeebo) +- fixed; Missing handleMouseDownOnMenu, thanks + [Jeremy Liberman](https://github.com/MrLeebo) +- added; Ensures the selected option is immediately visible when the menu is + open, thanks [Martin Jujou](https://github.com/jooj123) +- added; `autoBlur` prop, blurs the input when a value is selected, thanks + [Pavel Tarnopolsky](https://github.com/Paveltarno) +- fixed; Several isFocused checks weren't working properly + +## v1.0.0-beta8 / 2015-12-20 + +- fixed; input focus bug when toggling `disabled` prop, thanks + [Davide Curletti](https://github.com/dcurletti) +- fixed; `focus()` is now exposed on the `Async` component, thanks + [AugustinLF](https://github.com/AugustinLF) + +## v1.0.0-beta7 / 2015-12-15 + +- You can now use React elements for placeholders and the text props, thanks + [kromit](https://github.com/kromit) and + [Alyssa Biasi](https://github.com/alyssaBiasi) +- Fixed a problem where the border doesn't show when the element is inside a + table, thanks [Rodrigo Boratto](https://github.com/rwrz) +- New prop `scrollMenuIntoView` scrolls the viewport to display the menu, thanks + [Alexander Zaharakis](https://github.com/azaharakis) +- New LESS / SCSS variable `select-option-bg` lets you control the menu option + background color, thanks [Evan Goldenberg](https://github.com/Naveg) +- Fixed an error in the blur handler on IE when the menu is not visible, thanks + [Gaston Sanchez](https://github.com/gaastonsr) +- Added support for a `clearableValue` option property in `multi` mode, thanks + [Sly Bridges](https://github.com/slybridges) + +## v1.0.0-beta6 / 2015-11-29 + +- Test suite complete and passing, with a couple of minor fixes thanks to + @bruderstein + +## v1.0.0-beta5 / 2015-11-08 + +- Fixes issues relating to serializing simple values into the hidden field + +## v1.0.0-beta4 / 2015-11-08 + +- New default styles that match [Elemental UI](http://elemental-ui.com) and look + right at home in the new [KeystoneJS Admin UI](http://keystonejs.com) + +We're potentially going to ship some theme stylesheets in the future, shout out +on GitHub if this interests you. + +## v1.0.0-beta3 / 2015-11-08 + +- The selected value populated in the hidden field has been fixed (was `"[object Object]"` before) +- Added new `autofocus` prop +- Fixed duplicate key error for options and values with duplicate `value` + properties +- SCSS variables now have `!default` so you can override them + +## v1.0.0-beta2 / 2015-11-06 + +Changed since beta 1: + +- Async options cache works again +- New style props for custom styling the component without modifying css + classes: `style` `wrapperStyle` `menuStyle` `menuContainerStyle` +- The menu opens and closes correctly when `searchable={false}`, there is still + some work to do on this use-case + +## v1.0.0-beta1 / 2015-11-06 + +This is a complete rewrite. Major changes include: + +- Everything is simpler (I'm nearly done and the source code is only 60% of the + size of the last version) +- No more timeouts or weird handlers, the restructuring has let me make + everything more straight-forward +- The options array is no longer preprocessed into state, just retrieved from + props +- The values array is now initialised in the Options array during render, and + not stored in state, which along with the change to options makes the + component more reliable and fixes issues with props not updating correctly +- The component no longer stores its own value in state (ever) - it needs to be + passed as a prop and handled with `onChange`. +- Complex values are now enabled by default (so you're passed the option object, + not its value); you can enable the legacy mode with a prop +- The Value and Option components have been cleaned up as well for consistency +- The hidden `` field is now optional and the component is better suited + to use in a rich React.js app than it was +- You can disable options filtering to do the filtering externally with + `onInputChange` +- Accents on characters can now be ignored +- The `asyncOptions` prop has been replaced by a new wrapper component: + `Select.Async` + +Note that "Tag mode" (creating options on the fly) isn't reimplemented yet. + +A full guide to the breaking changes and new features will be written up soon. +In the meantime please see the new examples. + +## v0.9.1 / 2015-11-01 + +- added; new Contributors example w/ async options loading and custom value / + label keys +- fixed; several issues with custom `valueKey` and `labelKey` props +- fixed; autoload now loads options with no search input + +## v0.9.0 / 2015-10-29 + +- added; SCSS stylesheets! +- improved; Options rendering should be more performant +- breaking change; Custom `Option` components now need to pass their `option` + prop to event handlers; see + [this commit](https://github.com/JedWatson/react-select/commit/89af12a80a972794222b193a767f44234bbe9817) + for an example of the required change. + +## v0.8.4 / 2015-10-27 + +- fixed; LESS math operations now work with --strict-math=on, thanks + [Vincent Fretin](https://github.com/vincentfretin) + +## v0.8.3 / 2015-10-27 + +- fixed; IE issue where clicking the scrollbar would close the menu, thanks + [Pete Nykänen](https://github.com/petetnt) + +## v0.8.2 / 2015-10-22 + +- added; Promise support for `loadAsyncOptions`, thanks + [Domenico Matteo](https://github.com/dmatteo) + +## v0.8.1 / 2015-10-20 + +- fixed; `loadAsyncOptions` raises TypeError in setup, see #439 for details, + thanks [Pancham Mehrunkar](https://github.com/pancham348) + +## v0.8.0 / 2015-10-19 + +This release contains significant DOM structure and CSS improvements by +@jossmac, including: + +- no more `position: absolute` for inner controls +- `display: table` is used for layout, which works in IE8 and above, and + [all other modern browsers](http://caniuse.com/#feat=css-table) +- less "magic numbers" used for layout, should fix various browser-specific + alignment issues +- clear "x" control now animates in +- clearer `.Select--multi` className replaces `.Select.is-multi` +- new height & theme variables +- "dropdown" indicator chevron is no longer displayed for multi-select controls + +There are no functional changes, but if you've forked the LESS / CSS to create +your own theme you'll want to pay close attention to PR #527 when upgrading to +this version. + +## v0.7.0 / 2015-10-10 + +React Select is updated for React 0.14. If you're still using React 0.13, please +continue to use `react-select@0.6.x`. There are no functional differences +between v0.7.0 and v0.6.12. + +Additionally, our tests now require Node.js 4.x. If you are developing +`react-select`, please make sure you are running the latest version of node. + +Thanks to @bruderstein, @dmatteo and @hull for their help getting these updates +shipped! + +## v0.6.12 / 2015-10-02 + +- added; `labelKey` and `valueKey` props, so you can now use different keys in + `option` objects for the label and value +- fixed; additional `isMounted()` checks in timeouts +- fixed; componentDidUpdate timeout is reset correctly, see #208 and #434, + thanks [Petr Gladkikh](https://github.com/PetrGlad) +- fixed; mousedown event on scrollbar in menu no longer hides it, thanks + [Yishai Burt](https://github.com/burtyish) + +## v0.6.11 / 2015-09-28 + +- added; `isLoading` prop, allows indication of async options loading in + situations where more control is required, thanks + [Jon Gautsch](https://github.com/jgautsch) + +## v0.6.10 / 2015-09-24 + +- fixed; a build issue with the previous release that prevented the stylesheet + being generated / included +- fixed; a LESS syntax issue, thanks [Bob Cardenas](https://github.com/bcardi) + +## v0.6.9 / 2015-09-19 + +- added; `style` key for package.json, thanks + [Stephen Wan](https://github.com/stephen) +- added; `onInputChange` handler that returns the current input value, thanks + [Tom Leslie](https://github.com/lomteslie) +- fixed; simplifying handleKey function & preventDefault behaviour, thanks + [davidpene](https://github.com/davidpene) +- fixed; Display spinner while auto-loading initial data, thanks + [Ben Jenkinson](https://github.com/BenJenkinson) +- fixed; better support for touch events, thanks + [Montlouis-Calixte Stéphane](https://github.com/bulby97) +- fixed; prevent value splitting on non-multi-value select, thanks + [Alan R. Soares](https://github.com/alanrsoares) + +## v0.6.8 / 2015-09-16 + +- fixed; broader range of allowed prereleases for React 0.14, including rc1 +- fixed; preventing backspace from navigating back in the browser history, + thanks [davidpene](https://github.com/davidpene) + +## v0.6.7 / 2015-08-28 + +- fixed; missing styles for `.Select-search-prompt` and `.Select-searching` + issues, thanks [Jaak Erisalu](https://github.com/jaakerisalu) and + [davidpene](https://github.com/davidpene) + +## v0.6.6 / 2015-08-26 + +- fixed; issue in Chrome where clicking the scrollbar would close the menu, + thanks [Vladimir Matsola](https://github.com/vomchik) + +## v0.6.5 / 2015-08-24 + +- fixed; completely ignores clicks on disabled items, unless the target of the + click is a link, thanks [Ben Stahl](https://github.com/bhstahl) + +## v0.6.4 / 2015-08-24 + +This release includes a huge improvement to the examples / website thanks to +@jossmac. Also: + +- added; support for React 0.14 beta3 +- fixed; disabled options after searching, thanks @bruderstein +- added; support for "Searching..." text (w/ prop) while loading async results, + thanks @bruderstein and @johnomalley +- added; `className`, `style` and `title` keys are now supported in option + properties, thanks @bruderstein + +## v0.6.3 / 2015-08-18 + +Otherwise known as "the real 0.6.2" this includes the updated build for the last +version; sorry about that! + +## v0.6.2 / 2015-08-13 + +- changed; if the `searchable` prop is `false`, the menu is opened _or closed_ + on click, more like a standard Select input. thanks + [MaaikeB](https://github.com/MaaikeB) + +## v0.6.1 / 2015-08-09 + +- added; Support for options with numeric values, thanks + [Dave Brotherstone](https://github.com/bruderstein) +- changed; Disabled options now appear in the search results , thanks + [Dave Brotherstone](https://github.com/bruderstein) +- fixed; asyncOptions are reloaded on componentWillReceiveProps when the value + has changed, thanks [Francis Cote](https://github.com/drfeelgoud) +- added; `cacheAsyncResults` prop (default `true`) now controls whether the + internal cache is used for `asyncOptions` + +## v0.6.0 / 2015-08-05 + +- improved; option, value and single value have been split out into their own + components, and can be customised with props. see + [#328](https://github.com/JedWatson/react-select/pull/328) for more details. +- improved; Near-complete test coverage thanks to the awesome work of + [Dave Brotherstone](https://github.com/bruderstein) +- improved; Support all alpha/beta/rc's of React 0.14.0, thanks + [Sébastien Lorber](https://github.com/slorber) +- fixed; Close multi-select menu when tabbing away, thanks + [Ben Alpert](https://github.com/spicyj) +- fixed; Bug where Select shows the value instead of the label (reapplying fix) +- fixed; `valueRenderer` now works when `multi={false}`, thanks + [Chris Portela](https://github.com/0xCMP) +- added; New property `backspaceRemoves` (default `true`), allows the default + behaviour of removing values with backspace when `multi={true}`, thanks + [Leo Lehikoinen](https://github.com/lehikol2) + +## v0.5.6 / 2015-07-27 + +- fixed; Allow entering of commas when allowCreate is on but multi is off, + thanks [Angelo DiNardi](https://github.com/adinardi) +- fixed; Times (clear) character is now rendered from string unicode character + for consistent output, thanks [Nibbles](https://github.com/Siliconrob) +- fixed; allowCreate bug, thanks [goodzsq](https://github.com/goodzsq) +- fixed; changes to props.placeholder weren't being reflected correctly, thanks + [alesn](https://github.com/alesn) +- fixed; error when escape is pressedn where `clearValue` was not passed the + event, thanks [Mikhail Kotelnikov](https://github.com/mkotelnikov) +- added; More tests, thanks [Dave Brotherstone](https://github.com/bruderstein) + +## v0.5.5 / 2015-07-12 + +- fixed; replaced usage of `component.getDOMNode()` with + `React.findDOMNode(component)` for compatibility with React 0.14 + +## v0.5.4 / 2015-07-06 + +- fixed; regression in 0.5.3 that broke componentWillMount, sorry everyone! +- added; `addLabelText` prop for customising the "add {label}?" text when in + tags mode, thanks [Fenn](https://github.com/Fenntasy) + +## v0.5.3 / 2015-07-05 + +- fixed; autoload issues, thanks [Maxime Tyler](https://github.com/iam4x) +- fixed; style incompatibilities with Foundation framework, thanks + [Timothy Kempf](https://github.com/Fauntleroy) + +## v0.5.2 / 2015-06-28 + +- fixed; bug where Select shows the value instead of the label, thanks + [Stephen Demjanenko](https://github.com/sdemjanenko) +- added; 'is-selected' classname is added to the selected option, thanks + [Alexey Volodkin](https://github.com/miraks) +- fixed; async options are now loaded with the initial value, thanks + [Pokai Chang](https://github.com/Neson) +- fixed; `react-input-autosize` now correctly escapes ampersands (&), not + actually a fix in react-select but worth noting here because it would have + been causing a problem in `react-select` as well. + +## v0.5.1 / 2015-06-21 + +- added; custom option and value rendering capability, thanks + [Brian Reavis](https://github.com/brianreavis) +- fixed; collapsing issue when single-select or empty multi-select fields are + disabled +- fixed; issue where an empty value would be left after clearing all values in a + multi-select field + +## v0.5.0 / 2015-06-20 + +- fixed; `esc` key incorrectly created empty options, thanks + [rgrzelak](https://github.com/rgrzelak) +- adeed; New feature to allow option creation ("tags mode"), enable with + `allowCreate` prop, thanks [Florent Vilmart](https://github.com/flovilmart) + and [Brian Reavis](https://github.com/brianreavis) +- fixed; IE8 compatibility fallback for `addEventListener/removeEventListener`, + which don't exist in IE8, thanks + [Stefan Billiet](https://github.com/StefanBilliet) +- fixed; Undefined values when using asyncOptions, thanks + [bannaN](https://github.com/bannaN) +- fixed; Prevent add the last focused value when the drop down menu is closed / + Pushing enter without dropdown open adds a value, thanks + [Giuseppe](https://github.com/giuse88) +- fixed; Callback context is undefined, thanks + [Giuseppe](https://github.com/giuse88) +- fixed; Issue with event being swallowed on Enter `keydown`, thanks + [Kevin Burke](https://github.com/kembuco) +- added; Support for case-insensitive filtering when `matchPos="start"`, thanks + [wesrage](https://github.com/wesrage) +- added; Support for customizable background color, thanks + [John Morales](https://github.com/JohnMorales) +- fixed; Updated ESLint and cleared up warnings, thanks + [Alexander Shemetovsky](https://github.com/AlexKVal) +- fixed; Close dropdown when clicking on select, thanks + [Nik Butenko](https://github.com/nkbt) +- added; Tests, and mocha test framework, thanks + [Craig Dallimore](https://github.com/craigdallimore) +- fixed; You can now start the example server and watch for changes with `npm start` + +## v0.4.9 / 2015-05-11 + +- fixed; focus was being grabbed by the select when `autoload` and + `asyncOptions` were set +- added; `focus` method on the component +- added; support for disabled options, thanks + [Pasha Palangpour](https://github.com/pashap) +- improved; more closures, less binds, for better performance, thanks + [Daniel Cousens](https://github.com/dcousens) + +## v0.4.8 / 2015-05-02 + +- fixed; restored `dist/default.css` +- fixed; standalone example works again +- fixed; clarified dependency documentation and added dependencies for Bower +- fixed; Scoping issues in `_bindCloseMenuIfClickedOutside`, thanks + [bannaN](https://github.com/bannaN) +- fixed; Doesn't try to set focus afterupdate if component is disabled, thanks + [bannaN](https://github.com/bannaN) + +## v0.4.7 / 2015-04-21 + +- improved; lodash is no longer a dependency, thanks + [Daniel Lo Nigro](https://github.com/Daniel15) + +## v0.4.6 / 2015-04-06 + +- updated; dependencies, build process and input-autosize component + +## v0.4.5 / 2015-03-28 + +- fixed; issue with long options overlapping arrow and clear icons, thanks + [Rohit Kalkur](https://github.com/rovolution) + +## v0.4.4 / 2015-03-26 + +- fixed; error handling click events when the menu is closed, thanks + [Ilya Petrov](https://github.com/muromec) +- fixed; issue where options will not be filtered in certain conditions, thanks + [G. Kay Lee](https://github.com/gsklee) + +## v0.4.3 / 2015-03-25 + +- added tests and updated dependencies + +## v0.4.2 / 2015-03-23 + +- added; ESLint and contributing guide +- fixed; incorrect `classnames` variable assignment in window scope +- fixed; all ESLint errors and warnings (except invalid JSX undefined/unused + vars due to ESLint bug) +- fixed; first option is now focused correctly, thanks + [Eivind Siqveland Larsen](https://github.com/esiqveland) + +## v0.4.1 / 2015-03-20 + +- fixed; IE11 issue: clicking on scrollbar within menu no longer closes menu, + thanks [Rohit Kalkur](https://github.com/rovolution) + +## v0.4.0 / 2015-03-12 + +- updated; compatible with React 0.13 + +## v0.3.5 / 2015-03-09 + +- improved; less/no repaint on scroll for performance wins, thanks + [jsmunich](https://github.com/jsmunich) +- added; `onBlur` and `onFocus` event handlers, thanks + [Jonas Budelmann](https://github.com/cloudkite) +- added; support for `inputProps` prop, passed to the `` component, + thanks [Yann Plantevin](https://github.com/YannPl) +- changed; now using + [react-component-gulp-tasks](https://github.com/JedWatson/react-component-gulp-tasks) + for build +- fixed; issue w/ remote callbacks overriding cached options, thanks + [Corey McMahon](https://github.com/coreymcmahon) +- fixed; if not `this.props.multi`, menu doesn't need handleMouseDown, thanks + [wenbing](https://github.com/wenbing) + +## v0.3.4 / 2015-02-23 + +- fixed; issues with the underscore/lodash dependency change, thanks + [Aaron Powell](https://github.com/aaronpowell) + +## v0.3.3 / 2015-02-22 + +- added; `disabled` prop, thanks [Danny Shaw](https://github.com/dannyshaw) +- added; `searchable` prop - set to `false` to disable the search box, thanks + [Julen Ruiz Aizpuru](https://github.com/julen) +- added; `onOptionLabelClick` prop - see + [#66](https://github.com/JedWatson/react-select/pull/66) for docs, thanks + [Dmitry Smirnov](https://github.com/dmitry-smirnov) +- fixed; `text-overflow: ellipsis;` typo, thanks + [Andru Vallance](https://github.com/andru) + +## v0.3.2 / 2015-01-30 + +- fixed; issue adding undefined values to multiselect, thanks + [Tejas Dinkar](https://github.com/gja) + +## v0.3.1 / 2015-01-20 + +- fixed; missing `var` statement + +## v0.3.0 / 2015-01-20 + +- added; node compatible build now available in `/lib` + +## v0.2.14 / 2015-01-07 + +- added; `searchPromptText` property that is displayed when `asyncOptions` is + set and there are (a) no options loaded, and (b) no input entered to search + on, thanks [Anton Fedchenko](https://github.com/kompot) +- added; `clearable` property (defaults to `true`) to control whether the + "clear" control is available, thanks + [Anton Fedchenko](https://github.com/kompot) + +## v0.2.13 / 2015-01-05 + +- fixed; height issues in Safari, thanks + [Joss Mackison](https://github.com/jossmac) +- added; Option to specify "Clear value" label as prop for i18n + +## v0.2.12 / 2015-01-04 + +- fixed; UI now responds to touch events, and works on mobile devices! thanks + [Fraser Xu](https://github.com/fraserxu) + +## v0.2.11 / 2015-01-04 + +- fixed; Options in the dropdown now scroll into view when they are focused, + thanks [Adam](https://github.com/fmovlex) +- improved; Example dist is now excluded from the npm package + +## v0.2.10 / 2015-01-01 + +- fixed; More specific mixin name to avoid conflicts (css) +- fixed; Example CSS now correctly rebuilds on changes in development +- fixed; Values are now expanded correctly when options change (see #28) +- added; Option to specify "No results found" label as prop for i18n, thanks + [Julen Ruiz Aizpuru](https://github.com/julen) + +## v0.2.9 / 2014-12-09 + +- added; `filterOption` and `filterOptions` props for more control over + filtering + +## v0.2.8 / 2014-12-08 + +- added; `matchPos` option to control whether to match the `start` or `any` + position in the string when filtering options (default: `any`) +- added; `matchProp` option to control whether to match the `value`, `label` or + `any` property of each option when filtering (default: `any`) + +## v0.2.7 / 2014-12-01 + +- fixed; screen-readers will now read "clear value" instead of "times" for the + clear button +- fixed; non-left-click mousedown events aren't blocked by the control + +## v0.2.6 / 2014-11-30 + +- improved; better comparison of changes to [options] in `willReceiveProps` +- fixed; now focuses the first option correctly when in multiselect mode +- fixed; fixed focused option behaviour on value change +- fixed; when filtering, there is always a focused option (#19) +- changed; using ^ in package.json to compare dependencies + +## v0.2.5 / 2014-11-20 + +- fixed; compatibility with case-sensitive file systems + +## v0.2.4 / 2014-11-20 + +- fixed; package.json pointed at the right file + +## v0.2.3 / 2014-11-17 + +- fixed; Updating state correctly when props change +- improved; Build tasks and docs +- added; Working standalone build +- added; Minified dist version +- added; Published to Bower + +## v0.2.2 / 2014-11-15 + +- fixed; backspace event being incorrectly cancelled + +## v0.2.1 / 2014-11-15 + +- fixed; issue where backspace incorrectly clears the value (#14) + +## v0.2.0 / 2014-11-15 + +- changed; Major rewrite to improve focus handling and internal state management +- added; Support for `multi` prop, enable multiselect mode + +## v0.1.1 / 2014-11-03 + +- added; Support for `onChange` event +- added; `propTypes` are defined by the `Select` component now +- added; `className` property, sets the `className` on the outer `div` element +- fixed; Removed deprecated `React.DOM.x` calls + +## v0.1.0 / 2014-11-01 + +- updated; React to 0.12.0 + +## v0.0.6 / 2014-10-14 + +- fixed; Error keeping value when using Async Options diff --git a/src/components/node_modules/react-select/README.md b/src/components/node_modules/react-select/README.md new file mode 100644 index 0000000..223c79a --- /dev/null +++ b/src/components/node_modules/react-select/README.md @@ -0,0 +1,168 @@ +[![NPM](https://img.shields.io/npm/v/react-select.svg)](https://www.npmjs.com/package/react-select) +[![CircleCI](https://circleci.com/gh/JedWatson/react-select/tree/master.svg?style=shield)](https://circleci.com/gh/JedWatson/react-select/tree/master) +[![Coverage Status](https://coveralls.io/repos/JedWatson/react-select/badge.svg?branch=master&service=github)](https://coveralls.io/github/JedWatson/react-select?branch=master) +[![Supported by Thinkmill](https://thinkmill.github.io/badge/heart.svg)](http://thinkmill.com.au/?utm_source=github&utm_medium=badge&utm_campaign=react-select) + +# React-Select + +The Select control for [React](https://reactjs.com). Initially built for use in [KeystoneJS](http://www.keystonejs.com). + +See [react-select.com](https://www.react-select.com) for live demos and comprehensive docs. + +React Select is funded by [Thinkmill](https://www.thinkmill.com.au) and [Atlassian](https://atlaskit.atlassian.com). It represents a whole new approach to developing powerful React.js components that _just work_ out of the box, while being extremely customisable. + +For the story behind this component, watch Jed's talk at React Conf 2019 - [building React Select](https://youtu.be/yS0jUnmBujE) + +Features include: + +- Flexible approach to data, with customisable functions +- Extensible styling API with [emotion](https://emotion.sh) +- Component Injection API for complete control over the UI behaviour +- Controllable state props and modular architecture +- Long-requested features like option groups, portal support, animation, and more + +## Using an older version? + +- [v3, v4, and v5 upgrade guide](https://react-select.com/upgrade) +- [v2 upgrade guide](https://react-select.com/upgrade-to-v2) +- React Select v1 documentation and examples are available at [v1.react-select.com](https://v1.react-select.com) + +# Installation and usage + +The easiest way to use react-select is to install it from npm and build it into your app with Webpack. + +``` +yarn add react-select +``` + +Then use it in your app: + +#### With React Component + +```js +import React from 'react'; +import Select from 'react-select'; + +const options = [ + { value: 'chocolate', label: 'Chocolate' }, + { value: 'strawberry', label: 'Strawberry' }, + { value: 'vanilla', label: 'Vanilla' }, +]; + +class App extends React.Component { + state = { + selectedOption: null, + }; + handleChange = (selectedOption) => { + this.setState({ selectedOption }, () => + console.log(`Option selected:`, this.state.selectedOption) + ); + }; + render() { + const { selectedOption } = this.state; + + return ( + +
+ ); +} +``` + +## Props + +Common props you may want to specify include: + +- `autoFocus` - focus the control when it mounts +- `className` - apply a className to the control +- `classNamePrefix` - apply classNames to inner elements with the given prefix +- `isDisabled` - disable the control +- `isMulti` - allow the user to select multiple values +- `isSearchable` - allow the user to search for matching options +- `name` - generate an HTML input with this name, containing the current value +- `onChange` - subscribe to change events +- `options` - specify the options the user can select from +- `placeholder` - change the text displayed when no option is selected +- `noOptionsMessage` - ({ inputValue: string }) => string | null - Text to display when there are no options +- `value` - control the current value + +See the [props documentation](https://www.react-select.com/props) for complete documentation on the props react-select supports. + +## Controllable Props + +You can control the following props by providing values for them. If you don't, react-select will manage them for you. + +- `value` / `onChange` - specify the current value of the control +- `menuIsOpen` / `onMenuOpen` / `onMenuClose` - control whether the menu is open +- `inputValue` / `onInputChange` - control the value of the search input (changing this will update the available options) + +If you don't provide these props, you can set the initial value of the state they control: + +- `defaultValue` - set the initial value of the control +- `defaultMenuIsOpen` - set the initial open value of the menu +- `defaultInputValue` - set the initial value of the search input + +## Methods + +React-select exposes two public methods: + +- `focus()` - focus the control programmatically +- `blur()` - blur the control programmatically + +## Customisation + +Check the docs for more information on: + +- [Customising the styles](https://www.react-select.com/styles) +- [Using custom components](https://www.react-select.com/components) +- [Using the built-in animated components](https://www.react-select.com/home#animated-components) +- [Creating an async select](https://www.react-select.com/async) +- [Allowing users to create new options](https://www.react-select.com/creatable) +- [Advanced use-cases](https://www.react-select.com/advanced) +- [TypeScript guide](https://www.react-select.com/typescript) + +## Typescript + +The v5 release represents a rewrite from JavaScript to Typescript. The types for v4 and earlier releases are available at [@types](https://www.npmjs.com/package/@types/react-select). See the [TypeScript guide](https://www.react-select.com/typescript) for how to use the types starting with v5. + +# Thanks + +Thank you to everyone who has contributed to this project. It's been a wild ride. + +If you like React Select, you should [follow me on twitter](https://twitter.com/jedwatson)! + +Shout out to [Joss Mackison](https://github.com/jossmac), [Charles Lee](https://github.com/gwyneplaine), [Ben Conolly](https://github.com/Noviny), [Tom Walker](https://github.com/bladey), [Nathan Bierema](https://github.com/Methuselah96), [Eric Bonow](https://github.com/ebonow), [Mitchell Hamilton](https://github.com/mitchellhamilton), [Dave Brotherstone](https://github.com/bruderstein), [Brian Vaughn](https://github.com/bvaughn), and the [Atlassian Design System](https://atlassian.design) team who along with many other contributors have made this possible ❤️ + +## License + +MIT Licensed. Copyright (c) Jed Watson 2021. diff --git a/src/components/node_modules/react-select/animated/package.json b/src/components/node_modules/react-select/animated/package.json new file mode 100644 index 0000000..b2af854 --- /dev/null +++ b/src/components/node_modules/react-select/animated/package.json @@ -0,0 +1,8 @@ +{ + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "preconstruct": { + "source": "../src/animated" + } +} diff --git a/src/components/node_modules/react-select/async-creatable/package.json b/src/components/node_modules/react-select/async-creatable/package.json new file mode 100644 index 0000000..3117f82 --- /dev/null +++ b/src/components/node_modules/react-select/async-creatable/package.json @@ -0,0 +1,8 @@ +{ + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "preconstruct": { + "source": "../src/AsyncCreatable" + } +} diff --git a/src/components/node_modules/react-select/async/package.json b/src/components/node_modules/react-select/async/package.json new file mode 100644 index 0000000..69034f9 --- /dev/null +++ b/src/components/node_modules/react-select/async/package.json @@ -0,0 +1,8 @@ +{ + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "preconstruct": { + "source": "../src/Async" + } +} diff --git a/src/components/node_modules/react-select/base/package.json b/src/components/node_modules/react-select/base/package.json new file mode 100644 index 0000000..f538122 --- /dev/null +++ b/src/components/node_modules/react-select/base/package.json @@ -0,0 +1,8 @@ +{ + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "preconstruct": { + "source": "../src/Select" + } +} diff --git a/src/components/node_modules/react-select/creatable/package.json b/src/components/node_modules/react-select/creatable/package.json new file mode 100644 index 0000000..0be16fc --- /dev/null +++ b/src/components/node_modules/react-select/creatable/package.json @@ -0,0 +1,8 @@ +{ + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "preconstruct": { + "source": "../src/Creatable" + } +} diff --git a/src/components/node_modules/react-select/package.json b/src/components/node_modules/react-select/package.json new file mode 100644 index 0000000..390dc8f --- /dev/null +++ b/src/components/node_modules/react-select/package.json @@ -0,0 +1,61 @@ +{ + "name": "react-select", + "version": "5.4.0", + "description": "A Select control built with and for ReactJS", + "main": "dist/react-select.cjs.js", + "module": "dist/react-select.esm.js", + "types": "dist/react-select.cjs.d.ts", + "sideEffects": false, + "author": "Jed Watson", + "license": "MIT", + "repository": "https://github.com/JedWatson/react-select/tree/master/packages/react-select", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^5.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0" + }, + "devDependencies": { + "@types/jest-in-case": "^1.0.3", + "enzyme": "^3.8.0", + "enzyme-to-json": "^3.3.0", + "jest-in-case": "^1.0.2", + "react": "^16.13.0", + "react-dom": "^16.13.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "files": [ + "dist", + "base", + "animated", + "async", + "creatable", + "async-creatable" + ], + "keywords": [ + "combobox", + "form", + "input", + "multiselect", + "react", + "react-component", + "select", + "ui" + ], + "preconstruct": { + "entrypoints": [ + ".", + "base", + "animated", + "async", + "creatable", + "async-creatable" + ] + } +} diff --git a/src/components/node_modules/react-transition-group/CSSTransition/package.json b/src/components/node_modules/react-transition-group/CSSTransition/package.json new file mode 100644 index 0000000..b92db9d --- /dev/null +++ b/src/components/node_modules/react-transition-group/CSSTransition/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/CSSTransition", + "private": true, + "main": "../cjs/CSSTransition.js", + "module": "../esm/CSSTransition.js" +} diff --git a/src/components/node_modules/react-transition-group/LICENSE b/src/components/node_modules/react-transition-group/LICENSE new file mode 100644 index 0000000..af58622 --- /dev/null +++ b/src/components/node_modules/react-transition-group/LICENSE @@ -0,0 +1,30 @@ +BSD 3-Clause License + +Copyright (c) 2018, React Community +Forked from React (https://github.com/facebook/react) Copyright 2013-present, Facebook, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/components/node_modules/react-transition-group/README.md b/src/components/node_modules/react-transition-group/README.md new file mode 100644 index 0000000..566a11a --- /dev/null +++ b/src/components/node_modules/react-transition-group/README.md @@ -0,0 +1,34 @@ +# react-transition-group [![npm][npm-badge]][npm] + +> **ATTENTION!** To address many issues that have come up over the years, the API in v2 and above is not backwards compatible with the original [`React addon (v1-stable)`](https://github.com/reactjs/react-transition-group/tree/v1-stable). +> +> **For a drop-in replacement for `react-addons-transition-group` and `react-addons-css-transition-group`, use the v1 release. Documentation and code for that release are available on the [`v1-stable`](https://github.com/reactjs/react-transition-group/tree/v1-stable) branch.** +> +> We are no longer updating the v1 codebase, please upgrade to the latest version when possible + +A set of components for managing component states (including mounting and unmounting) over time, specifically designed with animation in mind. + +## Documentation + +- [**Main documentation**](https://reactcommunity.org/react-transition-group/) +- [Migration guide from v1](/Migration.md) + +## TypeScript +TypeScript definitions are published via [**DefinitelyTyped**](https://github.com/DefinitelyTyped/DefinitelyTyped) and can be installed via the following command: + +``` +npm install @types/react-transition-group +``` + +## Examples + +Clone the repo first: + +``` +git@github.com:reactjs/react-transition-group.git +``` + +Then run `npm install` (or `yarn`), and finally `npm run storybook` to start a storybook instance that you can navigate to in your browser to see the examples. + +[npm-badge]: https://img.shields.io/npm/v/react-transition-group.svg +[npm]: https://www.npmjs.org/package/react-transition-group diff --git a/src/components/node_modules/react-transition-group/ReplaceTransition/package.json b/src/components/node_modules/react-transition-group/ReplaceTransition/package.json new file mode 100644 index 0000000..8dd4d77 --- /dev/null +++ b/src/components/node_modules/react-transition-group/ReplaceTransition/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/ReplaceTransition", + "private": true, + "main": "../cjs/ReplaceTransition.js", + "module": "../esm/ReplaceTransition.js" +} diff --git a/src/components/node_modules/react-transition-group/SwitchTransition/package.json b/src/components/node_modules/react-transition-group/SwitchTransition/package.json new file mode 100644 index 0000000..a12ce08 --- /dev/null +++ b/src/components/node_modules/react-transition-group/SwitchTransition/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/SwitchTransition", + "private": true, + "main": "../cjs/SwitchTransition.js", + "module": "../esm/SwitchTransition.js" +} diff --git a/src/components/node_modules/react-transition-group/Transition/package.json b/src/components/node_modules/react-transition-group/Transition/package.json new file mode 100644 index 0000000..372e905 --- /dev/null +++ b/src/components/node_modules/react-transition-group/Transition/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/Transition", + "private": true, + "main": "../cjs/Transition.js", + "module": "../esm/Transition.js" +} diff --git a/src/components/node_modules/react-transition-group/TransitionGroup/package.json b/src/components/node_modules/react-transition-group/TransitionGroup/package.json new file mode 100644 index 0000000..8aaa9c3 --- /dev/null +++ b/src/components/node_modules/react-transition-group/TransitionGroup/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/TransitionGroup", + "private": true, + "main": "../cjs/TransitionGroup.js", + "module": "../esm/TransitionGroup.js" +} diff --git a/src/components/node_modules/react-transition-group/TransitionGroupContext/package.json b/src/components/node_modules/react-transition-group/TransitionGroupContext/package.json new file mode 100644 index 0000000..83ad28f --- /dev/null +++ b/src/components/node_modules/react-transition-group/TransitionGroupContext/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/TransitionGroupContext", + "private": true, + "main": "../cjs/TransitionGroupContext.js", + "module": "../esm/TransitionGroupContext.js" +} diff --git a/src/components/node_modules/react-transition-group/cjs/CSSTransition.js b/src/components/node_modules/react-transition-group/cjs/CSSTransition.js new file mode 100644 index 0000000..8f0d3c1 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/CSSTransition.js @@ -0,0 +1,430 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _addClass2 = _interopRequireDefault(require("dom-helpers/addClass")); + +var _removeClass = _interopRequireDefault(require("dom-helpers/removeClass")); + +var _react = _interopRequireDefault(require("react")); + +var _Transition = _interopRequireDefault(require("./Transition")); + +var _PropTypes = require("./utils/PropTypes"); + +var _reflow = require("./utils/reflow"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var _addClass = function addClass(node, classes) { + return node && classes && classes.split(' ').forEach(function (c) { + return (0, _addClass2.default)(node, c); + }); +}; + +var removeClass = function removeClass(node, classes) { + return node && classes && classes.split(' ').forEach(function (c) { + return (0, _removeClass.default)(node, c); + }); +}; +/** + * A transition component inspired by the excellent + * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should + * use it if you're using CSS transitions or animations. It's built upon the + * [`Transition`](https://reactcommunity.org/react-transition-group/transition) + * component, so it inherits all of its props. + * + * `CSSTransition` applies a pair of class names during the `appear`, `enter`, + * and `exit` states of the transition. The first class is applied and then a + * second `*-active` class in order to activate the CSS transition. After the + * transition, matching `*-done` class names are applied to persist the + * transition state. + * + * ```jsx + * function App() { + * const [inProp, setInProp] = useState(false); + * return ( + *
+ * + *
+ * {"I'll receive my-node-* classes"} + *
+ *
+ * + *
+ * ); + * } + * ``` + * + * When the `in` prop is set to `true`, the child component will first receive + * the class `example-enter`, then the `example-enter-active` will be added in + * the next tick. `CSSTransition` [forces a + * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215) + * between before adding the `example-enter-active`. This is an important trick + * because it allows us to transition between `example-enter` and + * `example-enter-active` even though they were added immediately one after + * another. Most notably, this is what makes it possible for us to animate + * _appearance_. + * + * ```css + * .my-node-enter { + * opacity: 0; + * } + * .my-node-enter-active { + * opacity: 1; + * transition: opacity 200ms; + * } + * .my-node-exit { + * opacity: 1; + * } + * .my-node-exit-active { + * opacity: 0; + * transition: opacity 200ms; + * } + * ``` + * + * `*-active` classes represent which styles you want to animate **to**, so it's + * important to add `transition` declaration only to them, otherwise transitions + * might not behave as intended! This might not be obvious when the transitions + * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in + * the example above (minus `transition`), but it becomes apparent in more + * complex transitions. + * + * **Note**: If you're using the + * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear) + * prop, make sure to define styles for `.appear-*` classes as well. + */ + + +var CSSTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(CSSTransition, _React$Component); + + function CSSTransition() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.appliedClasses = { + appear: {}, + enter: {}, + exit: {} + }; + + _this.onEnter = function (maybeNode, maybeAppearing) { + var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument[0], + appearing = _this$resolveArgument[1]; + + _this.removeClasses(node, 'exit'); + + _this.addClass(node, appearing ? 'appear' : 'enter', 'base'); + + if (_this.props.onEnter) { + _this.props.onEnter(maybeNode, maybeAppearing); + } + }; + + _this.onEntering = function (maybeNode, maybeAppearing) { + var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument2[0], + appearing = _this$resolveArgument2[1]; + + var type = appearing ? 'appear' : 'enter'; + + _this.addClass(node, type, 'active'); + + if (_this.props.onEntering) { + _this.props.onEntering(maybeNode, maybeAppearing); + } + }; + + _this.onEntered = function (maybeNode, maybeAppearing) { + var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument3[0], + appearing = _this$resolveArgument3[1]; + + var type = appearing ? 'appear' : 'enter'; + + _this.removeClasses(node, type); + + _this.addClass(node, type, 'done'); + + if (_this.props.onEntered) { + _this.props.onEntered(maybeNode, maybeAppearing); + } + }; + + _this.onExit = function (maybeNode) { + var _this$resolveArgument4 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument4[0]; + + _this.removeClasses(node, 'appear'); + + _this.removeClasses(node, 'enter'); + + _this.addClass(node, 'exit', 'base'); + + if (_this.props.onExit) { + _this.props.onExit(maybeNode); + } + }; + + _this.onExiting = function (maybeNode) { + var _this$resolveArgument5 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument5[0]; + + _this.addClass(node, 'exit', 'active'); + + if (_this.props.onExiting) { + _this.props.onExiting(maybeNode); + } + }; + + _this.onExited = function (maybeNode) { + var _this$resolveArgument6 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument6[0]; + + _this.removeClasses(node, 'exit'); + + _this.addClass(node, 'exit', 'done'); + + if (_this.props.onExited) { + _this.props.onExited(maybeNode); + } + }; + + _this.resolveArguments = function (maybeNode, maybeAppearing) { + return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing` + : [maybeNode, maybeAppearing]; + }; + + _this.getClassNames = function (type) { + var classNames = _this.props.classNames; + var isStringClassNames = typeof classNames === 'string'; + var prefix = isStringClassNames && classNames ? classNames + "-" : ''; + var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type]; + var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"]; + var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"]; + return { + baseClassName: baseClassName, + activeClassName: activeClassName, + doneClassName: doneClassName + }; + }; + + return _this; + } + + var _proto = CSSTransition.prototype; + + _proto.addClass = function addClass(node, type, phase) { + var className = this.getClassNames(type)[phase + "ClassName"]; + + var _this$getClassNames = this.getClassNames('enter'), + doneClassName = _this$getClassNames.doneClassName; + + if (type === 'appear' && phase === 'done' && doneClassName) { + className += " " + doneClassName; + } // This is to force a repaint, + // which is necessary in order to transition styles when adding a class name. + + + if (phase === 'active') { + if (node) (0, _reflow.forceReflow)(node); + } + + if (className) { + this.appliedClasses[type][phase] = className; + + _addClass(node, className); + } + }; + + _proto.removeClasses = function removeClasses(node, type) { + var _this$appliedClasses$ = this.appliedClasses[type], + baseClassName = _this$appliedClasses$.base, + activeClassName = _this$appliedClasses$.active, + doneClassName = _this$appliedClasses$.done; + this.appliedClasses[type] = {}; + + if (baseClassName) { + removeClass(node, baseClassName); + } + + if (activeClassName) { + removeClass(node, activeClassName); + } + + if (doneClassName) { + removeClass(node, doneClassName); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + _ = _this$props.classNames, + props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]); + + return /*#__PURE__*/_react.default.createElement(_Transition.default, _extends({}, props, { + onEnter: this.onEnter, + onEntered: this.onEntered, + onEntering: this.onEntering, + onExit: this.onExit, + onExiting: this.onExiting, + onExited: this.onExited + })); + }; + + return CSSTransition; +}(_react.default.Component); + +CSSTransition.defaultProps = { + classNames: '' +}; +CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, { + /** + * The animation classNames applied to the component as it appears, enters, + * exits or has finished the transition. A single name can be provided, which + * will be suffixed for each stage, e.g. `classNames="fade"` applies: + * + * - `fade-appear`, `fade-appear-active`, `fade-appear-done` + * - `fade-enter`, `fade-enter-active`, `fade-enter-done` + * - `fade-exit`, `fade-exit-active`, `fade-exit-done` + * + * A few details to note about how these classes are applied: + * + * 1. They are _joined_ with the ones that are already defined on the child + * component, so if you want to add some base styles, you can use + * `className` without worrying that it will be overridden. + * + * 2. If the transition component mounts with `in={false}`, no classes are + * applied yet. You might be expecting `*-exit-done`, but if you think + * about it, a component cannot finish exiting if it hasn't entered yet. + * + * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This + * allows you to define different behavior for when appearing is done and + * when regular entering is done, using selectors like + * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply + * an epic entrance animation when element first appears in the DOM using + * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can + * simply use `fade-enter-done` for defining both cases. + * + * Each individual classNames can also be specified independently like: + * + * ```js + * classNames={{ + * appear: 'my-appear', + * appearActive: 'my-active-appear', + * appearDone: 'my-done-appear', + * enter: 'my-enter', + * enterActive: 'my-active-enter', + * enterDone: 'my-done-enter', + * exit: 'my-exit', + * exitActive: 'my-active-exit', + * exitDone: 'my-done-exit', + * }} + * ``` + * + * If you want to set these classes using CSS Modules: + * + * ```js + * import styles from './styles.css'; + * ``` + * + * you might want to use camelCase in your CSS file, that way could simply + * spread them instead of listing them one by one: + * + * ```js + * classNames={{ ...styles }} + * ``` + * + * @type {string | { + * appear?: string, + * appearActive?: string, + * appearDone?: string, + * enter?: string, + * enterActive?: string, + * enterDone?: string, + * exit?: string, + * exitActive?: string, + * exitDone?: string, + * }} + */ + classNames: _PropTypes.classNamesShape, + + /** + * A `` callback fired immediately after the 'enter' or 'appear' class is + * applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEnter: _propTypes.default.func, + + /** + * A `` callback fired immediately after the 'enter-active' or + * 'appear-active' class is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntering: _propTypes.default.func, + + /** + * A `` callback fired immediately after the 'enter' or + * 'appear' classes are **removed** and the `done` class is added to the DOM node. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntered: _propTypes.default.func, + + /** + * A `` callback fired immediately after the 'exit' class is + * applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExit: _propTypes.default.func, + + /** + * A `` callback fired immediately after the 'exit-active' is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExiting: _propTypes.default.func, + + /** + * A `` callback fired immediately after the 'exit' classes + * are **removed** and the `exit-done` class is added to the DOM node. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExited: _propTypes.default.func +}) : {}; +var _default = CSSTransition; +exports.default = _default; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/ReplaceTransition.js b/src/components/node_modules/react-transition-group/cjs/ReplaceTransition.js new file mode 100644 index 0000000..cb3224c --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/ReplaceTransition.js @@ -0,0 +1,152 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _TransitionGroup = _interopRequireDefault(require("./TransitionGroup")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +/** + * The `` component is a specialized `Transition` component + * that animates between two children. + * + * ```jsx + * + *
I appear first
+ *
I replace the above
+ *
+ * ``` + */ +var ReplaceTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(ReplaceTransition, _React$Component); + + function ReplaceTransition() { + var _this; + + for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { + _args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this; + + _this.handleEnter = function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + return _this.handleLifecycle('onEnter', 0, args); + }; + + _this.handleEntering = function () { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return _this.handleLifecycle('onEntering', 0, args); + }; + + _this.handleEntered = function () { + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + return _this.handleLifecycle('onEntered', 0, args); + }; + + _this.handleExit = function () { + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + return _this.handleLifecycle('onExit', 1, args); + }; + + _this.handleExiting = function () { + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + return _this.handleLifecycle('onExiting', 1, args); + }; + + _this.handleExited = function () { + for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + args[_key7] = arguments[_key7]; + } + + return _this.handleLifecycle('onExited', 1, args); + }; + + return _this; + } + + var _proto = ReplaceTransition.prototype; + + _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) { + var _child$props; + + var children = this.props.children; + + var child = _react.default.Children.toArray(children)[idx]; + + if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs); + + if (this.props[handler]) { + var maybeNode = child.props.nodeRef ? undefined : _reactDom.default.findDOMNode(this); + this.props[handler](maybeNode); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + children = _this$props.children, + inProp = _this$props.in, + props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]); + + var _React$Children$toArr = _react.default.Children.toArray(children), + first = _React$Children$toArr[0], + second = _React$Children$toArr[1]; + + delete props.onEnter; + delete props.onEntering; + delete props.onEntered; + delete props.onExit; + delete props.onExiting; + delete props.onExited; + return /*#__PURE__*/_react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, { + key: 'first', + onEnter: this.handleEnter, + onEntering: this.handleEntering, + onEntered: this.handleEntered + }) : _react.default.cloneElement(second, { + key: 'second', + onEnter: this.handleExit, + onEntering: this.handleExiting, + onEntered: this.handleExited + })); + }; + + return ReplaceTransition; +}(_react.default.Component); + +ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? { + in: _propTypes.default.bool.isRequired, + children: function children(props, propName) { + if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components."); + return null; + } +} : {}; +var _default = ReplaceTransition; +exports.default = _default; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/SwitchTransition.js b/src/components/node_modules/react-transition-group/cjs/SwitchTransition.js new file mode 100644 index 0000000..19b342c --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/SwitchTransition.js @@ -0,0 +1,269 @@ +"use strict"; + +exports.__esModule = true; +exports.default = exports.modes = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _Transition = require("./Transition"); + +var _TransitionGroupContext = _interopRequireDefault(require("./TransitionGroupContext")); + +var _leaveRenders, _enterRenders; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +function areChildrenDifferent(oldChildren, newChildren) { + if (oldChildren === newChildren) return false; + + if (_react.default.isValidElement(oldChildren) && _react.default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) { + return false; + } + + return true; +} +/** + * Enum of modes for SwitchTransition component + * @enum { string } + */ + + +var modes = { + out: 'out-in', + in: 'in-out' +}; +exports.modes = modes; + +var callHook = function callHook(element, name, cb) { + return function () { + var _element$props; + + element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments); + cb(); + }; +}; + +var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) { + var current = _ref.current, + changeState = _ref.changeState; + return _react.default.cloneElement(current, { + in: false, + onExited: callHook(current, 'onExited', function () { + changeState(_Transition.ENTERING, null); + }) + }); +}, _leaveRenders[modes.in] = function (_ref2) { + var current = _ref2.current, + changeState = _ref2.changeState, + children = _ref2.children; + return [current, _react.default.cloneElement(children, { + in: true, + onEntered: callHook(children, 'onEntered', function () { + changeState(_Transition.ENTERING); + }) + })]; +}, _leaveRenders); +var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) { + var children = _ref3.children, + changeState = _ref3.changeState; + return _react.default.cloneElement(children, { + in: true, + onEntered: callHook(children, 'onEntered', function () { + changeState(_Transition.ENTERED, _react.default.cloneElement(children, { + in: true + })); + }) + }); +}, _enterRenders[modes.in] = function (_ref4) { + var current = _ref4.current, + children = _ref4.children, + changeState = _ref4.changeState; + return [_react.default.cloneElement(current, { + in: false, + onExited: callHook(current, 'onExited', function () { + changeState(_Transition.ENTERED, _react.default.cloneElement(children, { + in: true + })); + }) + }), _react.default.cloneElement(children, { + in: true + })]; +}, _enterRenders); +/** + * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes). + * You can use it when you want to control the render between state transitions. + * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them. + * + * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child. + * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child. + * + * **Note**: If you want the animation to happen simultaneously + * (that is, to have the old child removed and a new child inserted **at the same time**), + * you should use + * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group) + * instead. + * + * ```jsx + * function App() { + * const [state, setState] = useState(false); + * return ( + * + * node.addEventListener("transitionend", done, false)} + * classNames='fade' + * > + * + * + * + * ); + * } + * ``` + * + * ```css + * .fade-enter{ + * opacity: 0; + * } + * .fade-exit{ + * opacity: 1; + * } + * .fade-enter-active{ + * opacity: 1; + * } + * .fade-exit-active{ + * opacity: 0; + * } + * .fade-enter-active, + * .fade-exit-active{ + * transition: opacity 500ms; + * } + * ``` + */ + +var SwitchTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(SwitchTransition, _React$Component); + + function SwitchTransition() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.state = { + status: _Transition.ENTERED, + current: null + }; + _this.appeared = false; + + _this.changeState = function (status, current) { + if (current === void 0) { + current = _this.state.current; + } + + _this.setState({ + status: status, + current: current + }); + }; + + return _this; + } + + var _proto = SwitchTransition.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.appeared = true; + }; + + SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) { + if (props.children == null) { + return { + current: null + }; + } + + if (state.status === _Transition.ENTERING && props.mode === modes.in) { + return { + status: _Transition.ENTERING + }; + } + + if (state.current && areChildrenDifferent(state.current, props.children)) { + return { + status: _Transition.EXITING + }; + } + + return { + current: _react.default.cloneElement(props.children, { + in: true + }) + }; + }; + + _proto.render = function render() { + var _this$props = this.props, + children = _this$props.children, + mode = _this$props.mode, + _this$state = this.state, + status = _this$state.status, + current = _this$state.current; + var data = { + children: children, + current: current, + changeState: this.changeState, + status: status + }; + var component; + + switch (status) { + case _Transition.ENTERING: + component = enterRenders[mode](data); + break; + + case _Transition.EXITING: + component = leaveRenders[mode](data); + break; + + case _Transition.ENTERED: + component = current; + } + + return /*#__PURE__*/_react.default.createElement(_TransitionGroupContext.default.Provider, { + value: { + isMounting: !this.appeared + } + }, component); + }; + + return SwitchTransition; +}(_react.default.Component); + +SwitchTransition.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * Transition modes. + * `out-in`: Current element transitions out first, then when complete, the new element transitions in. + * `in-out`: New element transitions in first, then when complete, the current element transitions out. + * + * @type {'out-in'|'in-out'} + */ + mode: _propTypes.default.oneOf([modes.in, modes.out]), + + /** + * Any `Transition` or `CSSTransition` component. + */ + children: _propTypes.default.oneOfType([_propTypes.default.element.isRequired]) +} : {}; +SwitchTransition.defaultProps = { + mode: modes.out +}; +var _default = SwitchTransition; +exports.default = _default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/Transition.js b/src/components/node_modules/react-transition-group/cjs/Transition.js new file mode 100644 index 0000000..b44cb76 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/Transition.js @@ -0,0 +1,648 @@ +"use strict"; + +exports.__esModule = true; +exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0; + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _config = _interopRequireDefault(require("./config")); + +var _PropTypes = require("./utils/PropTypes"); + +var _TransitionGroupContext = _interopRequireDefault(require("./TransitionGroupContext")); + +var _reflow = require("./utils/reflow"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var UNMOUNTED = 'unmounted'; +exports.UNMOUNTED = UNMOUNTED; +var EXITED = 'exited'; +exports.EXITED = EXITED; +var ENTERING = 'entering'; +exports.ENTERING = ENTERING; +var ENTERED = 'entered'; +exports.ENTERED = ENTERED; +var EXITING = 'exiting'; +/** + * The Transition component lets you describe a transition from one component + * state to another _over time_ with a simple declarative API. Most commonly + * it's used to animate the mounting and unmounting of a component, but can also + * be used to describe in-place transition states as well. + * + * --- + * + * **Note**: `Transition` is a platform-agnostic base component. If you're using + * transitions in CSS, you'll probably want to use + * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition) + * instead. It inherits all the features of `Transition`, but contains + * additional features necessary to play nice with CSS transitions (hence the + * name of the component). + * + * --- + * + * By default the `Transition` component does not alter the behavior of the + * component it renders, it only tracks "enter" and "exit" states for the + * components. It's up to you to give meaning and effect to those states. For + * example we can add styles to a component when it enters or exits: + * + * ```jsx + * import { Transition } from 'react-transition-group'; + * + * const duration = 300; + * + * const defaultStyle = { + * transition: `opacity ${duration}ms ease-in-out`, + * opacity: 0, + * } + * + * const transitionStyles = { + * entering: { opacity: 1 }, + * entered: { opacity: 1 }, + * exiting: { opacity: 0 }, + * exited: { opacity: 0 }, + * }; + * + * const Fade = ({ in: inProp }) => ( + * + * {state => ( + *
+ * I'm a fade Transition! + *
+ * )} + *
+ * ); + * ``` + * + * There are 4 main states a Transition can be in: + * - `'entering'` + * - `'entered'` + * - `'exiting'` + * - `'exited'` + * + * Transition state is toggled via the `in` prop. When `true` the component + * begins the "Enter" stage. During this stage, the component will shift from + * its current transition state, to `'entering'` for the duration of the + * transition and then to the `'entered'` stage once it's complete. Let's take + * the following example (we'll use the + * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook): + * + * ```jsx + * function App() { + * const [inProp, setInProp] = useState(false); + * return ( + *
+ * + * {state => ( + * // ... + * )} + * + * + *
+ * ); + * } + * ``` + * + * When the button is clicked the component will shift to the `'entering'` state + * and stay there for 500ms (the value of `timeout`) before it finally switches + * to `'entered'`. + * + * When `in` is `false` the same thing happens except the state moves from + * `'exiting'` to `'exited'`. + */ + +exports.EXITING = EXITING; + +var Transition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(Transition, _React$Component); + + function Transition(props, context) { + var _this; + + _this = _React$Component.call(this, props, context) || this; + var parentGroup = context; // In the context of a TransitionGroup all enters are really appears + + var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; + var initialStatus; + _this.appearStatus = null; + + if (props.in) { + if (appear) { + initialStatus = EXITED; + _this.appearStatus = ENTERING; + } else { + initialStatus = ENTERED; + } + } else { + if (props.unmountOnExit || props.mountOnEnter) { + initialStatus = UNMOUNTED; + } else { + initialStatus = EXITED; + } + } + + _this.state = { + status: initialStatus + }; + _this.nextCallback = null; + return _this; + } + + Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { + var nextIn = _ref.in; + + if (nextIn && prevState.status === UNMOUNTED) { + return { + status: EXITED + }; + } + + return null; + } // getSnapshotBeforeUpdate(prevProps) { + // let nextStatus = null + // if (prevProps !== this.props) { + // const { status } = this.state + // if (this.props.in) { + // if (status !== ENTERING && status !== ENTERED) { + // nextStatus = ENTERING + // } + // } else { + // if (status === ENTERING || status === ENTERED) { + // nextStatus = EXITING + // } + // } + // } + // return { nextStatus } + // } + ; + + var _proto = Transition.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.updateStatus(true, this.appearStatus); + }; + + _proto.componentDidUpdate = function componentDidUpdate(prevProps) { + var nextStatus = null; + + if (prevProps !== this.props) { + var status = this.state.status; + + if (this.props.in) { + if (status !== ENTERING && status !== ENTERED) { + nextStatus = ENTERING; + } + } else { + if (status === ENTERING || status === ENTERED) { + nextStatus = EXITING; + } + } + } + + this.updateStatus(false, nextStatus); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.cancelNextCallback(); + }; + + _proto.getTimeouts = function getTimeouts() { + var timeout = this.props.timeout; + var exit, enter, appear; + exit = enter = appear = timeout; + + if (timeout != null && typeof timeout !== 'number') { + exit = timeout.exit; + enter = timeout.enter; // TODO: remove fallback for next major + + appear = timeout.appear !== undefined ? timeout.appear : enter; + } + + return { + exit: exit, + enter: enter, + appear: appear + }; + }; + + _proto.updateStatus = function updateStatus(mounting, nextStatus) { + if (mounting === void 0) { + mounting = false; + } + + if (nextStatus !== null) { + // nextStatus will always be ENTERING or EXITING. + this.cancelNextCallback(); + + if (nextStatus === ENTERING) { + if (this.props.unmountOnExit || this.props.mountOnEnter) { + var node = this.props.nodeRef ? this.props.nodeRef.current : _reactDom.default.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749 + // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`. + // To make the animation happen, we have to separate each rendering and avoid being processed as batched. + + if (node) (0, _reflow.forceReflow)(node); + } + + this.performEnter(mounting); + } else { + this.performExit(); + } + } else if (this.props.unmountOnExit && this.state.status === EXITED) { + this.setState({ + status: UNMOUNTED + }); + } + }; + + _proto.performEnter = function performEnter(mounting) { + var _this2 = this; + + var enter = this.props.enter; + var appearing = this.context ? this.context.isMounting : mounting; + + var _ref2 = this.props.nodeRef ? [appearing] : [_reactDom.default.findDOMNode(this), appearing], + maybeNode = _ref2[0], + maybeAppearing = _ref2[1]; + + var timeouts = this.getTimeouts(); + var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED + // if we are mounting and running this it means appear _must_ be set + + if (!mounting && !enter || _config.default.disabled) { + this.safeSetState({ + status: ENTERED + }, function () { + _this2.props.onEntered(maybeNode); + }); + return; + } + + this.props.onEnter(maybeNode, maybeAppearing); + this.safeSetState({ + status: ENTERING + }, function () { + _this2.props.onEntering(maybeNode, maybeAppearing); + + _this2.onTransitionEnd(enterTimeout, function () { + _this2.safeSetState({ + status: ENTERED + }, function () { + _this2.props.onEntered(maybeNode, maybeAppearing); + }); + }); + }); + }; + + _proto.performExit = function performExit() { + var _this3 = this; + + var exit = this.props.exit; + var timeouts = this.getTimeouts(); + var maybeNode = this.props.nodeRef ? undefined : _reactDom.default.findDOMNode(this); // no exit animation skip right to EXITED + + if (!exit || _config.default.disabled) { + this.safeSetState({ + status: EXITED + }, function () { + _this3.props.onExited(maybeNode); + }); + return; + } + + this.props.onExit(maybeNode); + this.safeSetState({ + status: EXITING + }, function () { + _this3.props.onExiting(maybeNode); + + _this3.onTransitionEnd(timeouts.exit, function () { + _this3.safeSetState({ + status: EXITED + }, function () { + _this3.props.onExited(maybeNode); + }); + }); + }); + }; + + _proto.cancelNextCallback = function cancelNextCallback() { + if (this.nextCallback !== null) { + this.nextCallback.cancel(); + this.nextCallback = null; + } + }; + + _proto.safeSetState = function safeSetState(nextState, callback) { + // This shouldn't be necessary, but there are weird race conditions with + // setState callbacks and unmounting in testing, so always make sure that + // we can cancel any pending setState callbacks after we unmount. + callback = this.setNextCallback(callback); + this.setState(nextState, callback); + }; + + _proto.setNextCallback = function setNextCallback(callback) { + var _this4 = this; + + var active = true; + + this.nextCallback = function (event) { + if (active) { + active = false; + _this4.nextCallback = null; + callback(event); + } + }; + + this.nextCallback.cancel = function () { + active = false; + }; + + return this.nextCallback; + }; + + _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) { + this.setNextCallback(handler); + var node = this.props.nodeRef ? this.props.nodeRef.current : _reactDom.default.findDOMNode(this); + var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener; + + if (!node || doesNotHaveTimeoutOrListener) { + setTimeout(this.nextCallback, 0); + return; + } + + if (this.props.addEndListener) { + var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], + maybeNode = _ref3[0], + maybeNextCallback = _ref3[1]; + + this.props.addEndListener(maybeNode, maybeNextCallback); + } + + if (timeout != null) { + setTimeout(this.nextCallback, timeout); + } + }; + + _proto.render = function render() { + var status = this.state.status; + + if (status === UNMOUNTED) { + return null; + } + + var _this$props = this.props, + children = _this$props.children, + _in = _this$props.in, + _mountOnEnter = _this$props.mountOnEnter, + _unmountOnExit = _this$props.unmountOnExit, + _appear = _this$props.appear, + _enter = _this$props.enter, + _exit = _this$props.exit, + _timeout = _this$props.timeout, + _addEndListener = _this$props.addEndListener, + _onEnter = _this$props.onEnter, + _onEntering = _this$props.onEntering, + _onEntered = _this$props.onEntered, + _onExit = _this$props.onExit, + _onExiting = _this$props.onExiting, + _onExited = _this$props.onExited, + _nodeRef = _this$props.nodeRef, + childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]); + + return ( + /*#__PURE__*/ + // allows for nested Transitions + _react.default.createElement(_TransitionGroupContext.default.Provider, { + value: null + }, typeof children === 'function' ? children(status, childProps) : _react.default.cloneElement(_react.default.Children.only(children), childProps)) + ); + }; + + return Transition; +}(_react.default.Component); + +Transition.contextType = _TransitionGroupContext.default; +Transition.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * A React reference to DOM element that need to transition: + * https://stackoverflow.com/a/51127130/4671932 + * + * - When `nodeRef` prop is used, `node` is not passed to callback functions + * (e.g. `onEnter`) because user already has direct access to the node. + * - When changing `key` prop of `Transition` in a `TransitionGroup` a new + * `nodeRef` need to be provided to `Transition` with changed `key` prop + * (see + * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)). + */ + nodeRef: _propTypes.default.shape({ + current: typeof Element === 'undefined' ? _propTypes.default.any : function (propValue, key, componentName, location, propFullName, secret) { + var value = propValue[key]; + return _propTypes.default.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret); + } + }), + + /** + * A `function` child can be used instead of a React element. This function is + * called with the current transition status (`'entering'`, `'entered'`, + * `'exiting'`, `'exited'`), which can be used to apply context + * specific props to a component. + * + * ```jsx + * + * {state => ( + * + * )} + * + * ``` + */ + children: _propTypes.default.oneOfType([_propTypes.default.func.isRequired, _propTypes.default.element.isRequired]).isRequired, + + /** + * Show the component; triggers the enter or exit states + */ + in: _propTypes.default.bool, + + /** + * By default the child component is mounted immediately along with + * the parent `Transition` component. If you want to "lazy mount" the component on the + * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay + * mounted, even on "exited", unless you also specify `unmountOnExit`. + */ + mountOnEnter: _propTypes.default.bool, + + /** + * By default the child component stays mounted after it reaches the `'exited'` state. + * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting. + */ + unmountOnExit: _propTypes.default.bool, + + /** + * By default the child component does not perform the enter transition when + * it first mounts, regardless of the value of `in`. If you want this + * behavior, set both `appear` and `in` to `true`. + * + * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop + * > only adds an additional enter transition. However, in the + * > `` component that first enter transition does result in + * > additional `.appear-*` classes, that way you can choose to style it + * > differently. + */ + appear: _propTypes.default.bool, + + /** + * Enable or disable enter transitions. + */ + enter: _propTypes.default.bool, + + /** + * Enable or disable exit transitions. + */ + exit: _propTypes.default.bool, + + /** + * The duration of the transition, in milliseconds. + * Required unless `addEndListener` is provided. + * + * You may specify a single timeout for all transitions: + * + * ```jsx + * timeout={500} + * ``` + * + * or individually: + * + * ```jsx + * timeout={{ + * appear: 500, + * enter: 300, + * exit: 500, + * }} + * ``` + * + * - `appear` defaults to the value of `enter` + * - `enter` defaults to `0` + * - `exit` defaults to `0` + * + * @type {number | { enter?: number, exit?: number, appear?: number }} + */ + timeout: function timeout(props) { + var pt = _PropTypes.timeoutsShape; + if (!props.addEndListener) pt = pt.isRequired; + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + return pt.apply(void 0, [props].concat(args)); + }, + + /** + * Add a custom transition end trigger. Called with the transitioning + * DOM node and a `done` callback. Allows for more fine grained transition end + * logic. Timeouts are still used as a fallback if provided. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * ```jsx + * addEndListener={(node, done) => { + * // use the css transitionend event to mark the finish of a transition + * node.addEventListener('transitionend', done, false); + * }} + * ``` + */ + addEndListener: _propTypes.default.func, + + /** + * Callback fired before the "entering" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) -> void + */ + onEnter: _propTypes.default.func, + + /** + * Callback fired after the "entering" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntering: _propTypes.default.func, + + /** + * Callback fired after the "entered" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) -> void + */ + onEntered: _propTypes.default.func, + + /** + * Callback fired before the "exiting" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement) -> void + */ + onExit: _propTypes.default.func, + + /** + * Callback fired after the "exiting" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement) -> void + */ + onExiting: _propTypes.default.func, + + /** + * Callback fired after the "exited" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) -> void + */ + onExited: _propTypes.default.func +} : {}; // Name the function so it is clearer in the documentation + +function noop() {} + +Transition.defaultProps = { + in: false, + mountOnEnter: false, + unmountOnExit: false, + appear: false, + enter: true, + exit: true, + onEnter: noop, + onEntering: noop, + onEntered: noop, + onExit: noop, + onExiting: noop, + onExited: noop +}; +Transition.UNMOUNTED = UNMOUNTED; +Transition.EXITED = EXITED; +Transition.ENTERING = ENTERING; +Transition.ENTERED = ENTERED; +Transition.EXITING = EXITING; +var _default = Transition; +exports.default = _default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/TransitionGroup.js b/src/components/node_modules/react-transition-group/cjs/TransitionGroup.js new file mode 100644 index 0000000..800a536 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/TransitionGroup.js @@ -0,0 +1,205 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _react = _interopRequireDefault(require("react")); + +var _TransitionGroupContext = _interopRequireDefault(require("./TransitionGroupContext")); + +var _ChildMapping = require("./utils/ChildMapping"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var values = Object.values || function (obj) { + return Object.keys(obj).map(function (k) { + return obj[k]; + }); +}; + +var defaultProps = { + component: 'div', + childFactory: function childFactory(child) { + return child; + } +}; +/** + * The `` component manages a set of transition components + * (`` and ``) in a list. Like with the transition + * components, `` is a state machine for managing the mounting + * and unmounting of components over time. + * + * Consider the example below. As items are removed or added to the TodoList the + * `in` prop is toggled automatically by the ``. + * + * Note that `` does not define any animation behavior! + * Exactly _how_ a list item animates is up to the individual transition + * component. This means you can mix and match animations across different list + * items. + */ + +var TransitionGroup = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(TransitionGroup, _React$Component); + + function TransitionGroup(props, context) { + var _this; + + _this = _React$Component.call(this, props, context) || this; + + var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear + + + _this.state = { + contextValue: { + isMounting: true + }, + handleExited: handleExited, + firstRender: true + }; + return _this; + } + + var _proto = TransitionGroup.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.mounted = true; + this.setState({ + contextValue: { + isMounting: false + } + }); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.mounted = false; + }; + + TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) { + var prevChildMapping = _ref.children, + handleExited = _ref.handleExited, + firstRender = _ref.firstRender; + return { + children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited), + firstRender: false + }; + } // node is `undefined` when user provided `nodeRef` prop + ; + + _proto.handleExited = function handleExited(child, node) { + var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children); + if (child.key in currentChildMapping) return; + + if (child.props.onExited) { + child.props.onExited(node); + } + + if (this.mounted) { + this.setState(function (state) { + var children = _extends({}, state.children); + + delete children[child.key]; + return { + children: children + }; + }); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + Component = _this$props.component, + childFactory = _this$props.childFactory, + props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]); + + var contextValue = this.state.contextValue; + var children = values(this.state.children).map(childFactory); + delete props.appear; + delete props.enter; + delete props.exit; + + if (Component === null) { + return /*#__PURE__*/_react.default.createElement(_TransitionGroupContext.default.Provider, { + value: contextValue + }, children); + } + + return /*#__PURE__*/_react.default.createElement(_TransitionGroupContext.default.Provider, { + value: contextValue + }, /*#__PURE__*/_react.default.createElement(Component, props, children)); + }; + + return TransitionGroup; +}(_react.default.Component); + +TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * `` renders a `
` by default. You can change this + * behavior by providing a `component` prop. + * If you use React v16+ and would like to avoid a wrapping `
` element + * you can pass in `component={null}`. This is useful if the wrapping div + * borks your css styles. + */ + component: _propTypes.default.any, + + /** + * A set of `` components, that are toggled `in` and out as they + * leave. the `` will inject specific transition props, so + * remember to spread them through if you are wrapping the `` as + * with our `` example. + * + * While this component is meant for multiple `Transition` or `CSSTransition` + * children, sometimes you may want to have a single transition child with + * content that you want to be transitioned out and in when you change it + * (e.g. routes, images etc.) In that case you can change the `key` prop of + * the transition child as you change its content, this will cause + * `TransitionGroup` to transition the child out and back in. + */ + children: _propTypes.default.node, + + /** + * A convenience prop that enables or disables appear animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + appear: _propTypes.default.bool, + + /** + * A convenience prop that enables or disables enter animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + enter: _propTypes.default.bool, + + /** + * A convenience prop that enables or disables exit animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + exit: _propTypes.default.bool, + + /** + * You may need to apply reactive updates to a child as it is exiting. + * This is generally done by using `cloneElement` however in the case of an exiting + * child the element has already been removed and not accessible to the consumer. + * + * If you do need to update a child as it leaves you can provide a `childFactory` + * to wrap every child, even the ones that are leaving. + * + * @type Function(child: ReactElement) -> ReactElement + */ + childFactory: _propTypes.default.func +} : {}; +TransitionGroup.defaultProps = defaultProps; +var _default = TransitionGroup; +exports.default = _default; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/TransitionGroupContext.js b/src/components/node_modules/react-transition-group/cjs/TransitionGroupContext.js new file mode 100644 index 0000000..4f5372e --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/TransitionGroupContext.js @@ -0,0 +1,13 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _default = _react.default.createContext(null); + +exports.default = _default; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/config.js b/src/components/node_modules/react-transition-group/cjs/config.js new file mode 100644 index 0000000..7842584 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/config.js @@ -0,0 +1,9 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; +var _default = { + disabled: false +}; +exports.default = _default; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/index.js b/src/components/node_modules/react-transition-group/cjs/index.js new file mode 100644 index 0000000..c9b54f9 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/index.js @@ -0,0 +1,30 @@ +"use strict"; + +exports.__esModule = true; +exports.config = exports.Transition = exports.TransitionGroup = exports.SwitchTransition = exports.ReplaceTransition = exports.CSSTransition = void 0; + +var _CSSTransition = _interopRequireDefault(require("./CSSTransition")); + +exports.CSSTransition = _CSSTransition.default; + +var _ReplaceTransition = _interopRequireDefault(require("./ReplaceTransition")); + +exports.ReplaceTransition = _ReplaceTransition.default; + +var _SwitchTransition = _interopRequireDefault(require("./SwitchTransition")); + +exports.SwitchTransition = _SwitchTransition.default; + +var _TransitionGroup = _interopRequireDefault(require("./TransitionGroup")); + +exports.TransitionGroup = _TransitionGroup.default; + +var _Transition = _interopRequireDefault(require("./Transition")); + +exports.Transition = _Transition.default; + +var _config = _interopRequireDefault(require("./config")); + +exports.config = _config.default; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/utils/ChildMapping.js b/src/components/node_modules/react-transition-group/cjs/utils/ChildMapping.js new file mode 100644 index 0000000..5454b9e --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/utils/ChildMapping.js @@ -0,0 +1,150 @@ +"use strict"; + +exports.__esModule = true; +exports.getChildMapping = getChildMapping; +exports.mergeChildMappings = mergeChildMappings; +exports.getInitialChildMapping = getInitialChildMapping; +exports.getNextChildMapping = getNextChildMapping; + +var _react = require("react"); + +/** + * Given `this.props.children`, return an object mapping key to child. + * + * @param {*} children `this.props.children` + * @return {object} Mapping of key to child + */ +function getChildMapping(children, mapFn) { + var mapper = function mapper(child) { + return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child; + }; + + var result = Object.create(null); + if (children) _react.Children.map(children, function (c) { + return c; + }).forEach(function (child) { + // run the map function here instead so that the key is the computed one + result[child.key] = mapper(child); + }); + return result; +} +/** + * When you're adding or removing children some may be added or removed in the + * same render pass. We want to show *both* since we want to simultaneously + * animate elements in and out. This function takes a previous set of keys + * and a new set of keys and merges them with its best guess of the correct + * ordering. In the future we may expose some of the utilities in + * ReactMultiChild to make this easy, but for now React itself does not + * directly have this concept of the union of prevChildren and nextChildren + * so we implement it here. + * + * @param {object} prev prev children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @param {object} next next children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @return {object} a key set that contains all keys in `prev` and all keys + * in `next` in a reasonable order. + */ + + +function mergeChildMappings(prev, next) { + prev = prev || {}; + next = next || {}; + + function getValueForKey(key) { + return key in next ? next[key] : prev[key]; + } // For each key of `next`, the list of keys to insert before that key in + // the combined list + + + var nextKeysPending = Object.create(null); + var pendingKeys = []; + + for (var prevKey in prev) { + if (prevKey in next) { + if (pendingKeys.length) { + nextKeysPending[prevKey] = pendingKeys; + pendingKeys = []; + } + } else { + pendingKeys.push(prevKey); + } + } + + var i; + var childMapping = {}; + + for (var nextKey in next) { + if (nextKeysPending[nextKey]) { + for (i = 0; i < nextKeysPending[nextKey].length; i++) { + var pendingNextKey = nextKeysPending[nextKey][i]; + childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); + } + } + + childMapping[nextKey] = getValueForKey(nextKey); + } // Finally, add the keys which didn't appear before any key in `next` + + + for (i = 0; i < pendingKeys.length; i++) { + childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); + } + + return childMapping; +} + +function getProp(child, prop, props) { + return props[prop] != null ? props[prop] : child.props[prop]; +} + +function getInitialChildMapping(props, onExited) { + return getChildMapping(props.children, function (child) { + return (0, _react.cloneElement)(child, { + onExited: onExited.bind(null, child), + in: true, + appear: getProp(child, 'appear', props), + enter: getProp(child, 'enter', props), + exit: getProp(child, 'exit', props) + }); + }); +} + +function getNextChildMapping(nextProps, prevChildMapping, onExited) { + var nextChildMapping = getChildMapping(nextProps.children); + var children = mergeChildMappings(prevChildMapping, nextChildMapping); + Object.keys(children).forEach(function (key) { + var child = children[key]; + if (!(0, _react.isValidElement)(child)) return; + var hasPrev = (key in prevChildMapping); + var hasNext = (key in nextChildMapping); + var prevChild = prevChildMapping[key]; + var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering) + + if (hasNext && (!hasPrev || isLeaving)) { + // console.log('entering', key) + children[key] = (0, _react.cloneElement)(child, { + onExited: onExited.bind(null, child), + in: true, + exit: getProp(child, 'exit', nextProps), + enter: getProp(child, 'enter', nextProps) + }); + } else if (!hasNext && hasPrev && !isLeaving) { + // item is old (exiting) + // console.log('leaving', key) + children[key] = (0, _react.cloneElement)(child, { + in: false + }); + } else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) { + // item hasn't changed transition states + // copy over the last transition props; + // console.log('unchanged', key) + children[key] = (0, _react.cloneElement)(child, { + onExited: onExited.bind(null, child), + in: prevChild.props.in, + exit: getProp(child, 'exit', nextProps), + enter: getProp(child, 'enter', nextProps) + }); + } + }); + return children; +} \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/utils/PropTypes.js b/src/components/node_modules/react-transition-group/cjs/utils/PropTypes.js new file mode 100644 index 0000000..69dbba0 --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/utils/PropTypes.js @@ -0,0 +1,28 @@ +"use strict"; + +exports.__esModule = true; +exports.classNamesShape = exports.timeoutsShape = void 0; + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({ + enter: _propTypes.default.number, + exit: _propTypes.default.number, + appear: _propTypes.default.number +}).isRequired]) : null; +exports.timeoutsShape = timeoutsShape; +var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({ + enter: _propTypes.default.string, + exit: _propTypes.default.string, + active: _propTypes.default.string +}), _propTypes.default.shape({ + enter: _propTypes.default.string, + enterDone: _propTypes.default.string, + enterActive: _propTypes.default.string, + exit: _propTypes.default.string, + exitDone: _propTypes.default.string, + exitActive: _propTypes.default.string +})]) : null; +exports.classNamesShape = classNamesShape; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/utils/SimpleSet.js b/src/components/node_modules/react-transition-group/cjs/utils/SimpleSet.js new file mode 100644 index 0000000..63069ad --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/utils/SimpleSet.js @@ -0,0 +1,37 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var SimpleSet = /*#__PURE__*/function () { + function SimpleSet() { + this.v = []; + } + + var _proto = SimpleSet.prototype; + + _proto.clear = function clear() { + this.v.length = 0; + }; + + _proto.has = function has(k) { + return this.v.indexOf(k) !== -1; + }; + + _proto.add = function add(k) { + if (this.has(k)) return; + this.v.push(k); + }; + + _proto.delete = function _delete(k) { + var idx = this.v.indexOf(k); + if (idx === -1) return false; + this.v.splice(idx, 1); + return true; + }; + + return SimpleSet; +}(); + +exports.default = SimpleSet; +module.exports = exports.default; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/cjs/utils/reflow.js b/src/components/node_modules/react-transition-group/cjs/utils/reflow.js new file mode 100644 index 0000000..a03558b --- /dev/null +++ b/src/components/node_modules/react-transition-group/cjs/utils/reflow.js @@ -0,0 +1,10 @@ +"use strict"; + +exports.__esModule = true; +exports.forceReflow = void 0; + +var forceReflow = function forceReflow(node) { + return node.scrollTop; +}; + +exports.forceReflow = forceReflow; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/config/package.json b/src/components/node_modules/react-transition-group/config/package.json new file mode 100644 index 0000000..d0fe72c --- /dev/null +++ b/src/components/node_modules/react-transition-group/config/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-transition-group/config", + "private": true, + "main": "../cjs/config.js", + "module": "../esm/config.js" +} diff --git a/src/components/node_modules/react-transition-group/esm/CSSTransition.js b/src/components/node_modules/react-transition-group/esm/CSSTransition.js new file mode 100644 index 0000000..fb43f53 --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/CSSTransition.js @@ -0,0 +1,412 @@ +import _extends from "@babel/runtime/helpers/esm/extends"; +import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; +import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose"; +import PropTypes from 'prop-types'; +import addOneClass from 'dom-helpers/addClass'; +import removeOneClass from 'dom-helpers/removeClass'; +import React from 'react'; +import Transition from './Transition'; +import { classNamesShape } from './utils/PropTypes'; +import { forceReflow } from './utils/reflow'; + +var _addClass = function addClass(node, classes) { + return node && classes && classes.split(' ').forEach(function (c) { + return addOneClass(node, c); + }); +}; + +var removeClass = function removeClass(node, classes) { + return node && classes && classes.split(' ').forEach(function (c) { + return removeOneClass(node, c); + }); +}; +/** + * A transition component inspired by the excellent + * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should + * use it if you're using CSS transitions or animations. It's built upon the + * [`Transition`](https://reactcommunity.org/react-transition-group/transition) + * component, so it inherits all of its props. + * + * `CSSTransition` applies a pair of class names during the `appear`, `enter`, + * and `exit` states of the transition. The first class is applied and then a + * second `*-active` class in order to activate the CSS transition. After the + * transition, matching `*-done` class names are applied to persist the + * transition state. + * + * ```jsx + * function App() { + * const [inProp, setInProp] = useState(false); + * return ( + *
+ * + *
+ * {"I'll receive my-node-* classes"} + *
+ *
+ * + *
+ * ); + * } + * ``` + * + * When the `in` prop is set to `true`, the child component will first receive + * the class `example-enter`, then the `example-enter-active` will be added in + * the next tick. `CSSTransition` [forces a + * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215) + * between before adding the `example-enter-active`. This is an important trick + * because it allows us to transition between `example-enter` and + * `example-enter-active` even though they were added immediately one after + * another. Most notably, this is what makes it possible for us to animate + * _appearance_. + * + * ```css + * .my-node-enter { + * opacity: 0; + * } + * .my-node-enter-active { + * opacity: 1; + * transition: opacity 200ms; + * } + * .my-node-exit { + * opacity: 1; + * } + * .my-node-exit-active { + * opacity: 0; + * transition: opacity 200ms; + * } + * ``` + * + * `*-active` classes represent which styles you want to animate **to**, so it's + * important to add `transition` declaration only to them, otherwise transitions + * might not behave as intended! This might not be obvious when the transitions + * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in + * the example above (minus `transition`), but it becomes apparent in more + * complex transitions. + * + * **Note**: If you're using the + * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear) + * prop, make sure to define styles for `.appear-*` classes as well. + */ + + +var CSSTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(CSSTransition, _React$Component); + + function CSSTransition() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.appliedClasses = { + appear: {}, + enter: {}, + exit: {} + }; + + _this.onEnter = function (maybeNode, maybeAppearing) { + var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument[0], + appearing = _this$resolveArgument[1]; + + _this.removeClasses(node, 'exit'); + + _this.addClass(node, appearing ? 'appear' : 'enter', 'base'); + + if (_this.props.onEnter) { + _this.props.onEnter(maybeNode, maybeAppearing); + } + }; + + _this.onEntering = function (maybeNode, maybeAppearing) { + var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument2[0], + appearing = _this$resolveArgument2[1]; + + var type = appearing ? 'appear' : 'enter'; + + _this.addClass(node, type, 'active'); + + if (_this.props.onEntering) { + _this.props.onEntering(maybeNode, maybeAppearing); + } + }; + + _this.onEntered = function (maybeNode, maybeAppearing) { + var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), + node = _this$resolveArgument3[0], + appearing = _this$resolveArgument3[1]; + + var type = appearing ? 'appear' : 'enter'; + + _this.removeClasses(node, type); + + _this.addClass(node, type, 'done'); + + if (_this.props.onEntered) { + _this.props.onEntered(maybeNode, maybeAppearing); + } + }; + + _this.onExit = function (maybeNode) { + var _this$resolveArgument4 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument4[0]; + + _this.removeClasses(node, 'appear'); + + _this.removeClasses(node, 'enter'); + + _this.addClass(node, 'exit', 'base'); + + if (_this.props.onExit) { + _this.props.onExit(maybeNode); + } + }; + + _this.onExiting = function (maybeNode) { + var _this$resolveArgument5 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument5[0]; + + _this.addClass(node, 'exit', 'active'); + + if (_this.props.onExiting) { + _this.props.onExiting(maybeNode); + } + }; + + _this.onExited = function (maybeNode) { + var _this$resolveArgument6 = _this.resolveArguments(maybeNode), + node = _this$resolveArgument6[0]; + + _this.removeClasses(node, 'exit'); + + _this.addClass(node, 'exit', 'done'); + + if (_this.props.onExited) { + _this.props.onExited(maybeNode); + } + }; + + _this.resolveArguments = function (maybeNode, maybeAppearing) { + return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing` + : [maybeNode, maybeAppearing]; + }; + + _this.getClassNames = function (type) { + var classNames = _this.props.classNames; + var isStringClassNames = typeof classNames === 'string'; + var prefix = isStringClassNames && classNames ? classNames + "-" : ''; + var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type]; + var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"]; + var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"]; + return { + baseClassName: baseClassName, + activeClassName: activeClassName, + doneClassName: doneClassName + }; + }; + + return _this; + } + + var _proto = CSSTransition.prototype; + + _proto.addClass = function addClass(node, type, phase) { + var className = this.getClassNames(type)[phase + "ClassName"]; + + var _this$getClassNames = this.getClassNames('enter'), + doneClassName = _this$getClassNames.doneClassName; + + if (type === 'appear' && phase === 'done' && doneClassName) { + className += " " + doneClassName; + } // This is to force a repaint, + // which is necessary in order to transition styles when adding a class name. + + + if (phase === 'active') { + if (node) forceReflow(node); + } + + if (className) { + this.appliedClasses[type][phase] = className; + + _addClass(node, className); + } + }; + + _proto.removeClasses = function removeClasses(node, type) { + var _this$appliedClasses$ = this.appliedClasses[type], + baseClassName = _this$appliedClasses$.base, + activeClassName = _this$appliedClasses$.active, + doneClassName = _this$appliedClasses$.done; + this.appliedClasses[type] = {}; + + if (baseClassName) { + removeClass(node, baseClassName); + } + + if (activeClassName) { + removeClass(node, activeClassName); + } + + if (doneClassName) { + removeClass(node, doneClassName); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + _ = _this$props.classNames, + props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]); + + return /*#__PURE__*/React.createElement(Transition, _extends({}, props, { + onEnter: this.onEnter, + onEntered: this.onEntered, + onEntering: this.onEntering, + onExit: this.onExit, + onExiting: this.onExiting, + onExited: this.onExited + })); + }; + + return CSSTransition; +}(React.Component); + +CSSTransition.defaultProps = { + classNames: '' +}; +CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition.propTypes, { + /** + * The animation classNames applied to the component as it appears, enters, + * exits or has finished the transition. A single name can be provided, which + * will be suffixed for each stage, e.g. `classNames="fade"` applies: + * + * - `fade-appear`, `fade-appear-active`, `fade-appear-done` + * - `fade-enter`, `fade-enter-active`, `fade-enter-done` + * - `fade-exit`, `fade-exit-active`, `fade-exit-done` + * + * A few details to note about how these classes are applied: + * + * 1. They are _joined_ with the ones that are already defined on the child + * component, so if you want to add some base styles, you can use + * `className` without worrying that it will be overridden. + * + * 2. If the transition component mounts with `in={false}`, no classes are + * applied yet. You might be expecting `*-exit-done`, but if you think + * about it, a component cannot finish exiting if it hasn't entered yet. + * + * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This + * allows you to define different behavior for when appearing is done and + * when regular entering is done, using selectors like + * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply + * an epic entrance animation when element first appears in the DOM using + * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can + * simply use `fade-enter-done` for defining both cases. + * + * Each individual classNames can also be specified independently like: + * + * ```js + * classNames={{ + * appear: 'my-appear', + * appearActive: 'my-active-appear', + * appearDone: 'my-done-appear', + * enter: 'my-enter', + * enterActive: 'my-active-enter', + * enterDone: 'my-done-enter', + * exit: 'my-exit', + * exitActive: 'my-active-exit', + * exitDone: 'my-done-exit', + * }} + * ``` + * + * If you want to set these classes using CSS Modules: + * + * ```js + * import styles from './styles.css'; + * ``` + * + * you might want to use camelCase in your CSS file, that way could simply + * spread them instead of listing them one by one: + * + * ```js + * classNames={{ ...styles }} + * ``` + * + * @type {string | { + * appear?: string, + * appearActive?: string, + * appearDone?: string, + * enter?: string, + * enterActive?: string, + * enterDone?: string, + * exit?: string, + * exitActive?: string, + * exitDone?: string, + * }} + */ + classNames: classNamesShape, + + /** + * A `` callback fired immediately after the 'enter' or 'appear' class is + * applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEnter: PropTypes.func, + + /** + * A `` callback fired immediately after the 'enter-active' or + * 'appear-active' class is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntering: PropTypes.func, + + /** + * A `` callback fired immediately after the 'enter' or + * 'appear' classes are **removed** and the `done` class is added to the DOM node. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntered: PropTypes.func, + + /** + * A `` callback fired immediately after the 'exit' class is + * applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExit: PropTypes.func, + + /** + * A `` callback fired immediately after the 'exit-active' is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExiting: PropTypes.func, + + /** + * A `` callback fired immediately after the 'exit' classes + * are **removed** and the `exit-done` class is added to the DOM node. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) + */ + onExited: PropTypes.func +}) : {}; +export default CSSTransition; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/ReplaceTransition.js b/src/components/node_modules/react-transition-group/esm/ReplaceTransition.js new file mode 100644 index 0000000..a7678c6 --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/ReplaceTransition.js @@ -0,0 +1,136 @@ +import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; +import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose"; +import PropTypes from 'prop-types'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import TransitionGroup from './TransitionGroup'; +/** + * The `` component is a specialized `Transition` component + * that animates between two children. + * + * ```jsx + * + *
I appear first
+ *
I replace the above
+ *
+ * ``` + */ + +var ReplaceTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(ReplaceTransition, _React$Component); + + function ReplaceTransition() { + var _this; + + for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { + _args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this; + + _this.handleEnter = function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + return _this.handleLifecycle('onEnter', 0, args); + }; + + _this.handleEntering = function () { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return _this.handleLifecycle('onEntering', 0, args); + }; + + _this.handleEntered = function () { + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + return _this.handleLifecycle('onEntered', 0, args); + }; + + _this.handleExit = function () { + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + return _this.handleLifecycle('onExit', 1, args); + }; + + _this.handleExiting = function () { + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + return _this.handleLifecycle('onExiting', 1, args); + }; + + _this.handleExited = function () { + for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + args[_key7] = arguments[_key7]; + } + + return _this.handleLifecycle('onExited', 1, args); + }; + + return _this; + } + + var _proto = ReplaceTransition.prototype; + + _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) { + var _child$props; + + var children = this.props.children; + var child = React.Children.toArray(children)[idx]; + if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs); + + if (this.props[handler]) { + var maybeNode = child.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); + this.props[handler](maybeNode); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + children = _this$props.children, + inProp = _this$props.in, + props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]); + + var _React$Children$toArr = React.Children.toArray(children), + first = _React$Children$toArr[0], + second = _React$Children$toArr[1]; + + delete props.onEnter; + delete props.onEntering; + delete props.onEntered; + delete props.onExit; + delete props.onExiting; + delete props.onExited; + return /*#__PURE__*/React.createElement(TransitionGroup, props, inProp ? React.cloneElement(first, { + key: 'first', + onEnter: this.handleEnter, + onEntering: this.handleEntering, + onEntered: this.handleEntered + }) : React.cloneElement(second, { + key: 'second', + onEnter: this.handleExit, + onEntering: this.handleExiting, + onEntered: this.handleExited + })); + }; + + return ReplaceTransition; +}(React.Component); + +ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? { + in: PropTypes.bool.isRequired, + children: function children(props, propName) { + if (React.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components."); + return null; + } +} : {}; +export default ReplaceTransition; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/SwitchTransition.js b/src/components/node_modules/react-transition-group/esm/SwitchTransition.js new file mode 100644 index 0000000..8ba2e9e --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/SwitchTransition.js @@ -0,0 +1,257 @@ +import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose"; + +var _leaveRenders, _enterRenders; + +import React from 'react'; +import PropTypes from 'prop-types'; +import { ENTERED, ENTERING, EXITING } from './Transition'; +import TransitionGroupContext from './TransitionGroupContext'; + +function areChildrenDifferent(oldChildren, newChildren) { + if (oldChildren === newChildren) return false; + + if (React.isValidElement(oldChildren) && React.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) { + return false; + } + + return true; +} +/** + * Enum of modes for SwitchTransition component + * @enum { string } + */ + + +export var modes = { + out: 'out-in', + in: 'in-out' +}; + +var callHook = function callHook(element, name, cb) { + return function () { + var _element$props; + + element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments); + cb(); + }; +}; + +var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) { + var current = _ref.current, + changeState = _ref.changeState; + return React.cloneElement(current, { + in: false, + onExited: callHook(current, 'onExited', function () { + changeState(ENTERING, null); + }) + }); +}, _leaveRenders[modes.in] = function (_ref2) { + var current = _ref2.current, + changeState = _ref2.changeState, + children = _ref2.children; + return [current, React.cloneElement(children, { + in: true, + onEntered: callHook(children, 'onEntered', function () { + changeState(ENTERING); + }) + })]; +}, _leaveRenders); +var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) { + var children = _ref3.children, + changeState = _ref3.changeState; + return React.cloneElement(children, { + in: true, + onEntered: callHook(children, 'onEntered', function () { + changeState(ENTERED, React.cloneElement(children, { + in: true + })); + }) + }); +}, _enterRenders[modes.in] = function (_ref4) { + var current = _ref4.current, + children = _ref4.children, + changeState = _ref4.changeState; + return [React.cloneElement(current, { + in: false, + onExited: callHook(current, 'onExited', function () { + changeState(ENTERED, React.cloneElement(children, { + in: true + })); + }) + }), React.cloneElement(children, { + in: true + })]; +}, _enterRenders); +/** + * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes). + * You can use it when you want to control the render between state transitions. + * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them. + * + * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child. + * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child. + * + * **Note**: If you want the animation to happen simultaneously + * (that is, to have the old child removed and a new child inserted **at the same time**), + * you should use + * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group) + * instead. + * + * ```jsx + * function App() { + * const [state, setState] = useState(false); + * return ( + * + * node.addEventListener("transitionend", done, false)} + * classNames='fade' + * > + * + * + * + * ); + * } + * ``` + * + * ```css + * .fade-enter{ + * opacity: 0; + * } + * .fade-exit{ + * opacity: 1; + * } + * .fade-enter-active{ + * opacity: 1; + * } + * .fade-exit-active{ + * opacity: 0; + * } + * .fade-enter-active, + * .fade-exit-active{ + * transition: opacity 500ms; + * } + * ``` + */ + +var SwitchTransition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(SwitchTransition, _React$Component); + + function SwitchTransition() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.state = { + status: ENTERED, + current: null + }; + _this.appeared = false; + + _this.changeState = function (status, current) { + if (current === void 0) { + current = _this.state.current; + } + + _this.setState({ + status: status, + current: current + }); + }; + + return _this; + } + + var _proto = SwitchTransition.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.appeared = true; + }; + + SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) { + if (props.children == null) { + return { + current: null + }; + } + + if (state.status === ENTERING && props.mode === modes.in) { + return { + status: ENTERING + }; + } + + if (state.current && areChildrenDifferent(state.current, props.children)) { + return { + status: EXITING + }; + } + + return { + current: React.cloneElement(props.children, { + in: true + }) + }; + }; + + _proto.render = function render() { + var _this$props = this.props, + children = _this$props.children, + mode = _this$props.mode, + _this$state = this.state, + status = _this$state.status, + current = _this$state.current; + var data = { + children: children, + current: current, + changeState: this.changeState, + status: status + }; + var component; + + switch (status) { + case ENTERING: + component = enterRenders[mode](data); + break; + + case EXITING: + component = leaveRenders[mode](data); + break; + + case ENTERED: + component = current; + } + + return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, { + value: { + isMounting: !this.appeared + } + }, component); + }; + + return SwitchTransition; +}(React.Component); + +SwitchTransition.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * Transition modes. + * `out-in`: Current element transitions out first, then when complete, the new element transitions in. + * `in-out`: New element transitions in first, then when complete, the current element transitions out. + * + * @type {'out-in'|'in-out'} + */ + mode: PropTypes.oneOf([modes.in, modes.out]), + + /** + * Any `Transition` or `CSSTransition` component. + */ + children: PropTypes.oneOfType([PropTypes.element.isRequired]) +} : {}; +SwitchTransition.defaultProps = { + mode: modes.out +}; +export default SwitchTransition; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/Transition.js b/src/components/node_modules/react-transition-group/esm/Transition.js new file mode 100644 index 0000000..986d29f --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/Transition.js @@ -0,0 +1,625 @@ +import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; +import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose"; +import PropTypes from 'prop-types'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import config from './config'; +import { timeoutsShape } from './utils/PropTypes'; +import TransitionGroupContext from './TransitionGroupContext'; +import { forceReflow } from './utils/reflow'; +export var UNMOUNTED = 'unmounted'; +export var EXITED = 'exited'; +export var ENTERING = 'entering'; +export var ENTERED = 'entered'; +export var EXITING = 'exiting'; +/** + * The Transition component lets you describe a transition from one component + * state to another _over time_ with a simple declarative API. Most commonly + * it's used to animate the mounting and unmounting of a component, but can also + * be used to describe in-place transition states as well. + * + * --- + * + * **Note**: `Transition` is a platform-agnostic base component. If you're using + * transitions in CSS, you'll probably want to use + * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition) + * instead. It inherits all the features of `Transition`, but contains + * additional features necessary to play nice with CSS transitions (hence the + * name of the component). + * + * --- + * + * By default the `Transition` component does not alter the behavior of the + * component it renders, it only tracks "enter" and "exit" states for the + * components. It's up to you to give meaning and effect to those states. For + * example we can add styles to a component when it enters or exits: + * + * ```jsx + * import { Transition } from 'react-transition-group'; + * + * const duration = 300; + * + * const defaultStyle = { + * transition: `opacity ${duration}ms ease-in-out`, + * opacity: 0, + * } + * + * const transitionStyles = { + * entering: { opacity: 1 }, + * entered: { opacity: 1 }, + * exiting: { opacity: 0 }, + * exited: { opacity: 0 }, + * }; + * + * const Fade = ({ in: inProp }) => ( + * + * {state => ( + *
+ * I'm a fade Transition! + *
+ * )} + *
+ * ); + * ``` + * + * There are 4 main states a Transition can be in: + * - `'entering'` + * - `'entered'` + * - `'exiting'` + * - `'exited'` + * + * Transition state is toggled via the `in` prop. When `true` the component + * begins the "Enter" stage. During this stage, the component will shift from + * its current transition state, to `'entering'` for the duration of the + * transition and then to the `'entered'` stage once it's complete. Let's take + * the following example (we'll use the + * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook): + * + * ```jsx + * function App() { + * const [inProp, setInProp] = useState(false); + * return ( + *
+ * + * {state => ( + * // ... + * )} + * + * + *
+ * ); + * } + * ``` + * + * When the button is clicked the component will shift to the `'entering'` state + * and stay there for 500ms (the value of `timeout`) before it finally switches + * to `'entered'`. + * + * When `in` is `false` the same thing happens except the state moves from + * `'exiting'` to `'exited'`. + */ + +var Transition = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(Transition, _React$Component); + + function Transition(props, context) { + var _this; + + _this = _React$Component.call(this, props, context) || this; + var parentGroup = context; // In the context of a TransitionGroup all enters are really appears + + var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; + var initialStatus; + _this.appearStatus = null; + + if (props.in) { + if (appear) { + initialStatus = EXITED; + _this.appearStatus = ENTERING; + } else { + initialStatus = ENTERED; + } + } else { + if (props.unmountOnExit || props.mountOnEnter) { + initialStatus = UNMOUNTED; + } else { + initialStatus = EXITED; + } + } + + _this.state = { + status: initialStatus + }; + _this.nextCallback = null; + return _this; + } + + Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { + var nextIn = _ref.in; + + if (nextIn && prevState.status === UNMOUNTED) { + return { + status: EXITED + }; + } + + return null; + } // getSnapshotBeforeUpdate(prevProps) { + // let nextStatus = null + // if (prevProps !== this.props) { + // const { status } = this.state + // if (this.props.in) { + // if (status !== ENTERING && status !== ENTERED) { + // nextStatus = ENTERING + // } + // } else { + // if (status === ENTERING || status === ENTERED) { + // nextStatus = EXITING + // } + // } + // } + // return { nextStatus } + // } + ; + + var _proto = Transition.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.updateStatus(true, this.appearStatus); + }; + + _proto.componentDidUpdate = function componentDidUpdate(prevProps) { + var nextStatus = null; + + if (prevProps !== this.props) { + var status = this.state.status; + + if (this.props.in) { + if (status !== ENTERING && status !== ENTERED) { + nextStatus = ENTERING; + } + } else { + if (status === ENTERING || status === ENTERED) { + nextStatus = EXITING; + } + } + } + + this.updateStatus(false, nextStatus); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.cancelNextCallback(); + }; + + _proto.getTimeouts = function getTimeouts() { + var timeout = this.props.timeout; + var exit, enter, appear; + exit = enter = appear = timeout; + + if (timeout != null && typeof timeout !== 'number') { + exit = timeout.exit; + enter = timeout.enter; // TODO: remove fallback for next major + + appear = timeout.appear !== undefined ? timeout.appear : enter; + } + + return { + exit: exit, + enter: enter, + appear: appear + }; + }; + + _proto.updateStatus = function updateStatus(mounting, nextStatus) { + if (mounting === void 0) { + mounting = false; + } + + if (nextStatus !== null) { + // nextStatus will always be ENTERING or EXITING. + this.cancelNextCallback(); + + if (nextStatus === ENTERING) { + if (this.props.unmountOnExit || this.props.mountOnEnter) { + var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749 + // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`. + // To make the animation happen, we have to separate each rendering and avoid being processed as batched. + + if (node) forceReflow(node); + } + + this.performEnter(mounting); + } else { + this.performExit(); + } + } else if (this.props.unmountOnExit && this.state.status === EXITED) { + this.setState({ + status: UNMOUNTED + }); + } + }; + + _proto.performEnter = function performEnter(mounting) { + var _this2 = this; + + var enter = this.props.enter; + var appearing = this.context ? this.context.isMounting : mounting; + + var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing], + maybeNode = _ref2[0], + maybeAppearing = _ref2[1]; + + var timeouts = this.getTimeouts(); + var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED + // if we are mounting and running this it means appear _must_ be set + + if (!mounting && !enter || config.disabled) { + this.safeSetState({ + status: ENTERED + }, function () { + _this2.props.onEntered(maybeNode); + }); + return; + } + + this.props.onEnter(maybeNode, maybeAppearing); + this.safeSetState({ + status: ENTERING + }, function () { + _this2.props.onEntering(maybeNode, maybeAppearing); + + _this2.onTransitionEnd(enterTimeout, function () { + _this2.safeSetState({ + status: ENTERED + }, function () { + _this2.props.onEntered(maybeNode, maybeAppearing); + }); + }); + }); + }; + + _proto.performExit = function performExit() { + var _this3 = this; + + var exit = this.props.exit; + var timeouts = this.getTimeouts(); + var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED + + if (!exit || config.disabled) { + this.safeSetState({ + status: EXITED + }, function () { + _this3.props.onExited(maybeNode); + }); + return; + } + + this.props.onExit(maybeNode); + this.safeSetState({ + status: EXITING + }, function () { + _this3.props.onExiting(maybeNode); + + _this3.onTransitionEnd(timeouts.exit, function () { + _this3.safeSetState({ + status: EXITED + }, function () { + _this3.props.onExited(maybeNode); + }); + }); + }); + }; + + _proto.cancelNextCallback = function cancelNextCallback() { + if (this.nextCallback !== null) { + this.nextCallback.cancel(); + this.nextCallback = null; + } + }; + + _proto.safeSetState = function safeSetState(nextState, callback) { + // This shouldn't be necessary, but there are weird race conditions with + // setState callbacks and unmounting in testing, so always make sure that + // we can cancel any pending setState callbacks after we unmount. + callback = this.setNextCallback(callback); + this.setState(nextState, callback); + }; + + _proto.setNextCallback = function setNextCallback(callback) { + var _this4 = this; + + var active = true; + + this.nextCallback = function (event) { + if (active) { + active = false; + _this4.nextCallback = null; + callback(event); + } + }; + + this.nextCallback.cancel = function () { + active = false; + }; + + return this.nextCallback; + }; + + _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) { + this.setNextCallback(handler); + var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); + var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener; + + if (!node || doesNotHaveTimeoutOrListener) { + setTimeout(this.nextCallback, 0); + return; + } + + if (this.props.addEndListener) { + var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], + maybeNode = _ref3[0], + maybeNextCallback = _ref3[1]; + + this.props.addEndListener(maybeNode, maybeNextCallback); + } + + if (timeout != null) { + setTimeout(this.nextCallback, timeout); + } + }; + + _proto.render = function render() { + var status = this.state.status; + + if (status === UNMOUNTED) { + return null; + } + + var _this$props = this.props, + children = _this$props.children, + _in = _this$props.in, + _mountOnEnter = _this$props.mountOnEnter, + _unmountOnExit = _this$props.unmountOnExit, + _appear = _this$props.appear, + _enter = _this$props.enter, + _exit = _this$props.exit, + _timeout = _this$props.timeout, + _addEndListener = _this$props.addEndListener, + _onEnter = _this$props.onEnter, + _onEntering = _this$props.onEntering, + _onEntered = _this$props.onEntered, + _onExit = _this$props.onExit, + _onExiting = _this$props.onExiting, + _onExited = _this$props.onExited, + _nodeRef = _this$props.nodeRef, + childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]); + + return ( + /*#__PURE__*/ + // allows for nested Transitions + React.createElement(TransitionGroupContext.Provider, { + value: null + }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps)) + ); + }; + + return Transition; +}(React.Component); + +Transition.contextType = TransitionGroupContext; +Transition.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * A React reference to DOM element that need to transition: + * https://stackoverflow.com/a/51127130/4671932 + * + * - When `nodeRef` prop is used, `node` is not passed to callback functions + * (e.g. `onEnter`) because user already has direct access to the node. + * - When changing `key` prop of `Transition` in a `TransitionGroup` a new + * `nodeRef` need to be provided to `Transition` with changed `key` prop + * (see + * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)). + */ + nodeRef: PropTypes.shape({ + current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) { + var value = propValue[key]; + return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret); + } + }), + + /** + * A `function` child can be used instead of a React element. This function is + * called with the current transition status (`'entering'`, `'entered'`, + * `'exiting'`, `'exited'`), which can be used to apply context + * specific props to a component. + * + * ```jsx + * + * {state => ( + * + * )} + * + * ``` + */ + children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired, + + /** + * Show the component; triggers the enter or exit states + */ + in: PropTypes.bool, + + /** + * By default the child component is mounted immediately along with + * the parent `Transition` component. If you want to "lazy mount" the component on the + * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay + * mounted, even on "exited", unless you also specify `unmountOnExit`. + */ + mountOnEnter: PropTypes.bool, + + /** + * By default the child component stays mounted after it reaches the `'exited'` state. + * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting. + */ + unmountOnExit: PropTypes.bool, + + /** + * By default the child component does not perform the enter transition when + * it first mounts, regardless of the value of `in`. If you want this + * behavior, set both `appear` and `in` to `true`. + * + * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop + * > only adds an additional enter transition. However, in the + * > `` component that first enter transition does result in + * > additional `.appear-*` classes, that way you can choose to style it + * > differently. + */ + appear: PropTypes.bool, + + /** + * Enable or disable enter transitions. + */ + enter: PropTypes.bool, + + /** + * Enable or disable exit transitions. + */ + exit: PropTypes.bool, + + /** + * The duration of the transition, in milliseconds. + * Required unless `addEndListener` is provided. + * + * You may specify a single timeout for all transitions: + * + * ```jsx + * timeout={500} + * ``` + * + * or individually: + * + * ```jsx + * timeout={{ + * appear: 500, + * enter: 300, + * exit: 500, + * }} + * ``` + * + * - `appear` defaults to the value of `enter` + * - `enter` defaults to `0` + * - `exit` defaults to `0` + * + * @type {number | { enter?: number, exit?: number, appear?: number }} + */ + timeout: function timeout(props) { + var pt = timeoutsShape; + if (!props.addEndListener) pt = pt.isRequired; + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + return pt.apply(void 0, [props].concat(args)); + }, + + /** + * Add a custom transition end trigger. Called with the transitioning + * DOM node and a `done` callback. Allows for more fine grained transition end + * logic. Timeouts are still used as a fallback if provided. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * ```jsx + * addEndListener={(node, done) => { + * // use the css transitionend event to mark the finish of a transition + * node.addEventListener('transitionend', done, false); + * }} + * ``` + */ + addEndListener: PropTypes.func, + + /** + * Callback fired before the "entering" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) -> void + */ + onEnter: PropTypes.func, + + /** + * Callback fired after the "entering" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) + */ + onEntering: PropTypes.func, + + /** + * Callback fired after the "entered" status is applied. An extra parameter + * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement, isAppearing: bool) -> void + */ + onEntered: PropTypes.func, + + /** + * Callback fired before the "exiting" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement) -> void + */ + onExit: PropTypes.func, + + /** + * Callback fired after the "exiting" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed. + * + * @type Function(node: HtmlElement) -> void + */ + onExiting: PropTypes.func, + + /** + * Callback fired after the "exited" status is applied. + * + * **Note**: when `nodeRef` prop is passed, `node` is not passed + * + * @type Function(node: HtmlElement) -> void + */ + onExited: PropTypes.func +} : {}; // Name the function so it is clearer in the documentation + +function noop() {} + +Transition.defaultProps = { + in: false, + mountOnEnter: false, + unmountOnExit: false, + appear: false, + enter: true, + exit: true, + onEnter: noop, + onEntering: noop, + onEntered: noop, + onExit: noop, + onExiting: noop, + onExited: noop +}; +Transition.UNMOUNTED = UNMOUNTED; +Transition.EXITED = EXITED; +Transition.ENTERING = ENTERING; +Transition.ENTERED = ENTERED; +Transition.EXITING = EXITING; +export default Transition; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/TransitionGroup.js b/src/components/node_modules/react-transition-group/esm/TransitionGroup.js new file mode 100644 index 0000000..8e4deb3 --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/TransitionGroup.js @@ -0,0 +1,189 @@ +import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; +import _extends from "@babel/runtime/helpers/esm/extends"; +import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized"; +import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose"; +import PropTypes from 'prop-types'; +import React from 'react'; +import TransitionGroupContext from './TransitionGroupContext'; +import { getChildMapping, getInitialChildMapping, getNextChildMapping } from './utils/ChildMapping'; + +var values = Object.values || function (obj) { + return Object.keys(obj).map(function (k) { + return obj[k]; + }); +}; + +var defaultProps = { + component: 'div', + childFactory: function childFactory(child) { + return child; + } +}; +/** + * The `` component manages a set of transition components + * (`` and ``) in a list. Like with the transition + * components, `` is a state machine for managing the mounting + * and unmounting of components over time. + * + * Consider the example below. As items are removed or added to the TodoList the + * `in` prop is toggled automatically by the ``. + * + * Note that `` does not define any animation behavior! + * Exactly _how_ a list item animates is up to the individual transition + * component. This means you can mix and match animations across different list + * items. + */ + +var TransitionGroup = /*#__PURE__*/function (_React$Component) { + _inheritsLoose(TransitionGroup, _React$Component); + + function TransitionGroup(props, context) { + var _this; + + _this = _React$Component.call(this, props, context) || this; + + var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear + + + _this.state = { + contextValue: { + isMounting: true + }, + handleExited: handleExited, + firstRender: true + }; + return _this; + } + + var _proto = TransitionGroup.prototype; + + _proto.componentDidMount = function componentDidMount() { + this.mounted = true; + this.setState({ + contextValue: { + isMounting: false + } + }); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.mounted = false; + }; + + TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) { + var prevChildMapping = _ref.children, + handleExited = _ref.handleExited, + firstRender = _ref.firstRender; + return { + children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited), + firstRender: false + }; + } // node is `undefined` when user provided `nodeRef` prop + ; + + _proto.handleExited = function handleExited(child, node) { + var currentChildMapping = getChildMapping(this.props.children); + if (child.key in currentChildMapping) return; + + if (child.props.onExited) { + child.props.onExited(node); + } + + if (this.mounted) { + this.setState(function (state) { + var children = _extends({}, state.children); + + delete children[child.key]; + return { + children: children + }; + }); + } + }; + + _proto.render = function render() { + var _this$props = this.props, + Component = _this$props.component, + childFactory = _this$props.childFactory, + props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]); + + var contextValue = this.state.contextValue; + var children = values(this.state.children).map(childFactory); + delete props.appear; + delete props.enter; + delete props.exit; + + if (Component === null) { + return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, { + value: contextValue + }, children); + } + + return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, { + value: contextValue + }, /*#__PURE__*/React.createElement(Component, props, children)); + }; + + return TransitionGroup; +}(React.Component); + +TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? { + /** + * `` renders a `
` by default. You can change this + * behavior by providing a `component` prop. + * If you use React v16+ and would like to avoid a wrapping `
` element + * you can pass in `component={null}`. This is useful if the wrapping div + * borks your css styles. + */ + component: PropTypes.any, + + /** + * A set of `` components, that are toggled `in` and out as they + * leave. the `` will inject specific transition props, so + * remember to spread them through if you are wrapping the `` as + * with our `` example. + * + * While this component is meant for multiple `Transition` or `CSSTransition` + * children, sometimes you may want to have a single transition child with + * content that you want to be transitioned out and in when you change it + * (e.g. routes, images etc.) In that case you can change the `key` prop of + * the transition child as you change its content, this will cause + * `TransitionGroup` to transition the child out and back in. + */ + children: PropTypes.node, + + /** + * A convenience prop that enables or disables appear animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + appear: PropTypes.bool, + + /** + * A convenience prop that enables or disables enter animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + enter: PropTypes.bool, + + /** + * A convenience prop that enables or disables exit animations + * for all children. Note that specifying this will override any defaults set + * on individual children Transitions. + */ + exit: PropTypes.bool, + + /** + * You may need to apply reactive updates to a child as it is exiting. + * This is generally done by using `cloneElement` however in the case of an exiting + * child the element has already been removed and not accessible to the consumer. + * + * If you do need to update a child as it leaves you can provide a `childFactory` + * to wrap every child, even the ones that are leaving. + * + * @type Function(child: ReactElement) -> ReactElement + */ + childFactory: PropTypes.func +} : {}; +TransitionGroup.defaultProps = defaultProps; +export default TransitionGroup; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/TransitionGroupContext.js b/src/components/node_modules/react-transition-group/esm/TransitionGroupContext.js new file mode 100644 index 0000000..659d70e --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/TransitionGroupContext.js @@ -0,0 +1,2 @@ +import React from 'react'; +export default React.createContext(null); \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/config.js b/src/components/node_modules/react-transition-group/esm/config.js new file mode 100644 index 0000000..3bb7274 --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/config.js @@ -0,0 +1,3 @@ +export default { + disabled: false +}; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/index.js b/src/components/node_modules/react-transition-group/esm/index.js new file mode 100644 index 0000000..1856bac --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/index.js @@ -0,0 +1,6 @@ +export { default as CSSTransition } from './CSSTransition'; +export { default as ReplaceTransition } from './ReplaceTransition'; +export { default as SwitchTransition } from './SwitchTransition'; +export { default as TransitionGroup } from './TransitionGroup'; +export { default as Transition } from './Transition'; +export { default as config } from './config'; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/utils/ChildMapping.js b/src/components/node_modules/react-transition-group/esm/utils/ChildMapping.js new file mode 100644 index 0000000..86f32cf --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/utils/ChildMapping.js @@ -0,0 +1,140 @@ +import { Children, cloneElement, isValidElement } from 'react'; +/** + * Given `this.props.children`, return an object mapping key to child. + * + * @param {*} children `this.props.children` + * @return {object} Mapping of key to child + */ + +export function getChildMapping(children, mapFn) { + var mapper = function mapper(child) { + return mapFn && isValidElement(child) ? mapFn(child) : child; + }; + + var result = Object.create(null); + if (children) Children.map(children, function (c) { + return c; + }).forEach(function (child) { + // run the map function here instead so that the key is the computed one + result[child.key] = mapper(child); + }); + return result; +} +/** + * When you're adding or removing children some may be added or removed in the + * same render pass. We want to show *both* since we want to simultaneously + * animate elements in and out. This function takes a previous set of keys + * and a new set of keys and merges them with its best guess of the correct + * ordering. In the future we may expose some of the utilities in + * ReactMultiChild to make this easy, but for now React itself does not + * directly have this concept of the union of prevChildren and nextChildren + * so we implement it here. + * + * @param {object} prev prev children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @param {object} next next children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @return {object} a key set that contains all keys in `prev` and all keys + * in `next` in a reasonable order. + */ + +export function mergeChildMappings(prev, next) { + prev = prev || {}; + next = next || {}; + + function getValueForKey(key) { + return key in next ? next[key] : prev[key]; + } // For each key of `next`, the list of keys to insert before that key in + // the combined list + + + var nextKeysPending = Object.create(null); + var pendingKeys = []; + + for (var prevKey in prev) { + if (prevKey in next) { + if (pendingKeys.length) { + nextKeysPending[prevKey] = pendingKeys; + pendingKeys = []; + } + } else { + pendingKeys.push(prevKey); + } + } + + var i; + var childMapping = {}; + + for (var nextKey in next) { + if (nextKeysPending[nextKey]) { + for (i = 0; i < nextKeysPending[nextKey].length; i++) { + var pendingNextKey = nextKeysPending[nextKey][i]; + childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); + } + } + + childMapping[nextKey] = getValueForKey(nextKey); + } // Finally, add the keys which didn't appear before any key in `next` + + + for (i = 0; i < pendingKeys.length; i++) { + childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); + } + + return childMapping; +} + +function getProp(child, prop, props) { + return props[prop] != null ? props[prop] : child.props[prop]; +} + +export function getInitialChildMapping(props, onExited) { + return getChildMapping(props.children, function (child) { + return cloneElement(child, { + onExited: onExited.bind(null, child), + in: true, + appear: getProp(child, 'appear', props), + enter: getProp(child, 'enter', props), + exit: getProp(child, 'exit', props) + }); + }); +} +export function getNextChildMapping(nextProps, prevChildMapping, onExited) { + var nextChildMapping = getChildMapping(nextProps.children); + var children = mergeChildMappings(prevChildMapping, nextChildMapping); + Object.keys(children).forEach(function (key) { + var child = children[key]; + if (!isValidElement(child)) return; + var hasPrev = (key in prevChildMapping); + var hasNext = (key in nextChildMapping); + var prevChild = prevChildMapping[key]; + var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering) + + if (hasNext && (!hasPrev || isLeaving)) { + // console.log('entering', key) + children[key] = cloneElement(child, { + onExited: onExited.bind(null, child), + in: true, + exit: getProp(child, 'exit', nextProps), + enter: getProp(child, 'enter', nextProps) + }); + } else if (!hasNext && hasPrev && !isLeaving) { + // item is old (exiting) + // console.log('leaving', key) + children[key] = cloneElement(child, { + in: false + }); + } else if (hasNext && hasPrev && isValidElement(prevChild)) { + // item hasn't changed transition states + // copy over the last transition props; + // console.log('unchanged', key) + children[key] = cloneElement(child, { + onExited: onExited.bind(null, child), + in: prevChild.props.in, + exit: getProp(child, 'exit', nextProps), + enter: getProp(child, 'enter', nextProps) + }); + } + }); + return children; +} \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/utils/PropTypes.js b/src/components/node_modules/react-transition-group/esm/utils/PropTypes.js new file mode 100644 index 0000000..b67473e --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/utils/PropTypes.js @@ -0,0 +1,18 @@ +import PropTypes from 'prop-types'; +export var timeoutsShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.shape({ + enter: PropTypes.number, + exit: PropTypes.number, + appear: PropTypes.number +}).isRequired]) : null; +export var classNamesShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.string, PropTypes.shape({ + enter: PropTypes.string, + exit: PropTypes.string, + active: PropTypes.string +}), PropTypes.shape({ + enter: PropTypes.string, + enterDone: PropTypes.string, + enterActive: PropTypes.string, + exit: PropTypes.string, + exitDone: PropTypes.string, + exitActive: PropTypes.string +})]) : null; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/utils/SimpleSet.js b/src/components/node_modules/react-transition-group/esm/utils/SimpleSet.js new file mode 100644 index 0000000..6ef979c --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/utils/SimpleSet.js @@ -0,0 +1,31 @@ +var SimpleSet = /*#__PURE__*/function () { + function SimpleSet() { + this.v = []; + } + + var _proto = SimpleSet.prototype; + + _proto.clear = function clear() { + this.v.length = 0; + }; + + _proto.has = function has(k) { + return this.v.indexOf(k) !== -1; + }; + + _proto.add = function add(k) { + if (this.has(k)) return; + this.v.push(k); + }; + + _proto.delete = function _delete(k) { + var idx = this.v.indexOf(k); + if (idx === -1) return false; + this.v.splice(idx, 1); + return true; + }; + + return SimpleSet; +}(); + +export { SimpleSet as default }; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/esm/utils/reflow.js b/src/components/node_modules/react-transition-group/esm/utils/reflow.js new file mode 100644 index 0000000..62c5029 --- /dev/null +++ b/src/components/node_modules/react-transition-group/esm/utils/reflow.js @@ -0,0 +1,3 @@ +export var forceReflow = function forceReflow(node) { + return node.scrollTop; +}; \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/node_modules/.bin/loose-envify b/src/components/node_modules/react-transition-group/node_modules/.bin/loose-envify new file mode 120000 index 0000000..2a6b8df --- /dev/null +++ b/src/components/node_modules/react-transition-group/node_modules/.bin/loose-envify @@ -0,0 +1 @@ +../../../loose-envify/cli.js \ No newline at end of file diff --git a/src/components/node_modules/react-transition-group/package.json b/src/components/node_modules/react-transition-group/package.json new file mode 100644 index 0000000..e9bd537 --- /dev/null +++ b/src/components/node_modules/react-transition-group/package.json @@ -0,0 +1,69 @@ +{ + "name": "react-transition-group", + "version": "4.4.5", + "description": "A react component toolset for managing animations", + "main": "cjs/index.js", + "module": "esm/index.js", + "repository": { + "type": "git", + "url": "https://github.com/reactjs/react-transition-group.git" + }, + "keywords": [ + "react", + "transition", + "addons", + "transition-group", + "animation", + "css", + "transitions" + ], + "author": "", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/reactjs/react-transition-group/issues" + }, + "homepage": "https://github.com/reactjs/react-transition-group#readme", + "jest": { + "testRegex": "-test\\.js", + "setupFiles": [ + "./test/setup.js" + ], + "setupFilesAfterEnv": [ + "./test/setupAfterEnv.js" + ], + "roots": [ + "/test" + ] + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + }, + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "release": { + "pkgRoot": "lib", + "verifyConditions": [ + "@semantic-release/changelog", + "semantic-release-alt-publish-dir", + "@semantic-release/git", + "@semantic-release/github" + ], + "prepare": [ + "@semantic-release/changelog", + "semantic-release-alt-publish-dir", + "@semantic-release/npm", + "@semantic-release/git" + ] + }, + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "sideEffects": false +} diff --git a/src/components/node_modules/regenerator-runtime/LICENSE b/src/components/node_modules/regenerator-runtime/LICENSE new file mode 100644 index 0000000..cde61b6 --- /dev/null +++ b/src/components/node_modules/regenerator-runtime/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/components/node_modules/regenerator-runtime/README.md b/src/components/node_modules/regenerator-runtime/README.md new file mode 100644 index 0000000..e8702ba --- /dev/null +++ b/src/components/node_modules/regenerator-runtime/README.md @@ -0,0 +1,31 @@ +# regenerator-runtime + +Standalone runtime for +[Regenerator](https://github.com/facebook/regenerator)-compiled generator +and `async` functions. + +To import the runtime as a module (recommended), either of the following +import styles will work: +```js +// CommonJS +const regeneratorRuntime = require("regenerator-runtime"); + +// ECMAScript 2015 +import regeneratorRuntime from "regenerator-runtime"; +``` + +To ensure that `regeneratorRuntime` is defined globally, either of the +following styles will work: +```js +// CommonJS +require("regenerator-runtime/runtime"); + +// ECMAScript 2015 +import "regenerator-runtime/runtime.js"; +``` + +To get the absolute file system path of `runtime.js`, evaluate the +following expression: +```js +require("regenerator-runtime/path").path +``` diff --git a/src/components/node_modules/regenerator-runtime/package.json b/src/components/node_modules/regenerator-runtime/package.json new file mode 100644 index 0000000..23575f4 --- /dev/null +++ b/src/components/node_modules/regenerator-runtime/package.json @@ -0,0 +1,19 @@ +{ + "name": "regenerator-runtime", + "author": "Ben Newman ", + "description": "Runtime for Regenerator-compiled generator and async functions.", + "version": "0.13.9", + "main": "runtime.js", + "keywords": [ + "regenerator", + "runtime", + "generator", + "async" + ], + "sideEffects": true, + "repository": { + "type": "git", + "url": "https://github.com/facebook/regenerator/tree/master/packages/runtime" + }, + "license": "MIT" +} diff --git a/src/components/node_modules/regenerator-runtime/path.js b/src/components/node_modules/regenerator-runtime/path.js new file mode 100644 index 0000000..ced878b --- /dev/null +++ b/src/components/node_modules/regenerator-runtime/path.js @@ -0,0 +1,11 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +exports.path = require("path").join( + __dirname, + "runtime.js" +); diff --git a/src/components/node_modules/regenerator-runtime/runtime.js b/src/components/node_modules/regenerator-runtime/runtime.js new file mode 100644 index 0000000..a64424e --- /dev/null +++ b/src/components/node_modules/regenerator-runtime/runtime.js @@ -0,0 +1,754 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var runtime = (function (exports) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + function define(obj, key, value) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + return obj[key]; + } + try { + // IE 8 has a broken Object.defineProperty that only works on DOM objects. + define({}, ""); + } catch (err) { + define = function(obj, key, value) { + return obj[key] = value; + }; + } + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + exports.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function () { + return this; + }); + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = GeneratorFunctionPrototype; + define(Gp, "constructor", GeneratorFunctionPrototype); + define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); + GeneratorFunction.displayName = define( + GeneratorFunctionPrototype, + toStringTagSymbol, + "GeneratorFunction" + ); + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + define(prototype, method, function(arg) { + return this._invoke(method, arg); + }); + }); + } + + exports.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + exports.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + define(genFun, toStringTagSymbol, "GeneratorFunction"); + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + exports.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return PromiseImpl.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return PromiseImpl.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + define(AsyncIterator.prototype, asyncIteratorSymbol, function () { + return this; + }); + exports.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { + if (PromiseImpl === void 0) PromiseImpl = Promise; + + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList), + PromiseImpl + ); + + return exports.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + // Note: ["return"] must be used for ES3 parsing compatibility. + if (delegate.iterator["return"]) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + define(Gp, toStringTagSymbol, "Generator"); + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + define(Gp, iteratorSymbol, function() { + return this; + }); + + define(Gp, "toString", function() { + return "[object Generator]"; + }); + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + exports.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + exports.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + typeof module === "object" ? module.exports : {} +)); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just + // in case runtime.js accidentally runs in strict mode, in modern engines + // we can explicitly access globalThis. In older engines we can escape + // strict mode using a global Function call. This could conceivably fail + // if a Content Security Policy forbids using Function, but in that case + // the proper solution is to fix the accidental strict mode problem. If + // you've misconfigured your bundler to force strict mode and applied a + // CSP to forbid Function, and you're not willing to fix either of those + // problems, please detail your unique predicament in a GitHub issue. + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} diff --git a/src/components/node_modules/resolve-from/index.js b/src/components/node_modules/resolve-from/index.js new file mode 100644 index 0000000..d092447 --- /dev/null +++ b/src/components/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDir, moduleId, silent) => { + if (typeof fromDir !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDir = fs.realpathSync(fromDir); + } catch (err) { + if (err.code === 'ENOENT') { + fromDir = path.resolve(fromDir); + } else if (silent) { + return null; + } else { + throw err; + } + } + + const fromFile = path.join(fromDir, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (err) { + return null; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); +module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); diff --git a/src/components/node_modules/resolve-from/license b/src/components/node_modules/resolve-from/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/src/components/node_modules/resolve-from/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/components/node_modules/resolve-from/package.json b/src/components/node_modules/resolve-from/package.json new file mode 100644 index 0000000..96bade5 --- /dev/null +++ b/src/components/node_modules/resolve-from/package.json @@ -0,0 +1,34 @@ +{ + "name": "resolve-from", + "version": "4.0.0", + "description": "Resolve the path of a module like `require.resolve()` but from a given path", + "license": "MIT", + "repository": "sindresorhus/resolve-from", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/src/components/node_modules/resolve-from/readme.md b/src/components/node_modules/resolve-from/readme.md new file mode 100644 index 0000000..e539f85 --- /dev/null +++ b/src/components/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDir, moduleId) + +Returns `null` instead of throwing when the module can't be found. + +#### fromDir + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/src/components/node_modules/resolve/.editorconfig b/src/components/node_modules/resolve/.editorconfig new file mode 100644 index 0000000..d63f0bb --- /dev/null +++ b/src/components/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off +max_line_length = off +insert_final_newline = off diff --git a/src/components/node_modules/resolve/.eslintrc b/src/components/node_modules/resolve/.eslintrc new file mode 100644 index 0000000..ce1be6e --- /dev/null +++ b/src/components/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 30 }], + "max-lines": [2, 350], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/src/components/node_modules/resolve/.github/FUNDING.yml b/src/components/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 0000000..d9c0595 --- /dev/null +++ b/src/components/node_modules/resolve/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/resolve +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/src/components/node_modules/resolve/LICENSE b/src/components/node_modules/resolve/LICENSE new file mode 100644 index 0000000..ff4fce2 --- /dev/null +++ b/src/components/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/components/node_modules/resolve/SECURITY.md b/src/components/node_modules/resolve/SECURITY.md new file mode 100644 index 0000000..82e4285 --- /dev/null +++ b/src/components/node_modules/resolve/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/src/components/node_modules/resolve/async.js b/src/components/node_modules/resolve/async.js new file mode 100644 index 0000000..f38c581 --- /dev/null +++ b/src/components/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/src/components/node_modules/resolve/bin/resolve b/src/components/node_modules/resolve/bin/resolve new file mode 100755 index 0000000..5ee329a --- /dev/null +++ b/src/components/node_modules/resolve/bin/resolve @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +if ( + String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve ' + && ( + !process.argv + || process.argv.length < 2 + || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino) + || (process.env._ && path.resolve(process.env._) !== __filename) + ) +) { + console.error('Error: `resolve` must be run directly as an executable'); + process.exit(1); +} + +var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag'); + +var preserveSymlinks = false; +for (var i = 2; i < process.argv.length; i += 1) { + if (process.argv[i].slice(0, 2) === '--') { + if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') { + preserveSymlinks = true; + } else if (process.argv[i].length > 2) { + console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, '')); + process.exit(2); + } + process.argv.splice(i, 1); + i -= 1; + if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax + } +} + +if (process.argv.length < 3) { + console.error('Error: `resolve` expects a specifier'); + process.exit(2); +} + +var resolve = require('../'); + +var result = resolve.sync(process.argv[2], { + basedir: process.cwd(), + preserveSymlinks: preserveSymlinks +}); + +console.log(result); diff --git a/src/components/node_modules/resolve/example/async.js b/src/components/node_modules/resolve/example/async.js new file mode 100644 index 0000000..20e65dc --- /dev/null +++ b/src/components/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/src/components/node_modules/resolve/example/sync.js b/src/components/node_modules/resolve/example/sync.js new file mode 100644 index 0000000..54b2cc1 --- /dev/null +++ b/src/components/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/src/components/node_modules/resolve/index.js b/src/components/node_modules/resolve/index.js new file mode 100644 index 0000000..125d814 --- /dev/null +++ b/src/components/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/src/components/node_modules/resolve/lib/async.js b/src/components/node_modules/resolve/lib/async.js new file mode 100644 index 0000000..60d2555 --- /dev/null +++ b/src/components/node_modules/resolve/lib/async.js @@ -0,0 +1,329 @@ +var fs = require('fs'); +var getHomedir = require('./homedir'); +var path = require('path'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var readPackage = opts.readPackage || defaultReadPackage; + if (opts.readFile && opts.readPackage) { + var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.'); + return process.nextTick(function () { + cb(conflictErr); + }); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) return cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; diff --git a/src/components/node_modules/resolve/lib/caller.js b/src/components/node_modules/resolve/lib/caller.js new file mode 100644 index 0000000..b14a280 --- /dev/null +++ b/src/components/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/src/components/node_modules/resolve/lib/core.js b/src/components/node_modules/resolve/lib/core.js new file mode 100644 index 0000000..ecc5b2e --- /dev/null +++ b/src/components/node_modules/resolve/lib/core.js @@ -0,0 +1,52 @@ +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + +function specifierIncluded(specifier) { + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = parseInt(current[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } + return false; + } + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { return false; } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { return false; } + } + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { return specifierValue; } + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { return true; } + } + return false; + } + return matchesRange(specifierValue); +} + +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); + } +} +module.exports = core; diff --git a/src/components/node_modules/resolve/lib/core.json b/src/components/node_modules/resolve/lib/core.json new file mode 100644 index 0000000..058584b --- /dev/null +++ b/src/components/node_modules/resolve/lib/core.json @@ -0,0 +1,153 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "node:test": ">= 18", + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/src/components/node_modules/resolve/lib/homedir.js b/src/components/node_modules/resolve/lib/homedir.js new file mode 100644 index 0000000..5ffdf73 --- /dev/null +++ b/src/components/node_modules/resolve/lib/homedir.js @@ -0,0 +1,24 @@ +'use strict'; + +var os = require('os'); + +// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js + +module.exports = os.homedir || function homedir() { + var home = process.env.HOME; + var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME; + + if (process.platform === 'win32') { + return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens + } + + return home || null; +}; diff --git a/src/components/node_modules/resolve/lib/is-core.js b/src/components/node_modules/resolve/lib/is-core.js new file mode 100644 index 0000000..537f5c7 --- /dev/null +++ b/src/components/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/src/components/node_modules/resolve/lib/node-modules-paths.js b/src/components/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 0000000..1cff010 --- /dev/null +++ b/src/components/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,42 @@ +var path = require('path'); +var parse = path.parse || require('path-parse'); // eslint-disable-line global-require + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/src/components/node_modules/resolve/lib/normalize-options.js b/src/components/node_modules/resolve/lib/normalize-options.js new file mode 100644 index 0000000..4b56904 --- /dev/null +++ b/src/components/node_modules/resolve/lib/normalize-options.js @@ -0,0 +1,10 @@ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; diff --git a/src/components/node_modules/resolve/lib/sync.js b/src/components/node_modules/resolve/lib/sync.js new file mode 100644 index 0000000..0b6cd58 --- /dev/null +++ b/src/components/node_modules/resolve/lib/sync.js @@ -0,0 +1,208 @@ +var isCore = require('is-core-module'); +var fs = require('fs'); +var path = require('path'); +var getHomedir = require('./homedir'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && (stat.isFile() || stat.isFIFO()); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; + if (opts.readFileSync && opts.readPackageSync) { + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var pkg = readPackageSync(readFileSync, pkgfile); + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var pkg = readPackageSync(readFileSync, pkgfile); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; diff --git a/src/components/node_modules/resolve/package.json b/src/components/node_modules/resolve/package.json new file mode 100644 index 0000000..7177e0f --- /dev/null +++ b/src/components/node_modules/resolve/package.json @@ -0,0 +1,71 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.1", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && aud --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "array.prototype.map": "^1.0.4", + "aud": "^2.0.0", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "npmignore": "^0.3.0", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tap": "0.4.13", + "tape": "^5.5.3", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "appveyor.yml" + ] + } +} diff --git a/src/components/node_modules/resolve/readme.markdown b/src/components/node_modules/resolve/readme.markdown new file mode 100644 index 0000000..ad34d60 --- /dev/null +++ b/src/components/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/src/components/node_modules/resolve/sync.js b/src/components/node_modules/resolve/sync.js new file mode 100644 index 0000000..cd0ee04 --- /dev/null +++ b/src/components/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/src/components/node_modules/resolve/test/core.js b/src/components/node_modules/resolve/test/core.js new file mode 100644 index 0000000..a477adc --- /dev/null +++ b/src/components/node_modules/resolve/test/core.js @@ -0,0 +1,88 @@ +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); + +var resolve = require('../'); + +var brokenNode = semver.satisfies(process.version, '11.11 - 11.13'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + // note: this must be require, not require.resolve, due to https://github.com/nodejs/node/issues/43274 + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + t.comment(mod + ': ' + resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else if (brokenNode) { + st.ok(true, 'this version of node is broken: attempting to require things that fail to resolve breaks "home_paths" tests'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.end(); +}); diff --git a/src/components/node_modules/resolve/test/dotdot.js b/src/components/node_modules/resolve/test/dotdot.js new file mode 100644 index 0000000..3080665 --- /dev/null +++ b/src/components/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/src/components/node_modules/resolve/test/dotdot/abc/index.js b/src/components/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 0000000..67f2534 --- /dev/null +++ b/src/components/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/src/components/node_modules/resolve/test/dotdot/index.js b/src/components/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 0000000..643f9fc --- /dev/null +++ b/src/components/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/src/components/node_modules/resolve/test/faulty_basedir.js b/src/components/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 0000000..5f2141a --- /dev/null +++ b/src/components/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/src/components/node_modules/resolve/test/filter.js b/src/components/node_modules/resolve/test/filter.js new file mode 100644 index 0000000..8f8cccd --- /dev/null +++ b/src/components/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/src/components/node_modules/resolve/test/filter_sync.js b/src/components/node_modules/resolve/test/filter_sync.js new file mode 100644 index 0000000..8a43b98 --- /dev/null +++ b/src/components/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/src/components/node_modules/resolve/test/home_paths.js b/src/components/node_modules/resolve/test/home_paths.js new file mode 100644 index 0000000..3b8c9b3 --- /dev/null +++ b/src/components/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/src/components/node_modules/resolve/test/home_paths_sync.js b/src/components/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 0000000..5d2c56f --- /dev/null +++ b/src/components/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/src/components/node_modules/resolve/test/mock.js b/src/components/node_modules/resolve/test/mock.js new file mode 100644 index 0000000..6116275 --- /dev/null +++ b/src/components/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/src/components/node_modules/resolve/test/mock_sync.js b/src/components/node_modules/resolve/test/mock_sync.js new file mode 100644 index 0000000..c5a7e2a --- /dev/null +++ b/src/components/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/src/components/node_modules/resolve/test/module_dir.js b/src/components/node_modules/resolve/test/module_dir.js new file mode 100644 index 0000000..b50e5bb --- /dev/null +++ b/src/components/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/src/components/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/src/components/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 0000000..dd7cf7b --- /dev/null +++ b/src/components/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/src/components/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/src/components/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 0000000..ef2d4d4 --- /dev/null +++ b/src/components/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 0000000..e8ba629 --- /dev/null +++ b/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 0000000..c13b8cf --- /dev/null +++ b/src/components/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/src/components/node_modules/resolve/test/node-modules-paths.js b/src/components/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 0000000..675441d --- /dev/null +++ b/src/components/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/src/components/node_modules/resolve/test/node_path.js b/src/components/node_modules/resolve/test/node_path.js new file mode 100644 index 0000000..e463d6c --- /dev/null +++ b/src/components/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/src/components/node_modules/resolve/test/node_path/x/aaa/index.js b/src/components/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 0000000..ad70d0b --- /dev/null +++ b/src/components/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/src/components/node_modules/resolve/test/node_path/x/ccc/index.js b/src/components/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 0000000..a64132e --- /dev/null +++ b/src/components/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/src/components/node_modules/resolve/test/node_path/y/bbb/index.js b/src/components/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 0000000..4d0f32e --- /dev/null +++ b/src/components/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/src/components/node_modules/resolve/test/node_path/y/ccc/index.js b/src/components/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 0000000..793315e --- /dev/null +++ b/src/components/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/src/components/node_modules/resolve/test/nonstring.js b/src/components/node_modules/resolve/test/nonstring.js new file mode 100644 index 0000000..ef63c40 --- /dev/null +++ b/src/components/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/src/components/node_modules/resolve/test/pathfilter.js b/src/components/node_modules/resolve/test/pathfilter.js new file mode 100644 index 0000000..16519ae --- /dev/null +++ b/src/components/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/src/components/node_modules/resolve/test/pathfilter/deep_ref/main.js b/src/components/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/precedence.js b/src/components/node_modules/resolve/test/precedence.js new file mode 100644 index 0000000..2febb59 --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/src/components/node_modules/resolve/test/precedence/aaa.js b/src/components/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 0000000..b83a3e7 --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/src/components/node_modules/resolve/test/precedence/aaa/index.js b/src/components/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 0000000..e0f8f6a --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/src/components/node_modules/resolve/test/precedence/aaa/main.js b/src/components/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 0000000..93542a9 --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/src/components/node_modules/resolve/test/precedence/bbb.js b/src/components/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 0000000..2298f47 --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/src/components/node_modules/resolve/test/precedence/bbb/main.js b/src/components/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 0000000..716b81d --- /dev/null +++ b/src/components/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/src/components/node_modules/resolve/test/resolver.js b/src/components/node_modules/resolve/test/resolver.js new file mode 100644 index 0000000..4903165 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver.js @@ -0,0 +1,595 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('missing index', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) { + t.ok(err instanceof Error); + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('missing main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('null main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('main: false', function (t) { + t.plan(2); + + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + resolve('./false_main', { basedir: basedir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal( + res, + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + t.deepEqual(pkg, { + name: 'false_main', + main: false + }); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +test('malformed package.json', function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/src/components/node_modules/resolve/test/resolver/baz/doom.js b/src/components/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/baz/package.json b/src/components/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 0000000..2f77720 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/src/components/node_modules/resolve/test/resolver/baz/quux.js b/src/components/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/browser_field/a.js b/src/components/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/browser_field/b.js b/src/components/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/browser_field/package.json b/src/components/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 0000000..bf406f0 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/src/components/node_modules/resolve/test/resolver/cup.coffee b/src/components/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/src/components/node_modules/resolve/test/resolver/dot_main/index.js b/src/components/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/dot_main/package.json b/src/components/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 0000000..d7f4fc8 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/src/components/node_modules/resolve/test/resolver/dot_slash_main/index.js b/src/components/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/dot_slash_main/package.json b/src/components/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 0000000..f51287b --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/src/components/node_modules/resolve/test/resolver/false_main/index.js b/src/components/node_modules/resolve/test/resolver/false_main/index.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/false_main/package.json b/src/components/node_modules/resolve/test/resolver/false_main/package.json new file mode 100644 index 0000000..a7416c0 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/false_main/package.json @@ -0,0 +1,4 @@ +{ + "name": "false_main", + "main": false +} diff --git a/src/components/node_modules/resolve/test/resolver/foo.js b/src/components/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/incorrect_main/index.js b/src/components/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 0000000..bc1fb0a --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/incorrect_main/package.json b/src/components/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 0000000..b718804 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/src/components/node_modules/resolve/test/resolver/invalid_main/package.json b/src/components/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 0000000..0590748 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/src/components/node_modules/resolve/test/resolver/malformed_package_json/index.js b/src/components/node_modules/resolve/test/resolver/malformed_package_json/index.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/malformed_package_json/package.json b/src/components/node_modules/resolve/test/resolver/malformed_package_json/package.json new file mode 100644 index 0000000..98232c6 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/malformed_package_json/package.json @@ -0,0 +1 @@ +{ diff --git a/src/components/node_modules/resolve/test/resolver/mug.coffee b/src/components/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/mug.js b/src/components/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/lerna.json b/src/components/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 0000000..d6707ca --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/package.json b/src/components/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 0000000..8508f9d --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 0000000..8875a32 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 0000000..204de51 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 0000000..f57c3b5 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 0000000..9b4846a --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 0000000..acfe9e9 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 0000000..3283efc --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/src/components/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/src/components/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/other_path/root.js b/src/components/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/quux/foo/index.js b/src/components/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/same_names/foo.js b/src/components/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 0000000..888cae3 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/src/components/node_modules/resolve/test/resolver/same_names/foo/index.js b/src/components/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/src/components/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/src/components/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/src/components/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/resolver/symlinked/package/bar.js b/src/components/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 0000000..cb1c2c0 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/src/components/node_modules/resolve/test/resolver/symlinked/package/package.json b/src/components/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 0000000..8e1b585 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/src/components/node_modules/resolve/test/resolver/without_basedir/main.js b/src/components/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 0000000..5b31975 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/src/components/node_modules/resolve/test/resolver_sync.js b/src/components/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 0000000..53453d6 --- /dev/null +++ b/src/components/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,726 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('missing index', function (t) { + t.plan(requireResolveSupportsPaths ? 2 : 1); + + var resolverDir = path.join(__dirname, 'resolver'); + try { + resolve.sync('./missing_index', { basedir: resolverDir }); + t.fail('did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + require.resolve('./missing_index', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } +}); + +test('missing main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('null main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('main: false', function (t) { + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + require.resolve('./false_main', { paths: [basedir] }), + '`"main": false`: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('malformed package.json', function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/src/components/node_modules/resolve/test/shadowed_core.js b/src/components/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 0000000..3a5f4fc --- /dev/null +++ b/src/components/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/src/components/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/src/components/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 0000000..e69de29 diff --git a/src/components/node_modules/resolve/test/subdirs.js b/src/components/node_modules/resolve/test/subdirs.js new file mode 100644 index 0000000..b7b8450 --- /dev/null +++ b/src/components/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/src/components/node_modules/resolve/test/symlinks.js b/src/components/node_modules/resolve/test/symlinks.js new file mode 100644 index 0000000..35f881a --- /dev/null +++ b/src/components/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.doesNotThrow(function () { + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); + }); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/src/components/node_modules/safe-buffer/LICENSE b/src/components/node_modules/safe-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/src/components/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +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. diff --git a/src/components/node_modules/safe-buffer/README.md b/src/components/node_modules/safe-buffer/README.md new file mode 100644 index 0000000..e9a81af --- /dev/null +++ b/src/components/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-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/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +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. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +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'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/src/components/node_modules/safe-buffer/index.d.ts b/src/components/node_modules/safe-buffer/index.d.ts new file mode 100644 index 0000000..e9fed80 --- /dev/null +++ b/src/components/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +declare module "safe-buffer" { + export class Buffer { + 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: Buffer, 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; + 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; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + 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; + 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; + 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): 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: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): 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 initalizing + */ + 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; + } +} \ No newline at end of file diff --git a/src/components/node_modules/safe-buffer/index.js b/src/components/node_modules/safe-buffer/index.js new file mode 100644 index 0000000..22438da --- /dev/null +++ b/src/components/node_modules/safe-buffer/index.js @@ -0,0 +1,62 @@ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/src/components/node_modules/safe-buffer/package.json b/src/components/node_modules/safe-buffer/package.json new file mode 100644 index 0000000..623fbc3 --- /dev/null +++ b/src/components/node_modules/safe-buffer/package.json @@ -0,0 +1,37 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.1.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + } +} diff --git a/src/components/node_modules/source-map/CHANGELOG.md b/src/components/node_modules/source-map/CHANGELOG.md new file mode 100644 index 0000000..3a8c066 --- /dev/null +++ b/src/components/node_modules/source-map/CHANGELOG.md @@ -0,0 +1,301 @@ +# 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/src/components/node_modules/source-map/LICENSE b/src/components/node_modules/source-map/LICENSE new file mode 100644 index 0000000..ed1b7cf --- /dev/null +++ b/src/components/node_modules/source-map/LICENSE @@ -0,0 +1,28 @@ + +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/src/components/node_modules/source-map/README.md b/src/components/node_modules/source-map/README.md new file mode 100644 index 0000000..3281339 --- /dev/null +++ b/src/components/node_modules/source-map/README.md @@ -0,0 +1,729 @@ +# 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/src/components/node_modules/source-map/lib/array-set.js b/src/components/node_modules/source-map/lib/array-set.js new file mode 100644 index 0000000..fbd5c81 --- /dev/null +++ b/src/components/node_modules/source-map/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- 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/src/components/node_modules/source-map/lib/base64-vlq.js b/src/components/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 0000000..612b404 --- /dev/null +++ b/src/components/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- 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/src/components/node_modules/source-map/lib/base64.js b/src/components/node_modules/source-map/lib/base64.js new file mode 100644 index 0000000..8aa86b3 --- /dev/null +++ b/src/components/node_modules/source-map/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- 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/src/components/node_modules/source-map/lib/binary-search.js b/src/components/node_modules/source-map/lib/binary-search.js new file mode 100644 index 0000000..010ac94 --- /dev/null +++ b/src/components/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- 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/src/components/node_modules/source-map/lib/mapping-list.js b/src/components/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 0000000..06d1274 --- /dev/null +++ b/src/components/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- 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/src/components/node_modules/source-map/lib/quick-sort.js b/src/components/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 0000000..6a7caad --- /dev/null +++ b/src/components/node_modules/source-map/lib/quick-sort.js @@ -0,0 +1,114 @@ +/* -*- 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/src/components/node_modules/source-map/lib/source-map-consumer.js b/src/components/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 0000000..6abcc28 --- /dev/null +++ b/src/components/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1082 @@ +/* -*- 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/src/components/node_modules/source-map/lib/source-map-generator.js b/src/components/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 0000000..aff1e7f --- /dev/null +++ b/src/components/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,416 @@ +/* -*- 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/src/components/node_modules/source-map/lib/source-node.js b/src/components/node_modules/source-map/lib/source-node.js new file mode 100644 index 0000000..d196a53 --- /dev/null +++ b/src/components/node_modules/source-map/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- 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/src/components/node_modules/source-map/lib/util.js b/src/components/node_modules/source-map/lib/util.js new file mode 100644 index 0000000..44e0e45 --- /dev/null +++ b/src/components/node_modules/source-map/lib/util.js @@ -0,0 +1,417 @@ +/* -*- 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/src/components/node_modules/source-map/package.json b/src/components/node_modules/source-map/package.json new file mode 100644 index 0000000..048e3ae --- /dev/null +++ b/src/components/node_modules/source-map/package.json @@ -0,0 +1,72 @@ +{ + "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/src/components/node_modules/source-map/source-map.js b/src/components/node_modules/source-map/source-map.js new file mode 100644 index 0000000..bc88fe8 --- /dev/null +++ b/src/components/node_modules/source-map/source-map.js @@ -0,0 +1,8 @@ +/* + * 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/src/components/node_modules/stylis/LICENSE b/src/components/node_modules/stylis/LICENSE new file mode 100644 index 0000000..f0b1a9a --- /dev/null +++ b/src/components/node_modules/stylis/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016-present Sultan Tarimo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION 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/src/components/node_modules/stylis/README.md b/src/components/node_modules/stylis/README.md new file mode 100644 index 0000000..b2135e9 --- /dev/null +++ b/src/components/node_modules/stylis/README.md @@ -0,0 +1,161 @@ +# STYLIS + +[![stylis](https://stylis.js.org/assets/logo.svg)](https://github.com/thysultan/stylis.js) + +A Light–weight CSS Preprocessor. + +[![Coverage](https://coveralls.io/repos/github/thysultan/stylis.js/badge.svg?branch=master)](https://coveralls.io/github/thysultan/stylis.js) +[![Size](https://badgen.net/bundlephobia/minzip/stylis)](https://bundlephobia.com/result?p=stylis) +[![Licence](https://badgen.net/badge/license/MIT/blue)](https://github.com/thysultan/stylis.js/blob/master/LICENSE) +[![NPM](https://badgen.net/npm/v/dyo)](https://www.npmjs.com/package/stylis) + +## Installation + +* Use a Direct Download: `` +* Use a CDN: `` +* Use NPM: `npm install stylis --save` + +## Features + +- nesting `a { &:hover {} }` +- selector namespacing +- vendor prefixing (flex-box, etc...) +- minification +- esm module compatible +- tree-shaking-able + +## Abstract Syntax Structure + +```js +const declaration = { + value: 'color:red;', + type: 'decl', + props: 'color', + children: 'red', + line: 1, column: 1 +} + +const comment = { + value: '/*@noflip*/', + type: 'comm', + props: '/', + children: '@noflip', + line: 1, column: 1 +} + +const ruleset = { + value: 'h1,h2', + type: 'rule', + props: ['h1', 'h2'], + children: [/* ... */], + line: 1, column: 1 +} + +const atruleset = { + value: '@media (max-width:100), (min-width:100)', + type: '@media', + props: ['(max-width:100)', '(min-width:100)'], + children: [/* ... */], + line: 1, column: 1 +} +``` + +## Example: + +```js +import {compile, serialize, stringify} from 'stylis' + +serialize(compile(`h1{all:unset}`), stringify) +``` + +### Compile + +```js +compile('h1{all:unset}') === [{value: 'h1', type: 'rule', props: ['h1'], children: [/* ... */]}] +compile('--foo:unset;') === [{value: '--foo:unset;', type: 'decl', props: '--foo', children: 'unset'}] +``` + +### Tokenize + +```js +tokenize('h1 h2 h3 [h4 h5] fn(args) "a b c"') === ['h1', 'h2', 'h3', '[h4 h5]', 'fn', '(args)', '"a b c"'] +``` + +### Serialize + +```js +serialize(compile('h1{all:unset}'), stringify) +``` + +### Vendor Prefixing + +```js +import {compile, serialize, stringify, middleware, prefixer } from 'stylis'; + +serialize(compile('div{display:flex;}'), middleware([prefixer, stringify])) +``` + + +## Middleware + +The middleware helper is a convenient helper utility, that for all intents and purposes you can do without if you intend to implement your own traversal logic. The `stringify` middleware is one such middleware that can be used in conjunction with it. + +Elements passed to middlewares have a `root` property that is the immediate root/parent of the current element **in the compiled output**, so it references the parent in the already expanded CSS-like structure. Elements have also `parent` property that is the immediate parent of the current element **from the input structure** (structure representing the input string). + +### Traversal + +```js +serialize(compile('h1{all:unset}'), middleware([(element, index, children) => { + assert(children === element.root.children && children[index] === element.children) +}, stringify])) === 'h1{all:unset;}' +``` + +The abstract syntax tree also includes an additional `return` property for more niche uses. + +### Prefixing + +```js +serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => { + if (element.type === 'decl' && element.props === 'all' && element.children === 'unset') + element.return = 'color:red;' + element.value +}, stringify])) === 'h1{color:red;all:unset;}' +``` + +```js +serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => { + if (element.type === 'rule' && element.props.indexOf('h1') > -1) + return serialize([{...element, props: ['h2', 'h3']}], callback) +}, stringify])) === 'h2,h3{all:unset;}h1{all:unset;}' +``` + +### Reading + +```js +serialize(compile('h1{all:unset}'), middleware([stringify, (element, index, children) => { + assert(element.return === 'h1{all:unset;}') +}])) === 'h1{all:unset;color:red;}' +``` + +The middlewares in [src/Middleware.js](src/Middleware.js) dive into tangible examples of how you might implement a middleware, alternatively you could also create your own middleware system as `compile` returns all the nessessary structure to fork from. + +## Variables + +CSS variables are supported but a note should be made about the exotic use of css variables. The css spec mentions the following + +>The allowed syntax for custom properties is extremely permissive. The production matches any sequence of one or more tokens, so long as the sequence does not contain , , unmatched <)-token>, <]-token>, or <}-token>, or top-level tokens or tokens with a value of "!". + +That is to say css variables according to the spec allows: `--foo: if(x > 5) this.width = 10;` and while this value is obviously useless as a variable, and would be invalid in any normal property, it still might be read and acted on by JavaScript and this is supported by Stylis, however things become slightly undefined when we start to include the `{` and `}` productions in our use of exotic css variables. + +For example consider the following: `--foo: {};` + +While this is valid CSS and supported. It is unclear what should happen when the rule collides with the implicit block termination rule that allows i.e `h1{color:red}`(notice the omitted semicolon) to also be a valid CSS production. This results in the following contradiction in: `h1{--example: {}` is it to be treated as `h1{--foo:{;}` or `h1{--foo:{}` the later of which is an unterminated block or in the following: `h1{--foo:{} h1{color:red;}` should it be `h1 {--foo:{}h1{color:red;};` where `{}h1{color:red;` is part of the css variable `--foo` and not a new rule or should it be something else? + +Never the less Stylis still supports the exotic forms highlighted in the spec, however you should consider it as a general rule to delimit such exotic uses of variables in strings or parentheses i.e: `h1{--foo:'{'}` or `h1{--foo:({)}`. + +## Benchmark + +Stylis is at-least 2X faster than its predecesor. + +### License + +Stylis is [MIT licensed](./LICENSE). diff --git a/src/components/node_modules/stylis/index.js b/src/components/node_modules/stylis/index.js new file mode 100644 index 0000000..3c12a38 --- /dev/null +++ b/src/components/node_modules/stylis/index.js @@ -0,0 +1,7 @@ +export * from './src/Enum.js' +export * from './src/Utility.js' +export * from './src/Parser.js' +export * from './src/Prefixer.js' +export * from './src/Tokenizer.js' +export * from './src/Serializer.js' +export * from './src/Middleware.js' diff --git a/src/components/node_modules/stylis/package.json b/src/components/node_modules/stylis/package.json new file mode 100644 index 0000000..4431898 --- /dev/null +++ b/src/components/node_modules/stylis/package.json @@ -0,0 +1,164 @@ +{ + "name": "stylis", + "version": "4.0.13", + "license": "MIT", + "description": "A Light–weight CSS Preprocessor", + "homepage": "https://github.com/thysultan/stylis.js", + "author": "Sultan Tarimo ", + "repository": "https://github.com/thysultan/stylis.js", + "bugs": "https://github.com/thysultan/stylis.js/issues", + "sideEffects": false, + "type": "module", + "main": "dist/umd/stylis.js", + "module": "dist/stylis.mjs", + "react-native": "./index.js", + "exports": { + ".": { + "import": "./index.js", + "require": "./dist/umd/stylis.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "index.js", + "dist/", + "src/" + ], + "scripts": { + "lint": "eslint ./", + "pretest": "npm run lint && npm run build", + "test": "nyc npm run spec", + "spec": "mocha --harmony --require esm script/setup.js --recursive test", + "prebuild": "rimraf dist", + "build": "rollup --config script/build.js --configSrc ./", + "start": "npm run build -- --watch", + "prepare": "npm run build", + "postversion": "git push --follow-tags && npm publish", + "release-major": "npm version major -m '%s'", + "release-minor": "npm version minor -m '%s'", + "release-patch": "npm version patch -m '%s'" + }, + "devDependencies": { + "chai": "4.3.4", + "eslint": "6.8.0", + "esm": "3.2.25", + "mocha": "9.1.1", + "nyc": "15.1.0", + "rimraf": "3.0.2", + "rollup": "1.28.0", + "rollup-plugin-size": "0.2.1", + "rollup-plugin-terser": "5.1.3", + "stylis": "./" + }, + "nyc": { + "temp-dir": "./coverage/.nyc_output", + "exclude": [ + "**/dist/", + "**/test/", + "**/script/" + ], + "reporter": [ + "lcov", + "text" + ] + }, + "esm": { + "cjs": true, + "cache": false + }, + "eslintIgnore": [ + "script/", + "test/", + "dist/", + "docs/" + ], + "eslintConfig": { + "env": { + "commonjs": true, + "browser": true, + "node": true, + "es6": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 7, + "sourceType": "module", + "ecmaFeatures": { + "impliedStrict": true + } + }, + "rules": { + "indent": [ + "error", + "tab", + { + "SwitchCase": 1 + } + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "never" + ], + "no-cond-assign": [ + "off" + ], + "no-redeclare": [ + "off" + ], + "no-fallthrough": [ + "off" + ], + "no-console": [ + "off" + ], + "no-unsafe-finally": [ + "off" + ], + "no-shadow-restricted-names": [ + "error" + ], + "no-whitespace-before-property": [ + "error" + ], + "eol-last": [ + "error" + ], + "func-call-spacing": [ + "error", + "never" + ], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true + } + ], + "require-jsdoc": [ + "error", + { + "require": { + "FunctionDeclaration": true + } + } + ], + "no-trailing-spaces": [ + "error", + { + "skipBlankLines": true + } + ], + "no-constant-condition": [ + "off" + ] + } + } +} diff --git a/src/components/node_modules/stylis/src/Enum.js b/src/components/node_modules/stylis/src/Enum.js new file mode 100644 index 0000000..0d611ab --- /dev/null +++ b/src/components/node_modules/stylis/src/Enum.js @@ -0,0 +1,20 @@ +export var MS = '-ms-' +export var MOZ = '-moz-' +export var WEBKIT = '-webkit-' + +export var COMMENT = 'comm' +export var RULESET = 'rule' +export var DECLARATION = 'decl' + +export var PAGE = '@page' +export var MEDIA = '@media' +export var IMPORT = '@import' +export var CHARSET = '@charset' +export var VIEWPORT = '@viewport' +export var SUPPORTS = '@supports' +export var DOCUMENT = '@document' +export var NAMESPACE = '@namespace' +export var KEYFRAMES = '@keyframes' +export var FONT_FACE = '@font-face' +export var COUNTER_STYLE = '@counter-style' +export var FONT_FEATURE_VALUES = '@font-feature-values' diff --git a/src/components/node_modules/stylis/src/Middleware.js b/src/components/node_modules/stylis/src/Middleware.js new file mode 100644 index 0000000..455a863 --- /dev/null +++ b/src/components/node_modules/stylis/src/Middleware.js @@ -0,0 +1,108 @@ +import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js' +import {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js' +import {copy, tokenize} from './Tokenizer.js' +import {serialize} from './Serializer.js' +import {prefix} from './Prefixer.js' + +/** + * @param {function[]} collection + * @return {function} + */ +export function middleware (collection) { + var length = sizeof(collection) + + return function (element, index, children, callback) { + var output = '' + + for (var i = 0; i < length; i++) + output += collection[i](element, index, children, callback) || '' + + return output + } +} + +/** + * @param {function} callback + * @return {function} + */ +export function rulesheet (callback) { + return function (element) { + if (!element.root) + if (element = element.return) + callback(element) + } +} + +/** + * @param {object} element + * @param {number} index + * @param {object[]} children + * @param {function} callback + */ +export function prefixer (element, index, children, callback) { + if (element.length > -1) + if (!element.return) + switch (element.type) { + case DECLARATION: element.return = prefix(element.value, element.length) + break + case KEYFRAMES: + return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) + case RULESET: + if (element.length) + return combine(element.props, function (value) { + switch (match(value, /(::plac\w+|:read-\w+)/)) { + // :read-(only|write) + case ':read-only': case ':read-write': + return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) + // :placeholder + case '::placeholder': + return serialize([ + copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), + copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), + copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) + ], callback) + } + + return '' + }) + } +} + +/** + * @param {object} element + * @param {number} index + * @param {object[]} children + */ +export function namespace (element) { + switch (element.type) { + case RULESET: + element.props = element.props.map(function (value) { + return combine(tokenize(value), function (value, index, children) { + switch (charat(value, 0)) { + // \f + case 12: + return substr(value, 1, strlen(value)) + // \0 ( + > ~ + case 0: case 40: case 43: case 62: case 126: + return value + // : + case 58: + if (children[++index] === 'global') + children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) + // \s + case 32: + return index === 1 ? '' : value + default: + switch (index) { + case 0: element = value + return sizeof(children) > 1 ? '' : value + case index = sizeof(children) - 1: case 2: + return index === 2 ? value + element + element : value + element + default: + return value + } + } + }) + }) + } +} diff --git a/src/components/node_modules/stylis/src/Parser.js b/src/components/node_modules/stylis/src/Parser.js new file mode 100644 index 0000000..f276521 --- /dev/null +++ b/src/components/node_modules/stylis/src/Parser.js @@ -0,0 +1,191 @@ +import {COMMENT, RULESET, DECLARATION} from './Enum.js' +import {abs, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js' +import {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js' + +/** + * @param {string} value + * @return {object[]} + */ +export function compile (value) { + return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) +} + +/** + * @param {string} value + * @param {object} root + * @param {object?} parent + * @param {string[]} rule + * @param {string[]} rules + * @param {string[]} rulesets + * @param {number[]} pseudo + * @param {number[]} points + * @param {string[]} declarations + * @return {object} + */ +export function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { + var index = 0 + var offset = 0 + var length = pseudo + var atrule = 0 + var property = 0 + var previous = 0 + var variable = 1 + var scanning = 1 + var ampersand = 1 + var character = 0 + var type = '' + var props = rules + var children = rulesets + var reference = rule + var characters = type + + while (scanning) + switch (previous = character, character = next()) { + // ( + case 40: + if (previous != 108 && characters.charCodeAt(length - 1) == 58) { + if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) + ampersand = -1 + break + } + // " ' [ + case 34: case 39: case 91: + characters += delimit(character) + break + // \t \n \r \s + case 9: case 10: case 13: case 32: + characters += whitespace(previous) + break + // \ + case 92: + characters += escaping(caret() - 1, 7) + continue + // / + case 47: + switch (peek()) { + case 42: case 47: + append(comment(commenter(next(), caret()), root, parent), declarations) + break + default: + characters += '/' + } + break + // { + case 123 * variable: + points[index++] = strlen(characters) * ampersand + // } ; \0 + case 125 * variable: case 59: case 0: + switch (character) { + // \0 } + case 0: case 125: scanning = 0 + // ; + case 59 + offset: + if (property > 0 && (strlen(characters) - length)) + append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) + break + // @ ; + case 59: characters += ';' + // { rule/at-rule + default: + append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) + + if (character === 123) + if (offset === 0) + parse(characters, root, reference, reference, props, rulesets, length, points, children) + else + switch (atrule) { + // d m s + case 100: case 109: case 115: + parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) + break + default: + parse(characters, reference, reference, reference, [''], children, 0, points, children) + } + } + + index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo + break + // : + case 58: + length = 1 + strlen(characters), property = previous + default: + if (variable < 1) + if (character == 123) + --variable + else if (character == 125 && variable++ == 0 && prev() == 125) + continue + + switch (characters += from(character), character * variable) { + // & + case 38: + ampersand = offset > 0 ? 1 : (characters += '\f', -1) + break + // , + case 44: + points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1 + break + // @ + case 64: + // - + if (peek() === 45) + characters += delimit(next()) + + atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++ + break + // - + case 45: + if (previous === 45 && strlen(characters) == 2) + variable = 0 + } + } + + return rulesets +} + +/** + * @param {string} value + * @param {object} root + * @param {object?} parent + * @param {number} index + * @param {number} offset + * @param {string[]} rules + * @param {number[]} points + * @param {string} type + * @param {string[]} props + * @param {string[]} children + * @param {number} length + * @return {object} + */ +export function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { + var post = offset - 1 + var rule = offset === 0 ? rules : [''] + var size = sizeof(rule) + + for (var i = 0, j = 0, k = 0; i < index; ++i) + for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) + if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) + props[k++] = z + + return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length) +} + +/** + * @param {number} value + * @param {object} root + * @param {object?} parent + * @return {object} + */ +export function comment (value, root, parent) { + return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0) +} + +/** + * @param {string} value + * @param {object} root + * @param {object?} parent + * @param {number} length + * @return {object} + */ +export function declaration (value, root, parent, length) { + return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length) +} diff --git a/src/components/node_modules/stylis/src/Prefixer.js b/src/components/node_modules/stylis/src/Prefixer.js new file mode 100644 index 0000000..11b6121 --- /dev/null +++ b/src/components/node_modules/stylis/src/Prefixer.js @@ -0,0 +1,119 @@ +import {MS, MOZ, WEBKIT} from './Enum.js' +import {hash, charat, strlen, indexof, replace} from './Utility.js' + +/** + * @param {string} value + * @param {number} length + * @return {string} + */ +export function prefix (value, length) { + switch (hash(value, length)) { + // color-adjust + case 5103: + return WEBKIT + 'print-' + value + value + // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) + case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: + // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break + case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: + // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, + case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: + // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) + case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: + return WEBKIT + value + value + // appearance, user-select, transform, hyphens, text-size-adjust + case 5349: case 4246: case 4810: case 6968: case 2756: + return WEBKIT + value + MOZ + value + MS + value + value + // flex, flex-direction + case 6828: case 4268: + return WEBKIT + value + MS + value + value + // order + case 6165: + return WEBKIT + value + MS + 'flex-' + value + value + // align-items + case 5187: + return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value + // align-self + case 5443: + return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value + // align-content + case 4675: + return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value + // flex-shrink + case 5548: + return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value + // flex-basis + case 5292: + return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value + // flex-grow + case 6060: + return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value + // transition + case 4554: + return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value + // cursor + case 6187: + return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value + // background, background-image + case 5495: case 3959: + return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1') + // justify-content + case 4968: + return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value + // (margin|padding)-inline-(start|end) + case 4095: case 3583: case 4068: case 2532: + return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value + // (min|max)?(width|height|inline-size|block-size) + case 8116: case 7059: case 5753: case 5535: + case 5445: case 5701: case 4933: case 4677: + case 5533: case 5789: case 5021: case 4765: + // stretch, max-content, min-content, fill-available + if (strlen(value) - 1 - length > 6) + switch (charat(value, length + 1)) { + // (m)ax-content, (m)in-content + case 109: + // - + if (charat(value, length + 4) !== 45) + break + // (f)ill-available, (f)it-content + case 102: + return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value + // (s)tretch + case 115: + return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value + } + break + // position: sticky + case 4949: + // (s)ticky? + if (charat(value, length + 1) !== 115) + break + // display: (flex|inline-flex) + case 6444: + switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) { + // stic(k)y + case 107: + return replace(value, ':', ':' + WEBKIT) + value + // (inline-)?fl(e)x + case 101: + return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value + } + break + // writing-mode + case 5936: + switch (charat(value, length + 11)) { + // vertical-l(r) + case 114: + return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value + // vertical-r(l) + case 108: + return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value + // horizontal(-)tb + case 45: + return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value + } + + return WEBKIT + value + MS + value + value + } + + return value +} diff --git a/src/components/node_modules/stylis/src/Serializer.js b/src/components/node_modules/stylis/src/Serializer.js new file mode 100644 index 0000000..5631c70 --- /dev/null +++ b/src/components/node_modules/stylis/src/Serializer.js @@ -0,0 +1,35 @@ +import {IMPORT, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js' +import {strlen, sizeof} from './Utility.js' + +/** + * @param {object[]} children + * @param {function} callback + * @return {string} + */ +export function serialize (children, callback) { + var output = '' + var length = sizeof(children) + + for (var i = 0; i < length; i++) + output += callback(children[i], i, children, callback) || '' + + return output +} + +/** + * @param {object} element + * @param {number} index + * @param {object[]} children + * @param {function} callback + * @return {string} + */ +export function stringify (element, index, children, callback) { + switch (element.type) { + case IMPORT: case DECLARATION: return element.return = element.return || element.value + case COMMENT: return '' + case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}' + case RULESET: element.value = element.props.join(',') + } + + return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' +} diff --git a/src/components/node_modules/stylis/src/Tokenizer.js b/src/components/node_modules/stylis/src/Tokenizer.js new file mode 100644 index 0000000..dd482ce --- /dev/null +++ b/src/components/node_modules/stylis/src/Tokenizer.js @@ -0,0 +1,246 @@ +import {from, trim, charat, strlen, substr, append, assign} from './Utility.js' + +export var line = 1 +export var column = 1 +export var length = 0 +export var position = 0 +export var character = 0 +export var characters = '' + +/** + * @param {string} value + * @param {object | null} root + * @param {object | null} parent + * @param {string} type + * @param {string[] | string} props + * @param {object[] | string} children + * @param {number} length + */ +export function node (value, root, parent, type, props, children, length) { + return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} +} + +/** + * @param {object} root + * @param {object} props + * @return {object} + */ +export function copy (root, props) { + return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) +} + +/** + * @return {number} + */ +export function char () { + return character +} + +/** + * @return {number} + */ +export function prev () { + character = position > 0 ? charat(characters, --position) : 0 + + if (column--, character === 10) + column = 1, line-- + + return character +} + +/** + * @return {number} + */ +export function next () { + character = position < length ? charat(characters, position++) : 0 + + if (column++, character === 10) + column = 1, line++ + + return character +} + +/** + * @return {number} + */ +export function peek () { + return charat(characters, position) +} + +/** + * @return {number} + */ +export function caret () { + return position +} + +/** + * @param {number} begin + * @param {number} end + * @return {string} + */ +export function slice (begin, end) { + return substr(characters, begin, end) +} + +/** + * @param {number} type + * @return {number} + */ +export function token (type) { + switch (type) { + // \0 \t \n \r \s whitespace token + case 0: case 9: case 10: case 13: case 32: + return 5 + // ! + , / > @ ~ isolate token + case 33: case 43: case 44: case 47: case 62: case 64: case 126: + // ; { } breakpoint token + case 59: case 123: case 125: + return 4 + // : accompanied token + case 58: + return 3 + // " ' ( [ opening delimit token + case 34: case 39: case 40: case 91: + return 2 + // ) ] closing delimit token + case 41: case 93: + return 1 + } + + return 0 +} + +/** + * @param {string} value + * @return {any[]} + */ +export function alloc (value) { + return line = column = 1, length = strlen(characters = value), position = 0, [] +} + +/** + * @param {any} value + * @return {any} + */ +export function dealloc (value) { + return characters = '', value +} + +/** + * @param {number} type + * @return {string} + */ +export function delimit (type) { + return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) +} + +/** + * @param {string} value + * @return {string[]} + */ +export function tokenize (value) { + return dealloc(tokenizer(alloc(value))) +} + +/** + * @param {number} type + * @return {string} + */ +export function whitespace (type) { + while (character = peek()) + if (character < 33) + next() + else + break + + return token(type) > 2 || token(character) > 3 ? '' : ' ' +} + +/** + * @param {string[]} children + * @return {string[]} + */ +export function tokenizer (children) { + while (next()) + switch (token(character)) { + case 0: append(identifier(position - 1), children) + break + case 2: append(delimit(character), children) + break + default: append(from(character), children) + } + + return children +} + +/** + * @param {number} index + * @param {number} count + * @return {string} + */ +export function escaping (index, count) { + while (--count && next()) + // not 0-9 A-F a-f + if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) + break + + return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) +} + +/** + * @param {number} type + * @return {number} + */ +export function delimiter (type) { + while (next()) + switch (character) { + // ] ) " ' + case type: + return position + // " ' + case 34: case 39: + if (type !== 34 && type !== 39) + delimiter(character) + break + // ( + case 40: + if (type === 41) + delimiter(type) + break + // \ + case 92: + next() + break + } + + return position +} + +/** + * @param {number} type + * @param {number} index + * @return {number} + */ +export function commenter (type, index) { + while (next()) + // // + if (type + character === 47 + 10) + break + // /* + else if (type + character === 42 + 42 && peek() === 47) + break + + return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next()) +} + +/** + * @param {number} index + * @return {string} + */ +export function identifier (index) { + while (!token(peek())) + next() + + return slice(index, position) +} diff --git a/src/components/node_modules/stylis/src/Utility.js b/src/components/node_modules/stylis/src/Utility.js new file mode 100644 index 0000000..a27883b --- /dev/null +++ b/src/components/node_modules/stylis/src/Utility.js @@ -0,0 +1,115 @@ +/** + * @param {number} + * @return {number} + */ +export var abs = Math.abs + +/** + * @param {number} + * @return {string} + */ +export var from = String.fromCharCode + +/** + * @param {object} + * @return {object} + */ +export var assign = Object.assign + +/** + * @param {string} value + * @param {number} length + * @return {number} + */ +export function hash (value, length) { + return (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) +} + +/** + * @param {string} value + * @return {string} + */ +export function trim (value) { + return value.trim() +} + +/** + * @param {string} value + * @param {RegExp} pattern + * @return {string?} + */ +export function match (value, pattern) { + return (value = pattern.exec(value)) ? value[0] : value +} + +/** + * @param {string} value + * @param {(string|RegExp)} pattern + * @param {string} replacement + * @return {string} + */ +export function replace (value, pattern, replacement) { + return value.replace(pattern, replacement) +} + +/** + * @param {string} value + * @param {string} search + * @return {number} + */ +export function indexof (value, search) { + return value.indexOf(search) +} + +/** + * @param {string} value + * @param {number} index + * @return {number} + */ +export function charat (value, index) { + return value.charCodeAt(index) | 0 +} + +/** + * @param {string} value + * @param {number} begin + * @param {number} end + * @return {string} + */ +export function substr (value, begin, end) { + return value.slice(begin, end) +} + +/** + * @param {string} value + * @return {number} + */ +export function strlen (value) { + return value.length +} + +/** + * @param {any[]} value + * @return {number} + */ +export function sizeof (value) { + return value.length +} + +/** + * @param {any} value + * @param {any[]} array + * @return {any} + */ +export function append (value, array) { + return array.push(value), value +} + +/** + * @param {string[]} array + * @param {function} callback + * @return {string} + */ +export function combine (array, callback) { + return array.map(callback).join('') +} diff --git a/src/components/node_modules/supports-color/browser.js b/src/components/node_modules/supports-color/browser.js new file mode 100644 index 0000000..62afa3a --- /dev/null +++ b/src/components/node_modules/supports-color/browser.js @@ -0,0 +1,5 @@ +'use strict'; +module.exports = { + stdout: false, + stderr: false +}; diff --git a/src/components/node_modules/supports-color/index.js b/src/components/node_modules/supports-color/index.js new file mode 100644 index 0000000..1704131 --- /dev/null +++ b/src/components/node_modules/supports-color/index.js @@ -0,0 +1,131 @@ +'use strict'; +const os = require('os'); +const hasFlag = require('has-flag'); + +const env = process.env; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + const min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. 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(process.versions.node.split('.')[0]) >= 8 && + 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'].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; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; diff --git a/src/components/node_modules/supports-color/license b/src/components/node_modules/supports-color/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/src/components/node_modules/supports-color/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/components/node_modules/supports-color/package.json b/src/components/node_modules/supports-color/package.json new file mode 100644 index 0000000..ad199f5 --- /dev/null +++ b/src/components/node_modules/supports-color/package.json @@ -0,0 +1,53 @@ +{ + "name": "supports-color", + "version": "5.5.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": ">=4" + }, + "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": "^3.0.0" + }, + "devDependencies": { + "ava": "^0.25.0", + "import-fresh": "^2.0.0", + "xo": "^0.20.0" + }, + "browser": "browser.js" +} diff --git a/src/components/node_modules/supports-color/readme.md b/src/components/node_modules/supports-color/readme.md new file mode 100644 index 0000000..f6e4019 --- /dev/null +++ b/src/components/node_modules/supports-color/readme.md @@ -0,0 +1,66 @@ +# 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. + +Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` 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-) + + +## License + +MIT diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/.eslintrc b/src/components/node_modules/supports-preserve-symlinks-flag/.eslintrc new file mode 100644 index 0000000..346ffec --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "browser": true, + "node": true, + }, + + "rules": { + "id-length": "off", + }, +} diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml b/src/components/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml new file mode 100644 index 0000000..e8d64f3 --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/supports-preserve-symlink-flag +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/.nycrc b/src/components/node_modules/supports-preserve-symlinks-flag/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md b/src/components/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md new file mode 100644 index 0000000..61f607f --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2022-01-02 + +### Commits + +- Tests [`e2f59ad`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/e2f59ad74e2ae0f5f4899fcde6a6f693ab7cc074) +- Initial commit [`dc222aa`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/dc222aad3c0b940d8d3af1ca9937d108bd2dc4b9) +- [meta] do not publish workflow files [`5ef77f7`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/5ef77f7cb6946d16ee38672be9ec0f1bbdf63262) +- npm init [`992b068`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/992b068503a461f7e8676f40ca2aab255fd8d6ff) +- read me [`6c9afa9`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c9afa9fabc8eaf0814aaed6dd01e6df0931b76d) +- Initial implementation [`2f98925`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2f9892546396d4ab0ad9f1ff83e76c3f01234ae8) +- [meta] add `auto-changelog` [`6c476ae`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c476ae1ed7ce68b0480344f090ac2844f35509d) +- [Dev Deps] add `eslint`, `@ljharb/eslint-config` [`d0fffc8`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/d0fffc886d25fba119355520750a909d64da0087) +- Only apps should have lockfiles [`ab318ed`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/ab318ed7ae62f6c2c0e80a50398d40912afd8f69) +- [meta] add `safe-publish-latest` [`2bb23b3`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2bb23b3ebab02dc4135c4cdf0217db82835b9fca) +- [meta] add `sideEffects` flag [`600223b`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/600223ba24f30779f209d9097721eff35ed62741) diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/LICENSE b/src/components/node_modules/supports-preserve-symlinks-flag/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/README.md b/src/components/node_modules/supports-preserve-symlinks-flag/README.md new file mode 100644 index 0000000..eb05b12 --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/README.md @@ -0,0 +1,42 @@ +# node-supports-preserve-symlinks-flag [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Determine if the current node version supports the `--preserve-symlinks` flag. + +## Example + +```js +var supportsPreserveSymlinks = require('node-supports-preserve-symlinks-flag'); +var assert = require('assert'); + +assert.equal(supportsPreserveSymlinks, null); // in a browser +assert.equal(supportsPreserveSymlinks, false); // in node < v6.2 +assert.equal(supportsPreserveSymlinks, true); // in node v6.2+ +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/node-supports-preserve-symlinks-flag +[npm-version-svg]: https://versionbadg.es/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag +[dev-deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/node-supports-preserve-symlinks-flag.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/node-supports-preserve-symlinks-flag.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/node-supports-preserve-symlinks-flag.svg +[downloads-url]: https://npm-stat.com/charts.html?package=node-supports-preserve-symlinks-flag +[codecov-image]: https://codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-supports-preserve-symlinks-flag +[actions-url]: https://github.com/inspect-js/node-supports-preserve-symlinks-flag/actions diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/browser.js b/src/components/node_modules/supports-preserve-symlinks-flag/browser.js new file mode 100644 index 0000000..087be1f --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/browser.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = null; diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/index.js b/src/components/node_modules/supports-preserve-symlinks-flag/index.js new file mode 100644 index 0000000..86fd5d3 --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/index.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = ( +// node 12+ + process.allowedNodeEnvironmentFlags && process.allowedNodeEnvironmentFlags.has('--preserve-symlinks') +) || ( +// node v6.2 - v11 + String(module.constructor._findPath).indexOf('preserveSymlinks') >= 0 // eslint-disable-line no-underscore-dangle +); diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/package.json b/src/components/node_modules/supports-preserve-symlinks-flag/package.json new file mode 100644 index 0000000..56edadc --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/package.json @@ -0,0 +1,70 @@ +{ + "name": "supports-preserve-symlinks-flag", + "version": "1.0.0", + "description": "Determine if the current node version supports the `--preserve-symlinks` flag.", + "main": "./index.js", + "browser": "./browser.js", + "exports": { + ".": [ + { + "browser": "./browser.js", + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/node-supports-preserve-symlinks-flag.git" + }, + "keywords": [ + "node", + "flag", + "symlink", + "symlinks", + "preserve-symlinks" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag/issues" + }, + "homepage": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.1.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^8.6.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tape": "^5.4.0" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/src/components/node_modules/supports-preserve-symlinks-flag/test/index.js b/src/components/node_modules/supports-preserve-symlinks-flag/test/index.js new file mode 100644 index 0000000..9938d67 --- /dev/null +++ b/src/components/node_modules/supports-preserve-symlinks-flag/test/index.js @@ -0,0 +1,29 @@ +'use strict'; + +var test = require('tape'); +var semver = require('semver'); + +var supportsPreserveSymlinks = require('../'); +var browser = require('../browser'); + +test('supportsPreserveSymlinks', function (t) { + t.equal(typeof supportsPreserveSymlinks, 'boolean', 'is a boolean'); + + t.equal(browser, null, 'browser file is `null`'); + t.equal( + supportsPreserveSymlinks, + null, + 'in a browser, is null', + { skip: typeof window === 'undefined' } + ); + + var expected = semver.satisfies(process.version, '>= 6.2'); + t.equal( + supportsPreserveSymlinks, + expected, + 'is true in node v6.2+, false otherwise (actual: ' + supportsPreserveSymlinks + ', expected ' + expected + ')', + { skip: typeof window !== 'undefined' } + ); + + t.end(); +}); diff --git a/src/components/node_modules/to-fast-properties/index.js b/src/components/node_modules/to-fast-properties/index.js new file mode 100644 index 0000000..028c88a --- /dev/null +++ b/src/components/node_modules/to-fast-properties/index.js @@ -0,0 +1,27 @@ +'use strict'; + +let fastProto = null; + +// Creates an object with permanently fast properties in V8. See Toon Verwaest's +// post https://medium.com/@tverwaes/setting-up-prototypes-in-v8-ec9c9491dfe2#5f62 +// for more details. Use %HasFastProperties(object) and the Node.js flag +// --allow-natives-syntax to check whether an object has fast properties. +function FastObject(o) { + // A prototype object will have "fast properties" enabled once it is checked + // against the inline property cache of a function, e.g. fastProto.property: + // https://github.com/v8/v8/blob/6.0.122/test/mjsunit/fast-prototype.js#L48-L63 + if (fastProto !== null && typeof fastProto.property) { + const result = fastProto; + fastProto = FastObject.prototype = null; + return result; + } + fastProto = FastObject.prototype = o == null ? Object.create(null) : o; + return new FastObject; +} + +// Initialize the inline property cache of FastObject +FastObject(); + +module.exports = function toFastproperties(o) { + return FastObject(o); +}; diff --git a/src/components/node_modules/to-fast-properties/license b/src/components/node_modules/to-fast-properties/license new file mode 100644 index 0000000..cef79ef --- /dev/null +++ b/src/components/node_modules/to-fast-properties/license @@ -0,0 +1,10 @@ +MIT License + +Copyright (c) 2014 Petka Antonov + 2015 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. diff --git a/src/components/node_modules/to-fast-properties/package.json b/src/components/node_modules/to-fast-properties/package.json new file mode 100644 index 0000000..7a64b2c --- /dev/null +++ b/src/components/node_modules/to-fast-properties/package.json @@ -0,0 +1,35 @@ +{ + "name": "to-fast-properties", + "version": "2.0.0", + "description": "Force V8 to use fast properties for an object", + "license": "MIT", + "repository": "sindresorhus/to-fast-properties", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "node --allow-natives-syntax test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "obj", + "properties", + "props", + "v8", + "optimize", + "fast", + "convert", + "mode" + ], + "devDependencies": { + "ava": "0.0.4" + } +} diff --git a/src/components/node_modules/to-fast-properties/readme.md b/src/components/node_modules/to-fast-properties/readme.md new file mode 100644 index 0000000..692101d --- /dev/null +++ b/src/components/node_modules/to-fast-properties/readme.md @@ -0,0 +1,37 @@ +# to-fast-properties [![Build Status](https://travis-ci.org/sindresorhus/to-fast-properties.svg?branch=master)](https://travis-ci.org/sindresorhus/to-fast-properties) + +> Force V8 to use fast properties for an object + +[Read more.](http://stackoverflow.com/questions/24987896/) + +Use `%HasFastProperties(object)` and `--allow-natives-syntax` to check whether an object already has fast properties. + + +## Install + +``` +$ npm install --save to-fast-properties +``` + + +## Usage + +```js +const toFastProperties = require('to-fast-properties'); + +const obj = { + foo: true, + bar: true +}; + +delete obj.foo; +// `obj` now has slow properties + +toFastProperties(obj); +// `obj` now has fast properties +``` + + +## License + +MIT © Petka Antonov, John-David Dalton, Sindre Sorhus diff --git a/src/components/node_modules/universalify/LICENSE b/src/components/node_modules/universalify/LICENSE new file mode 100644 index 0000000..514e84e --- /dev/null +++ b/src/components/node_modules/universalify/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2017, Ryan Zimmerman + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION 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/src/components/node_modules/universalify/README.md b/src/components/node_modules/universalify/README.md new file mode 100644 index 0000000..aa12474 --- /dev/null +++ b/src/components/node_modules/universalify/README.md @@ -0,0 +1,76 @@ +# universalify + +[![Travis branch](https://img.shields.io/travis/RyanZim/universalify/master.svg)](https://travis-ci.org/RyanZim/universalify) +![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/universalify/master.svg) +![npm](https://img.shields.io/npm/dm/universalify.svg) +![npm](https://img.shields.io/npm/l/universalify.svg) + +Make a callback- or promise-based function support both promises and callbacks. + +Uses the native promise implementation. + +## Installation + +```bash +npm install universalify +``` + +## API + +### `universalify.fromCallback(fn)` + +Takes a callback-based function to universalify, and returns the universalified function. + +Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once. + +```js +function callbackFn (n, cb) { + setTimeout(() => cb(null, n), 15) +} + +const fn = universalify.fromCallback(callbackFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +### `universalify.fromPromise(fn)` + +Takes a promise-based function to universalify, and returns the universalified function. + +Function must return a valid JS promise. `universalify` does not ensure that a valid promise is returned. + +```js +function promiseFn (n) { + return new Promise(resolve => { + setTimeout(() => resolve(n), 15) + }) +} + +const fn = universalify.fromPromise(promiseFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +## License + +MIT diff --git a/src/components/node_modules/universalify/index.js b/src/components/node_modules/universalify/index.js new file mode 100644 index 0000000..ba6c662 --- /dev/null +++ b/src/components/node_modules/universalify/index.js @@ -0,0 +1,24 @@ +'use strict' + +exports.fromCallback = function (fn) { + return Object.defineProperty(function (...args) { + if (typeof args[args.length - 1] === 'function') fn.apply(this, args) + else { + return new Promise((resolve, reject) => { + fn.call( + this, + ...args, + (err, res) => (err != null) ? reject(err) : resolve(res) + ) + }) + } + }, 'name', { value: fn.name }) +} + +exports.fromPromise = function (fn) { + return Object.defineProperty(function (...args) { + const cb = args[args.length - 1] + if (typeof cb !== 'function') return fn.apply(this, args) + else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb) + }, 'name', { value: fn.name }) +} diff --git a/src/components/node_modules/universalify/package.json b/src/components/node_modules/universalify/package.json new file mode 100644 index 0000000..006d4cc --- /dev/null +++ b/src/components/node_modules/universalify/package.json @@ -0,0 +1,34 @@ +{ + "name": "universalify", + "version": "2.0.0", + "description": "Make a callback- or promise-based function support both promises and callbacks.", + "keywords": [ + "callback", + "native", + "promise" + ], + "homepage": "https://github.com/RyanZim/universalify#readme", + "bugs": "https://github.com/RyanZim/universalify/issues", + "license": "MIT", + "author": "Ryan Zimmerman ", + "files": [ + "index.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/RyanZim/universalify.git" + }, + "scripts": { + "test": "standard && nyc tape test/*.js | colortape" + }, + "devDependencies": { + "colortape": "^0.1.2", + "coveralls": "^3.0.1", + "nyc": "^15.0.0", + "standard": "^14.3.1", + "tape": "^5.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } +} diff --git a/src/components/node_modules/yaml/LICENSE b/src/components/node_modules/yaml/LICENSE new file mode 100644 index 0000000..7ca44e3 --- /dev/null +++ b/src/components/node_modules/yaml/LICENSE @@ -0,0 +1,13 @@ +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. diff --git a/src/components/node_modules/yaml/README.md b/src/components/node_modules/yaml/README.md new file mode 100644 index 0000000..2c51aea --- /dev/null +++ b/src/components/node_modules/yaml/README.md @@ -0,0 +1,127 @@ +# YAML + +`yaml` is a JavaScript parser and stringifier for [YAML](http://yaml.org/), a human friendly data serialization standard. It supports both parsing and stringifying data using all versions of YAML, along with all common data schemas. As a particularly distinguishing feature, `yaml` fully supports reading and writing comments and blank lines in YAML documents. + +The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It has no external dependencies and runs on Node.js 6 and later, and in browsers from IE 11 upwards. + +For the purposes of versioning, any changes that break any of the endpoints or APIs documented here will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed). + +For more information, see the project's documentation site: [**eemeli.org/yaml/v1**](https://eemeli.org/yaml/v1/) + +To install: + +```sh +npm install yaml +``` + +**Note:** This is `yaml@1`. You may also be interested in the next version, currently available as [`yaml@next`](https://www.npmjs.com/package/yaml/v/next). + +## API Overview + +The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/v1/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude. + +```js +import YAML from 'yaml' +// or +const YAML = require('yaml') +``` + +### Parse & Stringify + +- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/v1/#yaml-parse) +- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/v1/#yaml-stringify) + +### YAML Documents + +- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/v1/#creating-nodes) +- [`YAML.defaultOptions`](https://eemeli.org/yaml/v1/#options) +- [`YAML.Document`](https://eemeli.org/yaml/v1/#yaml-documents) + - [`constructor(options)`](https://eemeli.org/yaml/v1/#creating-documents) + - [`defaults`](https://eemeli.org/yaml/v1/#options) + - [`#anchors`](https://eemeli.org/yaml/v1/#working-with-anchors) + - [`#contents`](https://eemeli.org/yaml/v1/#content-nodes) + - [`#errors`](https://eemeli.org/yaml/v1/#errors) +- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/v1/#parsing-documents) +- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/v1/#parsing-documents) + +```js +import { Pair, YAMLMap, YAMLSeq } from 'yaml/types' +``` + +- [`new Pair(key, value)`](https://eemeli.org/yaml/v1/#creating-nodes) +- [`new YAMLMap()`](https://eemeli.org/yaml/v1/#creating-nodes) +- [`new YAMLSeq()`](https://eemeli.org/yaml/v1/#creating-nodes) + +### CST Parser + +```js +import parseCST from 'yaml/parse-cst' +``` + +- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst) +- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst) + +## YAML.parse + +```yaml +# file.yml +YAML: + - A human-readable data serialization language + - https://en.wikipedia.org/wiki/YAML +yaml: + - A complete JavaScript implementation + - https://www.npmjs.com/package/yaml +``` + +```js +import fs from 'fs' +import YAML from 'yaml' + +YAML.parse('3.14159') +// 3.14159 + +YAML.parse('[ true, false, maybe, null ]\n') +// [ true, false, 'maybe', null ] + +const file = fs.readFileSync('./file.yml', 'utf8') +YAML.parse(file) +// { YAML: +// [ 'A human-readable data serialization language', +// 'https://en.wikipedia.org/wiki/YAML' ], +// yaml: +// [ 'A complete JavaScript implementation', +// 'https://www.npmjs.com/package/yaml' ] } +``` + +## YAML.stringify + +```js +import YAML from 'yaml' + +YAML.stringify(3.14159) +// '3.14159\n' + +YAML.stringify([true, false, 'maybe', null]) +// `- true +// - false +// - maybe +// - null +// ` + +YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' }) +// `number: 3 +// plain: string +// block: > +// two +// +// lines +// ` +``` + +--- + +Browser testing provided by: + + + + diff --git a/src/components/node_modules/yaml/browser/index.js b/src/components/node_modules/yaml/browser/index.js new file mode 100644 index 0000000..b501ac4 --- /dev/null +++ b/src/components/node_modules/yaml/browser/index.js @@ -0,0 +1 @@ +module.exports = require('./dist').YAML diff --git a/src/components/node_modules/yaml/browser/map.js b/src/components/node_modules/yaml/browser/map.js new file mode 100644 index 0000000..78f2ebc --- /dev/null +++ b/src/components/node_modules/yaml/browser/map.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').YAMLMap +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/pair.js b/src/components/node_modules/yaml/browser/pair.js new file mode 100644 index 0000000..b2880a2 --- /dev/null +++ b/src/components/node_modules/yaml/browser/pair.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').Pair +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/parse-cst.js b/src/components/node_modules/yaml/browser/parse-cst.js new file mode 100644 index 0000000..8065756 --- /dev/null +++ b/src/components/node_modules/yaml/browser/parse-cst.js @@ -0,0 +1 @@ +module.exports = require('./dist/parse-cst').parse diff --git a/src/components/node_modules/yaml/browser/scalar.js b/src/components/node_modules/yaml/browser/scalar.js new file mode 100644 index 0000000..deee1b0 --- /dev/null +++ b/src/components/node_modules/yaml/browser/scalar.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').Scalar +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/schema.js b/src/components/node_modules/yaml/browser/schema.js new file mode 100644 index 0000000..4139c4b --- /dev/null +++ b/src/components/node_modules/yaml/browser/schema.js @@ -0,0 +1,9 @@ +const types = require('./dist/types') +const util = require('./dist/util') + +module.exports = types.Schema +module.exports.nullOptions = types.nullOptions +module.exports.strOptions = types.strOptions +module.exports.stringify = util.stringifyString + +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/seq.js b/src/components/node_modules/yaml/browser/seq.js new file mode 100644 index 0000000..66147df --- /dev/null +++ b/src/components/node_modules/yaml/browser/seq.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').YAMLSeq +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/types.js b/src/components/node_modules/yaml/browser/types.js new file mode 100644 index 0000000..b1e46c4 --- /dev/null +++ b/src/components/node_modules/yaml/browser/types.js @@ -0,0 +1 @@ +module.exports = require('./dist/types') diff --git a/src/components/node_modules/yaml/browser/types/binary.js b/src/components/node_modules/yaml/browser/types/binary.js new file mode 100644 index 0000000..271b9de --- /dev/null +++ b/src/components/node_modules/yaml/browser/types/binary.js @@ -0,0 +1,8 @@ +'use strict' +Object.defineProperty(exports, '__esModule', { value: true }) + +const legacy = require('../dist/legacy-exports') +exports.binary = legacy.binary +exports.default = [exports.binary] + +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/types/omap.js b/src/components/node_modules/yaml/browser/types/omap.js new file mode 100644 index 0000000..37b638b --- /dev/null +++ b/src/components/node_modules/yaml/browser/types/omap.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.omap +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/types/pairs.js b/src/components/node_modules/yaml/browser/types/pairs.js new file mode 100644 index 0000000..f1df201 --- /dev/null +++ b/src/components/node_modules/yaml/browser/types/pairs.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.pairs +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/types/set.js b/src/components/node_modules/yaml/browser/types/set.js new file mode 100644 index 0000000..e7dc9d4 --- /dev/null +++ b/src/components/node_modules/yaml/browser/types/set.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.set +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/types/timestamp.js b/src/components/node_modules/yaml/browser/types/timestamp.js new file mode 100644 index 0000000..39c5b6d --- /dev/null +++ b/src/components/node_modules/yaml/browser/types/timestamp.js @@ -0,0 +1,10 @@ +'use strict' +Object.defineProperty(exports, '__esModule', { value: true }) + +const legacy = require('../dist/legacy-exports') +exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp] +exports.floatTime = legacy.floatTime +exports.intTime = legacy.intTime +exports.timestamp = legacy.timestamp + +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/browser/util.js b/src/components/node_modules/yaml/browser/util.js new file mode 100644 index 0000000..bf38456 --- /dev/null +++ b/src/components/node_modules/yaml/browser/util.js @@ -0,0 +1 @@ +module.exports = require('./dist/util') diff --git a/src/components/node_modules/yaml/index.d.ts b/src/components/node_modules/yaml/index.d.ts new file mode 100644 index 0000000..53eb011 --- /dev/null +++ b/src/components/node_modules/yaml/index.d.ts @@ -0,0 +1,372 @@ +import { CST } from './parse-cst' +import { + AST, + Alias, + Collection, + Merge, + Node, + Scalar, + Schema, + YAMLMap, + YAMLSeq +} from './types' +import { Type, YAMLError, YAMLWarning } from './util' + +export { AST, CST } +export { default as parseCST } from './parse-cst' + +/** + * `yaml` defines document-specific options in three places: as an argument of + * parse, create and stringify calls, in the values of `YAML.defaultOptions`, + * and in the version-dependent `YAML.Document.defaults` object. Values set in + * `YAML.defaultOptions` override version-dependent defaults, and argument + * options override both. + */ +export const defaultOptions: Options + +export interface Options extends Schema.Options { + /** + * Default prefix for anchors. + * + * Default: `'a'`, resulting in anchors `a1`, `a2`, etc. + */ + anchorPrefix?: string + /** + * The number of spaces to use when indenting code. + * + * Default: `2` + */ + indent?: number + /** + * Whether block sequences should be indented. + * + * Default: `true` + */ + indentSeq?: boolean + /** + * Allow non-JSON JavaScript objects to remain in the `toJSON` output. + * Relevant with the YAML 1.1 `!!timestamp` and `!!binary` tags as well as BigInts. + * + * Default: `true` + */ + keepBlobsInJSON?: boolean + /** + * Include references in the AST to each node's corresponding CST node. + * + * Default: `false` + */ + keepCstNodes?: boolean + /** + * Store the original node type when parsing documents. + * + * Default: `true` + */ + keepNodeTypes?: boolean + /** + * When outputting JS, use Map rather than Object to represent mappings. + * + * Default: `false` + */ + mapAsMap?: boolean + /** + * Prevent exponential entity expansion attacks by limiting data aliasing count; + * set to `-1` to disable checks; `0` disallows all alias nodes. + * + * Default: `100` + */ + maxAliasCount?: number + /** + * Include line position & node type directly in errors; drop their verbose source and context. + * + * Default: `false` + */ + prettyErrors?: boolean + /** + * When stringifying, require keys to be scalars and to use implicit rather than explicit notation. + * + * Default: `false` + */ + simpleKeys?: boolean + /** + * The YAML version used by documents without a `%YAML` directive. + * + * Default: `"1.2"` + */ + version?: '1.0' | '1.1' | '1.2' +} + +/** + * Some customization options are availabe to control the parsing and + * stringification of scalars. Note that these values are used by all documents. + */ +export const scalarOptions: { + binary: scalarOptions.Binary + bool: scalarOptions.Bool + int: scalarOptions.Int + null: scalarOptions.Null + str: scalarOptions.Str +} +export namespace scalarOptions { + interface Binary { + /** + * The type of string literal used to stringify `!!binary` values. + * + * Default: `'BLOCK_LITERAL'` + */ + defaultType: Scalar.Type + /** + * Maximum line width for `!!binary`. + * + * Default: `76` + */ + lineWidth: number + } + + interface Bool { + /** + * String representation for `true`. With the core schema, use `'true' | 'True' | 'TRUE'`. + * + * Default: `'true'` + */ + trueStr: string + /** + * String representation for `false`. With the core schema, use `'false' | 'False' | 'FALSE'`. + * + * Default: `'false'` + */ + falseStr: string + } + + interface Int { + /** + * Whether integers should be parsed into BigInt values. + * + * Default: `false` + */ + asBigInt: boolean + } + + interface Null { + /** + * String representation for `null`. With the core schema, use `'null' | 'Null' | 'NULL' | '~' | ''`. + * + * Default: `'null'` + */ + nullStr: string + } + + interface Str { + /** + * The default type of string literal used to stringify values + * + * Default: `'PLAIN'` + */ + defaultType: Scalar.Type + doubleQuoted: { + /** + * Whether to restrict double-quoted strings to use JSON-compatible syntax. + * + * Default: `false` + */ + jsonEncoding: boolean + /** + * Minimum length to use multiple lines to represent the value. + * + * Default: `40` + */ + minMultiLineLength: number + } + fold: { + /** + * Maximum line width (set to `0` to disable folding). + * + * Default: `80` + */ + lineWidth: number + /** + * Minimum width for highly-indented content. + * + * Default: `20` + */ + minContentWidth: number + } + } +} + +export class Document extends Collection { + cstNode?: CST.Document + constructor(options?: Options) + tag: never + directivesEndMarker?: boolean + type: Type.DOCUMENT + /** + * Anchors associated with the document's nodes; + * also provides alias & merge node creators. + */ + anchors: Document.Anchors + /** The document contents. */ + contents: any + /** Errors encountered during parsing. */ + errors: YAMLError[] + /** + * The schema used with the document. Use `setSchema()` to change or + * initialise. + */ + schema?: Schema + /** + * Array of prefixes; each will have a string `handle` that + * starts and ends with `!` and a string `prefix` that the handle will be replaced by. + */ + tagPrefixes: Document.TagPrefix[] + /** + * The parsed version of the source document; + * if true-ish, stringified output will include a `%YAML` directive. + */ + version?: string + /** Warnings encountered during parsing. */ + warnings: YAMLWarning[] + /** + * List the tags used in the document that are not in the default + * `tag:yaml.org,2002:` namespace. + */ + listNonDefaultTags(): string[] + /** Parse a CST into this document */ + parse(cst: CST.Document): this + /** + * When a document is created with `new YAML.Document()`, the schema object is + * not set as it may be influenced by parsed directives; call this with no + * arguments to set it manually, or with arguments to change the schema used + * by the document. + **/ + setSchema( + id?: Options['version'] | Schema.Name, + customTags?: (Schema.TagId | Schema.Tag)[] + ): void + /** Set `handle` as a shorthand string for the `prefix` tag namespace. */ + setTagPrefix(handle: string, prefix: string): void + /** + * A plain JavaScript representation of the document `contents`. + * + * @param arg Used by `JSON.stringify` to indicate the array index or property + * name. If its value is a `string` and the document `contents` has a scalar + * value, the `keepBlobsInJSON` option has no effect. + * @param onAnchor If defined, called with the resolved `value` and reference + * `count` for each anchor in the document. + * */ + toJSON(arg?: string, onAnchor?: (value: any, count: number) => void): any + /** A YAML representation of the document. */ + toString(): string +} + +export namespace Document { + interface Parsed extends Document { + contents: Scalar | YAMLMap | YAMLSeq | null + /** The schema used with the document. */ + schema: Schema + } + + interface Anchors { + /** + * Create a new `Alias` node, adding the required anchor for `node`. + * If `name` is empty, a new anchor name will be generated. + */ + createAlias(node: Node, name?: string): Alias + /** + * Create a new `Merge` node with the given source nodes. + * Non-`Alias` sources will be automatically wrapped. + */ + createMergePair(...nodes: Node[]): Merge + /** The anchor name associated with `node`, if set. */ + getName(node: Node): undefined | string + /** List of all defined anchor names. */ + getNames(): string[] + /** The node associated with the anchor `name`, if set. */ + getNode(name: string): undefined | Node + /** + * Find an available anchor name with the given `prefix` and a + * numerical suffix. + */ + newName(prefix: string): string + /** + * Associate an anchor with `node`. If `name` is empty, a new name will be generated. + * To remove an anchor, use `setAnchor(null, name)`. + */ + setAnchor(node: Node | null, name?: string): void | string + } + + interface TagPrefix { + handle: string + prefix: string + } +} + +/** + * Recursively turns objects into collections. Generic objects as well as `Map` + * and its descendants become mappings, while arrays and other iterable objects + * result in sequences. + * + * The primary purpose of this function is to enable attaching comments or other + * metadata to a value, or to otherwise exert more fine-grained control over the + * stringified output. To that end, you'll need to assign its return value to + * the `contents` of a Document (or somewhere within said contents), as the + * document's schema is required for YAML string output. + * + * @param wrapScalars If undefined or `true`, also wraps plain values in + * `Scalar` objects; if `false` and `value` is not an object, it will be + * returned directly. + * @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that + * this requires the corresponding tag to be available based on the default + * options. To use a specific document's schema, use `doc.schema.createNode`. + */ +export function createNode( + value: any, + wrapScalars?: true, + tag?: string +): YAMLMap | YAMLSeq | Scalar + +/** + * YAML.createNode recursively turns objects into Map and arrays to Seq collections. + * Its primary use is to enable attaching comments or other metadata to a value, + * or to otherwise exert more fine-grained control over the stringified output. + * + * Doesn't wrap plain values in Scalar objects. + */ +export function createNode( + value: any, + wrapScalars: false, + tag?: string +): YAMLMap | YAMLSeq | string | number | boolean | null + +/** + * Parse an input string into a single YAML.Document. + */ +export function parseDocument(str: string, options?: Options): Document.Parsed + +/** + * Parse the input as a stream of YAML documents. + * + * Documents should be separated from each other by `...` or `---` marker lines. + */ +export function parseAllDocuments( + str: string, + options?: Options +): Document.Parsed[] + +/** + * Parse an input string into JavaScript. + * + * Only supports input consisting of a single YAML document; for multi-document + * support you should use `YAML.parseAllDocuments`. May throw on error, and may + * log warnings using `console.warn`. + * + * @param str A string with YAML formatting. + * @returns The value will match the type of the root value of the parsed YAML + * document, so Maps become objects, Sequences arrays, and scalars result in + * nulls, booleans, numbers and strings. + */ +export function parse(str: string, options?: Options): any + +/** + * @returns Will always include \n as the last character, as is expected of YAML documents. + */ +export function stringify(value: any, options?: Options): string diff --git a/src/components/node_modules/yaml/index.js b/src/components/node_modules/yaml/index.js new file mode 100644 index 0000000..b501ac4 --- /dev/null +++ b/src/components/node_modules/yaml/index.js @@ -0,0 +1 @@ +module.exports = require('./dist').YAML diff --git a/src/components/node_modules/yaml/map.js b/src/components/node_modules/yaml/map.js new file mode 100644 index 0000000..78f2ebc --- /dev/null +++ b/src/components/node_modules/yaml/map.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').YAMLMap +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/package.json b/src/components/node_modules/yaml/package.json new file mode 100644 index 0000000..d91b0dd --- /dev/null +++ b/src/components/node_modules/yaml/package.json @@ -0,0 +1,106 @@ +{ + "name": "yaml", + "version": "1.10.2", + "license": "ISC", + "author": "Eemeli Aro ", + "repository": "github:eemeli/yaml", + "description": "JavaScript parser and stringifier for YAML", + "keywords": [ + "YAML", + "parser", + "stringifier" + ], + "homepage": "https://eemeli.org/yaml/v1/", + "files": [ + "browser/", + "dist/", + "types/", + "*.d.ts", + "*.js", + "*.mjs", + "!*config.js" + ], + "type": "commonjs", + "main": "./index.js", + "browser": { + "./index.js": "./browser/index.js", + "./map.js": "./browser/map.js", + "./pair.js": "./browser/pair.js", + "./parse-cst.js": "./browser/parse-cst.js", + "./scalar.js": "./browser/scalar.js", + "./schema.js": "./browser/schema.js", + "./seq.js": "./browser/seq.js", + "./types.js": "./browser/types.js", + "./types.mjs": "./browser/types.js", + "./types/binary.js": "./browser/types/binary.js", + "./types/omap.js": "./browser/types/omap.js", + "./types/pairs.js": "./browser/types/pairs.js", + "./types/set.js": "./browser/types/set.js", + "./types/timestamp.js": "./browser/types/timestamp.js", + "./util.js": "./browser/util.js", + "./util.mjs": "./browser/util.js" + }, + "exports": { + ".": "./index.js", + "./parse-cst": "./parse-cst.js", + "./types": [ + { + "import": "./types.mjs" + }, + "./types.js" + ], + "./util": [ + { + "import": "./util.mjs" + }, + "./util.js" + ], + "./": "./" + }, + "scripts": { + "build": "npm run build:node && npm run build:browser", + "build:browser": "rollup -c rollup.browser-config.js", + "build:node": "rollup -c rollup.node-config.js", + "clean": "git clean -fdxe node_modules", + "lint": "eslint src/", + "prettier": "prettier --write .", + "start": "cross-env TRACE_LEVEL=log npm run build:node && node -i -e 'YAML=require(\".\")'", + "test": "jest", + "test:browsers": "cd playground && npm test", + "test:dist": "npm run build:node && jest", + "test:types": "tsc --lib ES2017 --noEmit tests/typings.ts", + "docs:install": "cd docs-slate && bundle install", + "docs:deploy": "cd docs-slate && ./deploy.sh", + "docs": "cd docs-slate && bundle exec middleman server", + "preversion": "npm test && npm run build", + "prepublishOnly": "npm run clean && npm test && npm run build" + }, + "browserslist": "> 0.5%, not dead", + "prettier": { + "arrowParens": "avoid", + "semi": false, + "singleQuote": true, + "trailingComma": "none" + }, + "devDependencies": { + "@babel/core": "^7.12.10", + "@babel/plugin-proposal-class-properties": "^7.12.1", + "@babel/preset-env": "^7.12.11", + "@rollup/plugin-babel": "^5.2.3", + "babel-eslint": "^10.1.0", + "babel-jest": "^26.6.3", + "babel-plugin-trace": "^1.1.0", + "common-tags": "^1.8.0", + "cross-env": "^7.0.3", + "eslint": "^7.19.0", + "eslint-config-prettier": "^7.2.0", + "fast-check": "^2.12.0", + "jest": "^26.6.3", + "prettier": "^2.2.1", + "rollup": "^2.38.2", + "typescript": "^4.1.3" + }, + "engines": { + "node": ">= 6" + } +} diff --git a/src/components/node_modules/yaml/pair.js b/src/components/node_modules/yaml/pair.js new file mode 100644 index 0000000..b2880a2 --- /dev/null +++ b/src/components/node_modules/yaml/pair.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').Pair +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/parse-cst.d.ts b/src/components/node_modules/yaml/parse-cst.d.ts new file mode 100644 index 0000000..9fd2ebf --- /dev/null +++ b/src/components/node_modules/yaml/parse-cst.d.ts @@ -0,0 +1,191 @@ +import { Type, YAMLSyntaxError } from './util' + +export default function parseCST(str: string): ParsedCST + +export interface ParsedCST extends Array { + setOrigRanges(): boolean +} + +export namespace CST { + interface Range { + start: number + end: number + origStart?: number + origEnd?: number + isEmpty(): boolean + } + + interface ParseContext { + /** Node starts at beginning of line */ + atLineStart: boolean + /** true if currently in a collection context */ + inCollection: boolean + /** true if currently in a flow context */ + inFlow: boolean + /** Current level of indentation */ + indent: number + /** Start of the current line */ + lineStart: number + /** The parent of the node */ + parent: Node + /** Source of the YAML document */ + src: string + } + + interface Node { + context: ParseContext | null + /** if not null, indicates a parser failure */ + error: YAMLSyntaxError | null + /** span of context.src parsed into this node */ + range: Range | null + valueRange: Range | null + /** anchors, tags and comments */ + props: Range[] + /** specific node type */ + type: Type + /** if non-null, overrides source value */ + value: string | null + + readonly anchor: string | null + readonly comment: string | null + readonly hasComment: boolean + readonly hasProps: boolean + readonly jsonLike: boolean + readonly rangeAsLinePos: null | { + start: { line: number; col: number } + end?: { line: number; col: number } + } + readonly rawValue: string | null + readonly tag: + | null + | { verbatim: string } + | { handle: string; suffix: string } + readonly valueRangeContainsNewline: boolean + } + + interface Alias extends Node { + type: Type.ALIAS + /** contain the anchor without the * prefix */ + readonly rawValue: string + } + + type Scalar = BlockValue | PlainValue | QuoteValue + + interface BlockValue extends Node { + type: Type.BLOCK_FOLDED | Type.BLOCK_LITERAL + chomping: 'CLIP' | 'KEEP' | 'STRIP' + blockIndent: number | null + header: Range + readonly strValue: string | null + } + + interface BlockFolded extends BlockValue { + type: Type.BLOCK_FOLDED + } + + interface BlockLiteral extends BlockValue { + type: Type.BLOCK_LITERAL + } + + interface PlainValue extends Node { + type: Type.PLAIN + readonly strValue: string | null + } + + interface QuoteValue extends Node { + type: Type.QUOTE_DOUBLE | Type.QUOTE_SINGLE + readonly strValue: + | null + | string + | { str: string; errors: YAMLSyntaxError[] } + } + + interface QuoteDouble extends QuoteValue { + type: Type.QUOTE_DOUBLE + } + + interface QuoteSingle extends QuoteValue { + type: Type.QUOTE_SINGLE + } + + interface Comment extends Node { + type: Type.COMMENT + readonly anchor: null + readonly comment: string + readonly rawValue: null + readonly tag: null + } + + interface BlankLine extends Node { + type: Type.BLANK_LINE + } + + interface MapItem extends Node { + type: Type.MAP_KEY | Type.MAP_VALUE + node: ContentNode | null + } + + interface MapKey extends MapItem { + type: Type.MAP_KEY + } + + interface MapValue extends MapItem { + type: Type.MAP_VALUE + } + + interface Map extends Node { + type: Type.MAP + /** implicit keys are not wrapped */ + items: Array + } + + interface SeqItem extends Node { + type: Type.SEQ_ITEM + node: ContentNode | null + } + + interface Seq extends Node { + type: Type.SEQ + items: Array + } + + interface FlowChar { + char: '{' | '}' | '[' | ']' | ',' | '?' | ':' + offset: number + origOffset?: number + } + + interface FlowCollection extends Node { + type: Type.FLOW_MAP | Type.FLOW_SEQ + items: Array< + FlowChar | BlankLine | Comment | Alias | Scalar | FlowCollection + > + } + + interface FlowMap extends FlowCollection { + type: Type.FLOW_MAP + } + + interface FlowSeq extends FlowCollection { + type: Type.FLOW_SEQ + } + + type ContentNode = Alias | Scalar | Map | Seq | FlowCollection + + interface Directive extends Node { + type: Type.DIRECTIVE + name: string + readonly anchor: null + readonly parameters: string[] + readonly tag: null + } + + interface Document extends Node { + type: Type.DOCUMENT + directives: Array + contents: Array + readonly anchor: null + readonly comment: null + readonly tag: null + } +} diff --git a/src/components/node_modules/yaml/parse-cst.js b/src/components/node_modules/yaml/parse-cst.js new file mode 100644 index 0000000..8065756 --- /dev/null +++ b/src/components/node_modules/yaml/parse-cst.js @@ -0,0 +1 @@ +module.exports = require('./dist/parse-cst').parse diff --git a/src/components/node_modules/yaml/scalar.js b/src/components/node_modules/yaml/scalar.js new file mode 100644 index 0000000..deee1b0 --- /dev/null +++ b/src/components/node_modules/yaml/scalar.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').Scalar +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/schema.js b/src/components/node_modules/yaml/schema.js new file mode 100644 index 0000000..4139c4b --- /dev/null +++ b/src/components/node_modules/yaml/schema.js @@ -0,0 +1,9 @@ +const types = require('./dist/types') +const util = require('./dist/util') + +module.exports = types.Schema +module.exports.nullOptions = types.nullOptions +module.exports.strOptions = types.strOptions +module.exports.stringify = util.stringifyString + +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/seq.js b/src/components/node_modules/yaml/seq.js new file mode 100644 index 0000000..66147df --- /dev/null +++ b/src/components/node_modules/yaml/seq.js @@ -0,0 +1,2 @@ +module.exports = require('./dist/types').YAMLSeq +require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/types.d.ts b/src/components/node_modules/yaml/types.d.ts new file mode 100644 index 0000000..411e74e --- /dev/null +++ b/src/components/node_modules/yaml/types.d.ts @@ -0,0 +1,407 @@ +import { Document, scalarOptions } from './index' +import { CST } from './parse-cst' +import { Type } from './util' + +export const binaryOptions: scalarOptions.Binary +export const boolOptions: scalarOptions.Bool +export const intOptions: scalarOptions.Int +export const nullOptions: scalarOptions.Null +export const strOptions: scalarOptions.Str + +export class Schema { + /** Default: `'tag:yaml.org,2002:'` */ + static defaultPrefix: string + static defaultTags: { + /** Default: `'tag:yaml.org,2002:map'` */ + MAP: string + /** Default: `'tag:yaml.org,2002:seq'` */ + SEQ: string + /** Default: `'tag:yaml.org,2002:str'` */ + STR: string + } + constructor(options: Schema.Options) + /** + * Convert any value into a `Node` using this schema, recursively turning + * objects into collections. + * + * @param wrapScalars If `true`, also wraps plain values in `Scalar` objects; + * if undefined or `false` and `value` is not an object, it will be returned + * directly. + * @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that + * this requires the corresponding tag to be available in this schema. + */ + createNode( + value: any, + wrapScalars?: boolean, + tag?: string, + ctx?: Schema.CreateNodeContext + ): Node + /** + * Convert a key and a value into a `Pair` using this schema, recursively + * wrapping all values as `Scalar` or `Collection` nodes. + * + * @param ctx To not wrap scalars, use a context `{ wrapScalars: false }` + */ + createPair(key: any, value: any, ctx?: Schema.CreateNodeContext): Pair + merge: boolean + name: Schema.Name + sortMapEntries: ((a: Pair, b: Pair) => number) | null + tags: Schema.Tag[] +} + +export namespace Schema { + type Name = 'core' | 'failsafe' | 'json' | 'yaml-1.1' + + interface Options { + /** + * Array of additional tags to include in the schema, or a function that may + * modify the schema's base tag array. + */ + customTags?: (TagId | Tag)[] | ((tags: Tag[]) => Tag[]) + /** + * Enable support for `<<` merge keys. + * + * Default: `false` for YAML 1.2, `true` for earlier versions + */ + merge?: boolean + /** + * The base schema to use. + * + * Default: `"core"` for YAML 1.2, `"yaml-1.1"` for earlier versions + */ + schema?: Name + /** + * When stringifying, sort map entries. If `true`, sort by comparing key values with `<`. + * + * Default: `false` + */ + sortMapEntries?: boolean | ((a: Pair, b: Pair) => number) + /** + * @deprecated Use `customTags` instead. + */ + tags?: Options['customTags'] + } + + interface CreateNodeContext { + wrapScalars?: boolean + [key: string]: any + } + + interface StringifyContext { + forceBlockIndent?: boolean + implicitKey?: boolean + indent?: string + indentAtStart?: number + inFlow?: boolean + [key: string]: any + } + + type TagId = + | 'binary' + | 'bool' + | 'float' + | 'floatExp' + | 'floatNaN' + | 'floatTime' + | 'int' + | 'intHex' + | 'intOct' + | 'intTime' + | 'null' + | 'omap' + | 'pairs' + | 'set' + | 'timestamp' + + type Tag = CustomTag | DefaultTag + + interface BaseTag { + /** + * An optional factory function, used e.g. by collections when wrapping JS objects as AST nodes. + */ + createNode?: ( + schema: Schema, + value: any, + ctx: Schema.CreateNodeContext + ) => YAMLMap | YAMLSeq | Scalar + /** + * If a tag has multiple forms that should be parsed and/or stringified differently, use `format` to identify them. + */ + format?: string + /** + * Used by `YAML.createNode` to detect your data type, e.g. using `typeof` or + * `instanceof`. + */ + identify(value: any): boolean + /** + * The `Node` child class that implements this tag. Required for collections and tags that have overlapping JS representations. + */ + nodeClass?: new () => any + /** + * Used by some tags to configure their stringification, where applicable. + */ + options?: object + /** + * Optional function stringifying the AST node in the current context. If your + * data includes a suitable `.toString()` method, you can probably leave this + * undefined and use the default stringifier. + * + * @param item The node being stringified. + * @param ctx Contains the stringifying context variables. + * @param onComment Callback to signal that the stringifier includes the + * item's comment in its output. + * @param onChompKeep Callback to signal that the output uses a block scalar + * type with the `+` chomping indicator. + */ + stringify?: ( + item: Node, + ctx: Schema.StringifyContext, + onComment?: () => void, + onChompKeep?: () => void + ) => string + /** + * The identifier for your data type, with which its stringified form will be + * prefixed. Should either be a !-prefixed local `!tag`, or a fully qualified + * `tag:domain,date:foo`. + */ + tag: string + } + + interface CustomTag extends BaseTag { + /** + * A JavaScript class that should be matched to this tag, e.g. `Date` for `!!timestamp`. + * @deprecated Use `Tag.identify` instead + */ + class?: new () => any + /** + * Turns a CST node into an AST node. If returning a non-`Node` value, the + * output will be wrapped as a `Scalar`. + */ + resolve(doc: Document, cstNode: CST.Node): Node | any + } + + interface DefaultTag extends BaseTag { + /** + * If `true`, together with `test` allows for values to be stringified without + * an explicit tag. For most cases, it's unlikely that you'll actually want to + * use this, even if you first think you do. + */ + default: true + /** + * Alternative form used by default tags; called with `test` match results. + */ + resolve(...match: string[]): Node | any + /** + * Together with `default` allows for values to be stringified without an + * explicit tag and detected using a regular expression. For most cases, it's + * unlikely that you'll actually want to use these, even if you first think + * you do. + */ + test: RegExp + } +} + +export class Node { + /** A comment on or immediately after this */ + comment?: string | null + /** A comment before this */ + commentBefore?: string | null + /** Only available when `keepCstNodes` is set to `true` */ + cstNode?: CST.Node + /** + * The [start, end] range of characters of the source parsed + * into this node (undefined for pairs or if not parsed) + */ + range?: [number, number] | null + /** A blank line before this node and its commentBefore */ + spaceBefore?: boolean + /** A fully qualified tag, if required */ + tag?: string + /** A plain JS representation of this node */ + toJSON(arg?: any): any + /** The type of this node */ + type?: Type | Pair.Type +} + +export class Scalar extends Node { + constructor(value: any) + type?: Scalar.Type + /** + * By default (undefined), numbers use decimal notation. + * The YAML 1.2 core schema only supports 'HEX' and 'OCT'. + */ + format?: 'BIN' | 'HEX' | 'OCT' | 'TIME' + value: any + toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any + toString(): string +} +export namespace Scalar { + type Type = + | Type.BLOCK_FOLDED + | Type.BLOCK_LITERAL + | Type.PLAIN + | Type.QUOTE_DOUBLE + | Type.QUOTE_SINGLE +} + +export class Alias extends Node { + type: Type.ALIAS + source: Node + cstNode?: CST.Alias + toString(ctx: Schema.StringifyContext): string +} + +export class Pair extends Node { + constructor(key: any, value?: any) + type: Pair.Type.PAIR | Pair.Type.MERGE_PAIR + /** Always Node or null when parsed, but can be set to anything. */ + key: any + /** Always Node or null when parsed, but can be set to anything. */ + value: any + cstNode?: never // no corresponding cstNode + toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map + toString( + ctx?: Schema.StringifyContext, + onComment?: () => void, + onChompKeep?: () => void + ): string +} +export namespace Pair { + enum Type { + PAIR = 'PAIR', + MERGE_PAIR = 'MERGE_PAIR' + } +} + +export class Merge extends Pair { + type: Pair.Type.MERGE_PAIR + /** Always Scalar('<<'), defined by the type specification */ + key: AST.PlainValue + /** Always YAMLSeq, stringified as *A if length = 1 */ + value: YAMLSeq + toString(ctx?: Schema.StringifyContext, onComment?: () => void): string +} + +export class Collection extends Node { + type?: Type.MAP | Type.FLOW_MAP | Type.SEQ | Type.FLOW_SEQ | Type.DOCUMENT + items: any[] + schema?: Schema + + /** + * Adds a value to the collection. For `!!map` and `!!omap` the value must + * be a Pair instance or a `{ key, value }` object, which may not have a key + * that already exists in the map. + */ + add(value: any): void + addIn(path: Iterable, value: any): void + /** + * Removes a value from the collection. + * @returns `true` if the item was found and removed. + */ + delete(key: any): boolean + deleteIn(path: Iterable): boolean + /** + * Returns item at `key`, or `undefined` if not found. By default unwraps + * scalar values from their surrounding node; to disable set `keepScalar` to + * `true` (collections are always returned intact). + */ + get(key: any, keepScalar?: boolean): any + getIn(path: Iterable, keepScalar?: boolean): any + /** + * Checks if the collection includes a value with the key `key`. + */ + has(key: any): boolean + hasIn(path: Iterable): boolean + /** + * Sets a value in this collection. For `!!set`, `value` needs to be a + * boolean to add/remove the item from the set. + */ + set(key: any, value: any): void + setIn(path: Iterable, value: any): void +} + +export class YAMLMap extends Collection { + type?: Type.FLOW_MAP | Type.MAP + items: Array + hasAllNullValues(): boolean + toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map + toString( + ctx?: Schema.StringifyContext, + onComment?: () => void, + onChompKeep?: () => void + ): string +} + +export class YAMLSeq extends Collection { + type?: Type.FLOW_SEQ | Type.SEQ + delete(key: number | string | Scalar): boolean + get(key: number | string | Scalar, keepScalar?: boolean): any + has(key: number | string | Scalar): boolean + set(key: number | string | Scalar, value: any): void + hasAllNullValues(): boolean + toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any[] + toString( + ctx?: Schema.StringifyContext, + onComment?: () => void, + onChompKeep?: () => void + ): string +} + +export namespace AST { + interface NodeToJsonContext { + anchors?: any[] + doc: Document + keep?: boolean + mapAsMap?: boolean + maxAliasCount?: number + onCreate?: (node: Node) => void + [key: string]: any + } + + interface BlockFolded extends Scalar { + type: Type.BLOCK_FOLDED + cstNode?: CST.BlockFolded + } + + interface BlockLiteral extends Scalar { + type: Type.BLOCK_LITERAL + cstNode?: CST.BlockLiteral + } + + interface PlainValue extends Scalar { + type: Type.PLAIN + cstNode?: CST.PlainValue + } + + interface QuoteDouble extends Scalar { + type: Type.QUOTE_DOUBLE + cstNode?: CST.QuoteDouble + } + + interface QuoteSingle extends Scalar { + type: Type.QUOTE_SINGLE + cstNode?: CST.QuoteSingle + } + + interface FlowMap extends YAMLMap { + type: Type.FLOW_MAP + cstNode?: CST.FlowMap + } + + interface BlockMap extends YAMLMap { + type: Type.MAP + cstNode?: CST.Map + } + + interface FlowSeq extends YAMLSeq { + type: Type.FLOW_SEQ + items: Array + cstNode?: CST.FlowSeq + } + + interface BlockSeq extends YAMLSeq { + type: Type.SEQ + items: Array + cstNode?: CST.Seq + } +} diff --git a/src/components/node_modules/yaml/types.js b/src/components/node_modules/yaml/types.js new file mode 100644 index 0000000..8874749 --- /dev/null +++ b/src/components/node_modules/yaml/types.js @@ -0,0 +1,17 @@ +const types = require('./dist/types') + +exports.binaryOptions = types.binaryOptions +exports.boolOptions = types.boolOptions +exports.intOptions = types.intOptions +exports.nullOptions = types.nullOptions +exports.strOptions = types.strOptions + +exports.Schema = types.Schema +exports.Alias = types.Alias +exports.Collection = types.Collection +exports.Merge = types.Merge +exports.Node = types.Node +exports.Pair = types.Pair +exports.Scalar = types.Scalar +exports.YAMLMap = types.YAMLMap +exports.YAMLSeq = types.YAMLSeq diff --git a/src/components/node_modules/yaml/types.mjs b/src/components/node_modules/yaml/types.mjs new file mode 100644 index 0000000..7132288 --- /dev/null +++ b/src/components/node_modules/yaml/types.mjs @@ -0,0 +1,17 @@ +import types from './dist/types.js' + +export const binaryOptions = types.binaryOptions +export const boolOptions = types.boolOptions +export const intOptions = types.intOptions +export const nullOptions = types.nullOptions +export const strOptions = types.strOptions + +export const Schema = types.Schema +export const Alias = types.Alias +export const Collection = types.Collection +export const Merge = types.Merge +export const Node = types.Node +export const Pair = types.Pair +export const Scalar = types.Scalar +export const YAMLMap = types.YAMLMap +export const YAMLSeq = types.YAMLSeq diff --git a/src/components/node_modules/yaml/types/binary.js b/src/components/node_modules/yaml/types/binary.js new file mode 100644 index 0000000..271b9de --- /dev/null +++ b/src/components/node_modules/yaml/types/binary.js @@ -0,0 +1,8 @@ +'use strict' +Object.defineProperty(exports, '__esModule', { value: true }) + +const legacy = require('../dist/legacy-exports') +exports.binary = legacy.binary +exports.default = [exports.binary] + +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/types/omap.js b/src/components/node_modules/yaml/types/omap.js new file mode 100644 index 0000000..37b638b --- /dev/null +++ b/src/components/node_modules/yaml/types/omap.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.omap +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/types/pairs.js b/src/components/node_modules/yaml/types/pairs.js new file mode 100644 index 0000000..f1df201 --- /dev/null +++ b/src/components/node_modules/yaml/types/pairs.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.pairs +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/types/set.js b/src/components/node_modules/yaml/types/set.js new file mode 100644 index 0000000..e7dc9d4 --- /dev/null +++ b/src/components/node_modules/yaml/types/set.js @@ -0,0 +1,3 @@ +const legacy = require('../dist/legacy-exports') +module.exports = legacy.set +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/types/timestamp.js b/src/components/node_modules/yaml/types/timestamp.js new file mode 100644 index 0000000..39c5b6d --- /dev/null +++ b/src/components/node_modules/yaml/types/timestamp.js @@ -0,0 +1,10 @@ +'use strict' +Object.defineProperty(exports, '__esModule', { value: true }) + +const legacy = require('../dist/legacy-exports') +exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp] +exports.floatTime = legacy.floatTime +exports.intTime = legacy.intTime +exports.timestamp = legacy.timestamp + +legacy.warnFileDeprecation(__filename) diff --git a/src/components/node_modules/yaml/util.d.ts b/src/components/node_modules/yaml/util.d.ts new file mode 100644 index 0000000..b135541 --- /dev/null +++ b/src/components/node_modules/yaml/util.d.ts @@ -0,0 +1,86 @@ +import { Document } from './index' +import { CST } from './parse-cst' +import { AST, Pair, Scalar, Schema } from './types' + +export function findPair(items: any[], key: Scalar | any): Pair | undefined + +export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap +export function parseMap(doc: Document, cst: CST.FlowMap): AST.FlowMap +export function parseSeq(doc: Document, cst: CST.Seq): AST.BlockSeq +export function parseSeq(doc: Document, cst: CST.FlowSeq): AST.FlowSeq + +export function stringifyNumber(item: Scalar): string +export function stringifyString( + item: Scalar, + ctx: Schema.StringifyContext, + onComment?: () => void, + onChompKeep?: () => void +): string + +export function toJSON( + value: any, + arg?: any, + ctx?: Schema.CreateNodeContext +): any + +export enum Type { + ALIAS = 'ALIAS', + BLANK_LINE = 'BLANK_LINE', + BLOCK_FOLDED = 'BLOCK_FOLDED', + BLOCK_LITERAL = 'BLOCK_LITERAL', + COMMENT = 'COMMENT', + DIRECTIVE = 'DIRECTIVE', + DOCUMENT = 'DOCUMENT', + FLOW_MAP = 'FLOW_MAP', + FLOW_SEQ = 'FLOW_SEQ', + MAP = 'MAP', + MAP_KEY = 'MAP_KEY', + MAP_VALUE = 'MAP_VALUE', + PLAIN = 'PLAIN', + QUOTE_DOUBLE = 'QUOTE_DOUBLE', + QUOTE_SINGLE = 'QUOTE_SINGLE', + SEQ = 'SEQ', + SEQ_ITEM = 'SEQ_ITEM' +} + +interface LinePos { + line: number + col: number +} + +export class YAMLError extends Error { + name: + | 'YAMLReferenceError' + | 'YAMLSemanticError' + | 'YAMLSyntaxError' + | 'YAMLWarning' + message: string + source?: CST.Node + + nodeType?: Type + range?: CST.Range + linePos?: { start: LinePos; end: LinePos } + + /** + * Drops `source` and adds `nodeType`, `range` and `linePos`, as well as + * adding details to `message`. Run automatically for document errors if + * the `prettyErrors` option is set. + */ + makePretty(): void +} + +export class YAMLReferenceError extends YAMLError { + name: 'YAMLReferenceError' +} + +export class YAMLSemanticError extends YAMLError { + name: 'YAMLSemanticError' +} + +export class YAMLSyntaxError extends YAMLError { + name: 'YAMLSyntaxError' +} + +export class YAMLWarning extends YAMLError { + name: 'YAMLWarning' +} diff --git a/src/components/node_modules/yaml/util.js b/src/components/node_modules/yaml/util.js new file mode 100644 index 0000000..06dd2c9 --- /dev/null +++ b/src/components/node_modules/yaml/util.js @@ -0,0 +1,16 @@ +const util = require('./dist/util') + +exports.findPair = util.findPair +exports.toJSON = util.toJSON +exports.parseMap = util.parseMap +exports.parseSeq = util.parseSeq + +exports.stringifyNumber = util.stringifyNumber +exports.stringifyString = util.stringifyString +exports.Type = util.Type + +exports.YAMLError = util.YAMLError +exports.YAMLReferenceError = util.YAMLReferenceError +exports.YAMLSemanticError = util.YAMLSemanticError +exports.YAMLSyntaxError = util.YAMLSyntaxError +exports.YAMLWarning = util.YAMLWarning diff --git a/src/components/node_modules/yaml/util.mjs b/src/components/node_modules/yaml/util.mjs new file mode 100644 index 0000000..89e654a --- /dev/null +++ b/src/components/node_modules/yaml/util.mjs @@ -0,0 +1,18 @@ +import util from './dist/util.js' + +export const findPair = util.findPair +export const toJSON = util.toJSON + +export const parseMap = util.parseMap +export const parseSeq = util.parseSeq + +export const stringifyNumber = util.stringifyNumber +export const stringifyString = util.stringifyString + +export const Type = util.Type + +export const YAMLError = util.YAMLError +export const YAMLReferenceError = util.YAMLReferenceError +export const YAMLSemanticError = util.YAMLSemanticError +export const YAMLSyntaxError = util.YAMLSyntaxError +export const YAMLWarning = util.YAMLWarning diff --git a/src/components/package.json b/src/components/package.json new file mode 100644 index 0000000..0b2fba6 --- /dev/null +++ b/src/components/package.json @@ -0,0 +1,38 @@ +{ + "name": "@lingdocs/ps-react", + "version": "0.0.7", + "description": "Pashto inflector library module with React components", + "main": "dist/components/library.js", + "module": "dist/components/library.js", + "types": "dist/components/library.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/lingdocs/pashto-inflector.git" + }, + "publishConfig": { + "registry": "https://npm.lingdocs.com" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "echo \"build from repo root\"" + }, + "author": "lingdocs.com", + "license": "MIT", + "dependencies": { + "@formkit/auto-animate": "^1.0.0-beta.3", + "classnames": "^2.2.6", + "jsurl2": "^2.1.0", + "lz-string": "^1.4.4", + "react-select": "^5.4.0" + }, + "peerDependencies": { + "react": "^17.0.1", + "react-bootstrap": "^1.5.1", + "react-dom": "^17.0.1" + }, + "devDependencies": { + "fs-extra": "^10.1.0" + } +} diff --git a/src/components/post-build.cjs b/src/components/post-build.cjs new file mode 100644 index 0000000..6cbdcc9 --- /dev/null +++ b/src/components/post-build.cjs @@ -0,0 +1,22 @@ +const glob = require("glob"); +const fs = require("fs-extra"); +const path = require("path"); + +glob("src/verb-info/*.svg", (err, files) => { + if (err) throw err; + files.forEach((file) => { + fs.copySync(file, `dist/components/src/verb-info/${path.basename(file)}`); + }); +}); +glob("src/vp-explorer/*.svg", (err, files) => { + if (err) throw err; + files.forEach((file) => { + fs.copySync(file, `dist/components/src/vp-explorer/${path.basename(file)}`); + }); +}); +glob("src/vp-explorer/*.jpg", (err, files) => { + if (err) throw err; + files.forEach((file) => { + fs.copySync(file, `dist/components/src/vp-explorer/${path.basename(file)}`); + }); +}); diff --git a/src/components/ButtonSelect.tsx b/src/components/src/ButtonSelect.tsx similarity index 100% rename from src/components/ButtonSelect.tsx rename to src/components/src/ButtonSelect.tsx diff --git a/src/components/CompiledPTextDisplay.tsx b/src/components/src/CompiledPTextDisplay.tsx similarity index 89% rename from src/components/CompiledPTextDisplay.tsx rename to src/components/src/CompiledPTextDisplay.tsx index acaef6e..bc44298 100644 --- a/src/components/CompiledPTextDisplay.tsx +++ b/src/components/src/CompiledPTextDisplay.tsx @@ -1,5 +1,5 @@ -import { getLength, getLong } from "../lib/p-text-helpers"; -import * as T from "../types"; +import { getLength, getLong } from "../../lib/src/p-text-helpers"; +import * as T from "../../types"; import Examples from "./Examples"; function CompiledPTextDisplay({ compiled, opts, justify, onlyOne, length }: { diff --git a/src/components/ComplementPicker.tsx b/src/components/src/ComplementPicker.tsx similarity index 98% rename from src/components/ComplementPicker.tsx rename to src/components/src/ComplementPicker.tsx index 920855c..e1a85cc 100644 --- a/src/components/ComplementPicker.tsx +++ b/src/components/src/ComplementPicker.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import * as T from "../types"; +import * as T from "../../types"; import AdjectivePicker from "./np-picker/AdjectivePicker"; import LocativeAdverbPicker from "./ep-explorer/eq-comp-picker/LocativeAdverbPicker"; import SandwichPicker from "./np-picker/SandwichPicker"; diff --git a/src/components/DisplayModeSelect.tsx b/src/components/src/DisplayModeSelect.tsx similarity index 100% rename from src/components/DisplayModeSelect.tsx rename to src/components/src/DisplayModeSelect.tsx diff --git a/src/components/src/EntrySelect.tsx b/src/components/src/EntrySelect.tsx new file mode 100644 index 0000000..ea132a4 --- /dev/null +++ b/src/components/src/EntrySelect.tsx @@ -0,0 +1,180 @@ +import * as T from "../../types"; +import { StyleHTMLAttributes } from "react"; +import Select, { StylesConfig } from "react-select"; +import AsyncSelect from "react-select/async"; +import { + makeSelectOption, + makeVerbSelectOption, +} from "./np-picker/picker-tools"; + +export const customStyles: StylesConfig = { + menuPortal: (base: any) => ({ + ...base, + zIndex: 99999, + }), + menu: (base: any) => ({ + ...base, + zIndex: 999999, + }), + option: (provided: any, state: any) => ({ + ...provided, + padding: "10px 5px", + color: "#121418", + }), + input: (base: any) => ({ + ...base, + padding: 0, + }), +} + +function EntrySelect(props: { + entryFeeder: T.EntryFeederSingleType, + value: E | undefined, + onChange: (value: E | undefined) => void, + name: string | undefined, + isVerbSelect?: boolean, + opts: T.TextOptions, + style?: StyleHTMLAttributes, +}) { + const divStyle = props.style || { width: "13rem" }; + const placeholder = "entries" in props ? "Select…" : "Search Pashto"; + function makeOption(e: E | T.DictionaryEntry) { + if ("entry" in e) { + return (props.isVerbSelect ? makeVerbSelectOption : makeSelectOption)(e, props.opts); + } + return makeSelectOption(e, props.opts); + } + const value = props.value ? makeOption(props.value) : undefined; + if ("search" in props.entryFeeder) { + const search = props.entryFeeder.search; + const getByTs = props.entryFeeder.getByTs; + const options = (searchString: string) => + new Promise<{ value: string, label: string | JSX.Element }[]>(resolve => { + resolve(search(searchString).map(makeOption)); + }); + const onChange = (v: { label: string | JSX.Element, value: string } | null) => { + if (!v) { + props.onChange(undefined); + return; + } + const s = getByTs(parseInt(v.value)); + if (!s) return; + props.onChange(s); + } + return
+ +
; + } + const entries = props.entryFeeder; + const options = entries + .sort((a, b) => { + if ("entry" in a) { + return a.entry.p.localeCompare("p" in b ? b.p : b.entry.p, "af-PS") + } + return a.p.localeCompare("p" in b ? b.p : b.entry.p, "af-PS"); + }) + .map(makeOption); + const onChange = (v: { label: string | JSX.Element, value: string } | null) => { + if (!v) { + props.onChange(undefined); + return; + } + const s = entries.find(e => ( + ("entry" in e) + ? e.entry.ts.toString() === v.value + : e.ts.toString() === v.value + )); + if (!s) return; + props.onChange(s); + } + return
+ +
+} + +function sandwichSideEq(s1: T.PsString | undefined, s2: T.PsString | undefined): boolean { + if (s1 === undefined && s2 === undefined) { + return true + } + if (typeof s1 === "object" && typeof s2 === "object" && s1.p === s2.p) { + return true; + } + return false; +} + +function makeSandwichOption(s: T.Sandwich): { label: string, value: string } { + return { + label: `${s.before ? s.before.p : ""} ... ${s.after ? s.after.p : ""} (${s.e})`, + value: JSON.stringify(s), + }; +} + +export default EntrySelect; \ No newline at end of file diff --git a/src/components/Examples.tsx b/src/components/src/Examples.tsx similarity index 96% rename from src/components/Examples.tsx rename to src/components/src/Examples.tsx index 8faa5f0..75a814d 100644 --- a/src/components/Examples.tsx +++ b/src/components/src/Examples.tsx @@ -8,7 +8,7 @@ import Pashto from "./Pashto"; import Phonetics from "./Phonetics"; -import * as T from "../types"; +import * as T from "../../types"; type PsStringWSub = T.PsString & { sub?: any }; diff --git a/src/components/Hider.tsx b/src/components/src/Hider.tsx similarity index 97% rename from src/components/Hider.tsx rename to src/components/src/Hider.tsx index f93ee44..e04e0ec 100644 --- a/src/components/Hider.tsx +++ b/src/components/src/Hider.tsx @@ -8,7 +8,7 @@ import { createElement } from "react"; import classNames from "classnames"; -import * as T from "../types"; +import * as T from "../../types"; const caretRight = diff --git a/src/components/src/HumanReadableInflectionPattern.tsx b/src/components/src/HumanReadableInflectionPattern.tsx new file mode 100644 index 0000000..e19c1df --- /dev/null +++ b/src/components/src/HumanReadableInflectionPattern.tsx @@ -0,0 +1,18 @@ +import * as T from "../../types"; +import InlinePs from "./InlinePs"; + +export default function HumanReadableInflectionPattern(p: T.InflectionPattern, textOptions: T.TextOptions): JSX.Element | null { + return p === 1 + ? #1 Basic + : p === 2 + ? #2 Unstressed {{ p: "ی", f: "ey", e: "" }} + : p === 3 + ? #3 Stressed {{ p: "ی", f: "éy", e: "" }} + : p === 4 + ? #4 "Pashtoon" + : p === 5 + ? #5 Short Squish + : p === 6 + ? #6 Fem. inan. {{ p: "ي", f: "ee", e: "" }} + : null; +} \ No newline at end of file diff --git a/src/components/InflectionsTable.tsx b/src/components/src/InflectionsTable.tsx similarity index 97% rename from src/components/InflectionsTable.tsx rename to src/components/src/InflectionsTable.tsx index f36b651..0329a7d 100644 --- a/src/components/InflectionsTable.tsx +++ b/src/components/src/InflectionsTable.tsx @@ -10,8 +10,8 @@ import { useState } from "react"; import Pashto from "./Pashto"; import { Modal } from "react-bootstrap"; import TableCell from "./TableCell"; -import * as T from "../types"; -import { isPluralInflections } from "../lib/p-text-helpers"; +import * as T from "../../types"; +import { isPluralInflections } from "../../lib/src/p-text-helpers"; const explanation = (inf: T.Inflections | T.PluralInflections, textOptions: T.TextOptions) => { const isPluralInfs = isPluralInflections(inf); diff --git a/src/components/InlinePs.tsx b/src/components/src/InlinePs.tsx similarity index 92% rename from src/components/InlinePs.tsx rename to src/components/src/InlinePs.tsx index 3b647cd..edc5f47 100644 --- a/src/components/InlinePs.tsx +++ b/src/components/src/InlinePs.tsx @@ -8,7 +8,7 @@ import Pashto from "./Pashto"; import Phonetics from "./Phonetics"; -import * as T from "../types"; +import * as T from "../../types"; function InlinePs ({ children, diff --git a/src/components/Keyframes.tsx b/src/components/src/Keyframes.tsx similarity index 100% rename from src/components/Keyframes.tsx rename to src/components/src/Keyframes.tsx diff --git a/src/components/Pashto.tsx b/src/components/src/Pashto.tsx similarity index 85% rename from src/components/Pashto.tsx rename to src/components/src/Pashto.tsx index 014a5d7..f49d46d 100644 --- a/src/components/Pashto.tsx +++ b/src/components/src/Pashto.tsx @@ -8,12 +8,12 @@ import { convertSpelling, -} from "../lib/convert-spelling"; +} from "../../lib/src/convert-spelling"; import { phoneticsToDiacritics -} from "../lib/phonetics-to-diacritics"; -import { psJSXMap } from "../lib/jsx-map"; -import * as T from "../types"; +} from "../../lib/src/phonetics-to-diacritics"; +import { psJSXMap } from "./jsx-map"; +import * as T from "../../types"; const Pashto = ({ opts, children: text }: { opts: T.TextOptions, diff --git a/src/components/PersInfsPicker.tsx b/src/components/src/PersInfsPicker.tsx similarity index 52% rename from src/components/PersInfsPicker.tsx rename to src/components/src/PersInfsPicker.tsx index e4bf8c3..b54ab70 100644 --- a/src/components/PersInfsPicker.tsx +++ b/src/components/src/PersInfsPicker.tsx @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; const persInfs: { label: string; @@ -39,22 +39,20 @@ function PersInfsPicker(props: { const newValue = e.target.value as T.PersonInflectionsField; props.handleChange(newValue); } - return ( -
-
- When the {props.transitivity === "intransitive" ? "subject" : "object"} is -
-
- -
+ return
+
+ When the {props.transitivity === "intransitive" ? "subject" : "object"} is
- ); +
+ +
+
; } export default PersInfsPicker; \ No newline at end of file diff --git a/src/components/PersonSelection.tsx b/src/components/src/PersonSelection.tsx similarity index 96% rename from src/components/PersonSelection.tsx rename to src/components/src/PersonSelection.tsx index 2c3e175..bcb3def 100644 --- a/src/components/PersonSelection.tsx +++ b/src/components/src/PersonSelection.tsx @@ -6,9 +6,9 @@ * */ -import { persons } from "../lib/grammar-units"; -import InlinePs from "../components/InlinePs"; -import * as T from "../types"; +import { persons } from "../../lib/src/grammar-units"; +import InlinePs from "./InlinePs"; +import * as T from "../../types"; function PersonSelect(props: { setting: "subject" | "object", diff --git a/src/components/Phonetics.tsx b/src/components/src/Phonetics.tsx similarity index 86% rename from src/components/Phonetics.tsx rename to src/components/src/Phonetics.tsx index 9d6d19d..2a7552c 100644 --- a/src/components/Phonetics.tsx +++ b/src/components/src/Phonetics.tsx @@ -8,9 +8,9 @@ import { translatePhonetics, -} from "../lib/translate-phonetics"; -import { psJSXMap } from "../lib/jsx-map"; -import * as T from "../types"; +} from "../../lib/src/translate-phonetics"; +import { psJSXMap } from "./jsx-map"; +import * as T from "../../types"; const Phonetics = ({ opts, children: text }: { opts: T.TextOptions, diff --git a/src/components/RenderedBlocksDisplay.tsx b/src/components/src/RenderedBlocksDisplay.tsx similarity index 96% rename from src/components/RenderedBlocksDisplay.tsx rename to src/components/src/RenderedBlocksDisplay.tsx index 9366d54..44fb23c 100644 --- a/src/components/RenderedBlocksDisplay.tsx +++ b/src/components/src/RenderedBlocksDisplay.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; -import { filterForVisibleBlocksEP, filterForVisibleBlocksVP } from "../lib/phrase-building/compile"; -import * as T from "../types"; +import { filterForVisibleBlocksEP, filterForVisibleBlocksVP } from "../../lib/src/phrase-building/compile"; +import * as T from "../../types"; import Block from "./blocks/Block"; import KidDisplay from "./blocks/KidDisplay"; diff --git a/src/components/SingleItemDisplay.tsx b/src/components/src/SingleItemDisplay.tsx similarity index 91% rename from src/components/SingleItemDisplay.tsx rename to src/components/src/SingleItemDisplay.tsx index 76cf574..7cd14f5 100644 --- a/src/components/SingleItemDisplay.tsx +++ b/src/components/src/SingleItemDisplay.tsx @@ -8,7 +8,7 @@ import Pashto from "./Pashto"; import Phonetics from "./Phonetics"; -import * as T from "../types"; +import * as T from "../../types"; function SingleItemDisplay({ item, textOptions, english }: { item: T.PsString, diff --git a/src/components/TableCell.tsx b/src/components/src/TableCell.tsx similarity index 97% rename from src/components/TableCell.tsx rename to src/components/src/TableCell.tsx index 7c506c5..f38bfce 100644 --- a/src/components/TableCell.tsx +++ b/src/components/src/TableCell.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import * as T from "../types"; +import * as T from "../../types"; import Pashto from "./Pashto"; import Phonetics from "./Phonetics"; diff --git a/src/components/VerbFormDisplay.tsx b/src/components/src/VerbFormDisplay.tsx similarity index 97% rename from src/components/VerbFormDisplay.tsx rename to src/components/src/VerbFormDisplay.tsx index 5241b9b..db757dd 100644 --- a/src/components/VerbFormDisplay.tsx +++ b/src/components/src/VerbFormDisplay.tsx @@ -15,11 +15,11 @@ import VerbTable from "./VerbTable"; import { getEnglishPersonInfo, isSentenceForm, -} from "../lib/misc-helpers"; +} from "../../lib/src/misc-helpers"; import { isAllOne, -} from "../lib/p-text-helpers"; -import * as T from "../types"; +} from "../../lib/src/p-text-helpers"; +import * as T from "../../types"; function agreementInfo(info: T.NonComboVerbInfo, displayForm: T.DisplayForm): React.ReactNode { if (!displayForm.past) { diff --git a/src/components/VerbTable.tsx b/src/components/src/VerbTable.tsx similarity index 94% rename from src/components/VerbTable.tsx rename to src/components/src/VerbTable.tsx index c890d98..905ec5f 100644 --- a/src/components/VerbTable.tsx +++ b/src/components/src/VerbTable.tsx @@ -11,10 +11,10 @@ import { psStringEquals, isAllOne, addEnglish, -} from "../lib/p-text-helpers"; -import { isSentenceForm } from "../lib/misc-helpers"; -import * as T from "../types"; -import genderColors from "../lib/gender-colors"; +} from "../../lib/src/p-text-helpers"; +import { isSentenceForm } from "../../lib/src/misc-helpers"; +import * as T from "../../types"; +import genderColors from "./gender-colors"; const genderAbbrev = (gender: "masc" | "fem" | undefined): " m." | " f." | "" => ( gender === "masc" diff --git a/src/components/ap-picker/APPicker.tsx b/src/components/src/ap-picker/APPicker.tsx similarity index 98% rename from src/components/ap-picker/APPicker.tsx rename to src/components/src/ap-picker/APPicker.tsx index d09b858..9ccb9db 100644 --- a/src/components/ap-picker/APPicker.tsx +++ b/src/components/src/ap-picker/APPicker.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import * as T from "../../types"; +import * as T from "../../../types"; import SandwichPicker from "../np-picker/SandwichPicker"; import AdverbPicker from "./AdverbPicker"; type APType = "adverb" | "sandwich"; diff --git a/src/components/ap-picker/AdverbPicker.tsx b/src/components/src/ap-picker/AdverbPicker.tsx similarity index 80% rename from src/components/ap-picker/AdverbPicker.tsx rename to src/components/src/ap-picker/AdverbPicker.tsx index 2069ecb..f040db6 100644 --- a/src/components/ap-picker/AdverbPicker.tsx +++ b/src/components/src/ap-picker/AdverbPicker.tsx @@ -1,4 +1,5 @@ -import * as T from "../../types"; +import { makeAdverbSelection } from "../../../lib/src/phrase-building/make-selections"; +import * as T from "../../../types"; import EntrySelect from "../EntrySelect"; function AdverbPicker(props: { @@ -27,11 +28,4 @@ function AdverbPicker(props: {
; } -export default AdverbPicker; - -function makeAdverbSelection(entry: T.AdverbEntry): T.AdverbSelection { - return { - type: "adverb", - entry: entry, - }; -} \ No newline at end of file +export default AdverbPicker; \ No newline at end of file diff --git a/src/components/blocks/Block.tsx b/src/components/src/blocks/Block.tsx similarity index 98% rename from src/components/blocks/Block.tsx rename to src/components/src/blocks/Block.tsx index 2a7e9e7..80fd387 100644 --- a/src/components/blocks/Block.tsx +++ b/src/components/src/blocks/Block.tsx @@ -1,13 +1,13 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import classNames from "classnames"; import { getEnglishFromRendered, -} from "../../lib/phrase-building/np-tools"; -import { getEnglishPersonInfo, getEnglishParticipleInflection } from "../../lib/misc-helpers"; +} from "../../../lib/src/phrase-building/np-tools"; +import { getEnglishPersonInfo, getEnglishParticipleInflection } from "../../../lib/src/misc-helpers"; import { useState } from "react"; -import { getLength } from "../../lib/p-text-helpers"; +import { getLength } from "../../../lib/src/p-text-helpers"; import { roleIcon } from "../vp-explorer/VPExplorerExplanationModal"; -import { negativeParticle } from "../../lib/grammar-units"; +import { negativeParticle } from "../../../lib/src/grammar-units"; function Block({ opts, block, king, script }: { opts: T.TextOptions, diff --git a/src/components/blocks/KidDisplay.tsx b/src/components/src/blocks/KidDisplay.tsx similarity index 78% rename from src/components/blocks/KidDisplay.tsx rename to src/components/src/blocks/KidDisplay.tsx index 593e285..7a3fddb 100644 --- a/src/components/blocks/KidDisplay.tsx +++ b/src/components/src/blocks/KidDisplay.tsx @@ -1,5 +1,5 @@ -import { baParticle } from "../../lib/grammar-units"; -import * as T from "../../types"; +import { baParticle } from "../../../lib/src/grammar-units"; +import * as T from "../../../types"; import Pashto from "../Pashto"; import Phonetics from "../Phonetics"; diff --git a/src/components/ep-explorer/EPDisplay.tsx b/src/components/src/ep-explorer/EPDisplay.tsx similarity index 91% rename from src/components/ep-explorer/EPDisplay.tsx rename to src/components/src/ep-explorer/EPDisplay.tsx index 4cd4cc8..1c5268f 100644 --- a/src/components/ep-explorer/EPDisplay.tsx +++ b/src/components/src/ep-explorer/EPDisplay.tsx @@ -1,13 +1,13 @@ -import * as T from "../../types"; -import { completeEPSelection, renderEP } from "../../lib/phrase-building/render-ep"; -import { compileEP } from "../../lib/phrase-building/compile"; +import * as T from "../../../types"; +import { completeEPSelection, renderEP } from "../../../lib/src/phrase-building/render-ep"; +import { compileEP } from "../../../lib/src/phrase-building/compile"; import ButtonSelect from "../ButtonSelect"; -import { getPredicateSelectionFromBlocks, getSubjectSelection, getSubjectSelectionFromBlocks } from "../../lib/phrase-building/blocks-utils"; +import { getPredicateSelectionFromBlocks, getSubjectSelection, getSubjectSelectionFromBlocks } from "../../../lib/src/phrase-building/blocks-utils"; import { useState } from "react"; import CompiledPTextDisplay from "../CompiledPTextDisplay"; import EPBlocksDisplay from "../RenderedBlocksDisplay"; import ModeSelect, { Mode, ScriptSelect } from "../DisplayModeSelect"; -import useStickyState from "../../lib/useStickyState"; +import useStickyState from "../useStickyState"; function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne, length, mode: preferredMode, script: preferredScript }: { eps: T.EPSelectionState, diff --git a/src/components/ep-explorer/EPExplorer.tsx b/src/components/src/ep-explorer/EPExplorer.tsx similarity index 91% rename from src/components/ep-explorer/EPExplorer.tsx rename to src/components/src/ep-explorer/EPExplorer.tsx index 44e43ff..7c405a1 100644 --- a/src/components/ep-explorer/EPExplorer.tsx +++ b/src/components/src/ep-explorer/EPExplorer.tsx @@ -1,18 +1,18 @@ -import * as T from "../../types"; -import useStickyState, { useStickyReducer } from "../../lib/useStickyState"; +import * as T from "../../../types"; +import useStickyState, { useStickyReducer } from "../useStickyState"; import EPDisplay from "./EPDisplay"; import ButtonSelect from "../ButtonSelect"; import EqChartsDisplay from "./EqChartsDisplay"; -import epsReducer from "./eps-reducer"; +import epsReducer from "../../../lib/src/phrase-building/eps-reducer"; import { useEffect, -// useRef, + useRef, useState, } from "react"; -import { completeEPSelection } from "../../lib/phrase-building/render-ep"; -import { makeEPSBlocks } from "../../lib/phrase-building/blocks-utils"; +import { completeEPSelection } from "../../../lib/src/phrase-building/render-ep"; +import { makeEPSBlocks } from "../../../lib/src/phrase-building/blocks-utils"; import EquativePicker from "./EquativePicker"; -// import autoAnimate from "@formkit/auto-animate"; +import autoAnimate from "@formkit/auto-animate"; // @ts-ignore import LZString from "lz-string"; import EPPicker from "./EPPicker"; @@ -50,10 +50,10 @@ function EPExplorer(props: { // // setAlertMsg, // ] = useState(undefined); const [showClipped, setShowClipped] = useState(""); - // const parent = useRef(null); - // useEffect(() => { - // parent.current && autoAnimate(parent.current); - // }, [parent]); + const parent = useRef(null); + useEffect(() => { + parent.current && autoAnimate(parent.current); + }, [parent]); useEffect(() => { const EPSFromUrl = getEPSFromUrl(); if (EPSFromUrl) { diff --git a/src/components/ep-explorer/EPPicker.tsx b/src/components/src/ep-explorer/EPPicker.tsx similarity index 91% rename from src/components/ep-explorer/EPPicker.tsx rename to src/components/src/ep-explorer/EPPicker.tsx index dd93467..5278ec5 100644 --- a/src/components/ep-explorer/EPPicker.tsx +++ b/src/components/src/ep-explorer/EPPicker.tsx @@ -1,16 +1,16 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import NPPicker from "../np-picker/NPPicker"; import EquativePicker from "./EquativePicker"; import ButtonSelect from "../ButtonSelect"; import ComplementPicker from "../ComplementPicker"; -import epsReducer, { EpsReducerAction } from "./eps-reducer"; +import epsReducer, { EpsReducerAction } from "../../../lib/src/phrase-building/eps-reducer"; import { - // useEffect, + useEffect, useRef, } from "react"; -import { completeEPSelection } from "../../lib/phrase-building/render-ep"; -import APPicker from "../ap-picker/APPicker"; -// import autoAnimate from "@formkit/auto-animate"; +import { completeEPSelection } from "../../../lib/src/phrase-building/render-ep"; +import APPicker from "../../src/ap-picker/APPicker"; +import autoAnimate from "@formkit/auto-animate"; function EPPicker({ opts, eps, onChange, entryFeeder }: { opts: T.TextOptions, @@ -19,9 +19,9 @@ function EPPicker({ opts, eps, onChange, entryFeeder }: { entryFeeder: T.EntryFeeder, }) { const parent = useRef(null); - // useEffect(() => { - // parent.current && autoAnimate(parent.current); - // }, [parent]); + useEffect(() => { + parent.current && autoAnimate(parent.current); + }, [parent]); function adjustEps(action: EpsReducerAction) { onChange(epsReducer(eps, action)); } diff --git a/src/components/ep-explorer/EqChartsDisplay.tsx b/src/components/src/ep-explorer/EqChartsDisplay.tsx similarity index 69% rename from src/components/ep-explorer/EqChartsDisplay.tsx rename to src/components/src/ep-explorer/EqChartsDisplay.tsx index 4ade64d..23cd13d 100644 --- a/src/components/ep-explorer/EqChartsDisplay.tsx +++ b/src/components/src/ep-explorer/EqChartsDisplay.tsx @@ -1,8 +1,8 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import VerbFormDisplay from "../VerbFormDisplay"; -import { baParticle } from "../../lib/grammar-units"; -import { getEquativeForm } from "../../lib/phrase-building/render-ep"; -import { addToForm } from "../../lib/p-text-helpers"; +import { baParticle } from "../../../lib/src/grammar-units"; +import { getEquativeForm } from "../../../lib/src/phrase-building/render-ep"; +import { addToForm } from "../../../lib/src/p-text-helpers"; function EqChartsDisplay({ tense, opts }: { tense: T.EquativeTense, diff --git a/src/components/src/ep-explorer/EquativePicker.tsx b/src/components/src/ep-explorer/EquativePicker.tsx new file mode 100644 index 0000000..27f81ad --- /dev/null +++ b/src/components/src/ep-explorer/EquativePicker.tsx @@ -0,0 +1,110 @@ +import * as T from "../../../types" +import Select from "react-select"; +import ButtonSelect from "../ButtonSelect"; + +const zIndexProps = { + menuPortalTarget: document.body, + styles: { menuPortal: (base: any) => ({ ...base, zIndex: 9999 }) }, +}; + +const options: { label: string | JSX.Element, value: T.EquativeTense }[] = [{ + label: "Present", + value: "present", +}, { + label: "Habitual", + value: "habitual", +}, { + label: "Subjunctive", + value: "subjunctive", +}, { + label: "Future", + value: "future", +}, { + label: "Past", + value: "past", +}, { + label: `"Would Be"`, + value: "wouldBe", +}, { + label: "Past Subjunctive", + value: "pastSubjunctive", +}, { + label: `"Would Have Been"`, + value: "wouldHaveBeen", +}]; + +function EquativePicker({ equative, onChange, hideNegative }: { + equative: { tense: T.EquativeTense, negative: boolean }, + onChange: (e: { tense: T.EquativeTense, negative: boolean }) => void, + hideNegative?: boolean, +}) { + function onTenseSelect(o: { value: T.EquativeTense } | null) { + const value = o?.value ? o.value : undefined; + if (!value) { + return; + } + onChange({ + ...equative, + tense: value, + }); + } + function moveTense(dir: "forward" | "back") { + return () => { + const currIndex = options.findIndex(tn => tn.value === equative.tense) + if (currIndex === -1) { + console.error("error moving tense", dir); + return; + } + const newIndex = dir === "forward" + ? ((currIndex + 1) % options.length) + : (currIndex === 0 ? (options.length - 1) : (currIndex - 1)) + const newTense = options[newIndex]; + onChange({ + ...equative, + tense: newTense.value, + }); + }; + } + function onPosNegSelect(value: "true" | "false") { + onChange({ + ...equative, + negative: value === "true", + }); + } + return
+
+
Tense:
+ = (input: Input) => Promise; +type Async = (x: any) => Promise; +type AsyncIterable = (x: T) => Promise; +type AsyncIterableIndexed = (x: T, i: number) => Promise; +type AsyncPredicate = (x: T) => Promise; +type AsyncPredicateIndexed = (x: T, i: number) => Promise; +type AsyncWithProp = (x: any, prop?: string) => Promise; + +type ApplyDiffUpdate = {readonly op:'update', readonly path: string, readonly value: any}; +type ApplyDiffAdd = {readonly op:'add', readonly path: string, readonly value: any}; +type ApplyDiffRemove = {readonly op:'remove', readonly path: string}; +type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove; + +type Resolved = {readonly status: 'fulfilled', readonly value: T} | {readonly status: 'rejected', readonly reason: string|Error} + + +/** + * It adds `a` and `b`. + */ +export function add(a: number, b: number): number; +export function add(a: number): (b: number) => number; + +/** + * It replaces `index` in array `list` with the result of `replaceFn(list[i])`. + */ +export function adjust(index: number, replaceFn: (x: T) => T, list: readonly T[]): readonly T[]; +export function adjust(index: number, replaceFn: (x: T) => T): (list: readonly T[]) => readonly T[]; + +/** + * It returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function. + */ +export function all(predicate: (x: T) => boolean, list: readonly T[]): boolean; +export function all(predicate: (x: T) => boolean): (list: readonly T[]) => boolean; + +/** + * It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument. + */ +export function allPass(predicates: readonly ((x: T) => boolean)[]): (input: T) => boolean; +export function allPass(predicates: readonly ((...inputs: readonly T[]) => boolean)[]): (...inputs: readonly T[]) => boolean; + +/** + * It returns function that always returns `x`. + */ +export function always(x: T): (...args: readonly unknown[]) => T; + +/** + * Logical AND + */ +export function and(x: T, y: U): T | U; +export function and(x: T): (y: U) => T | U; + +/** + * Logical OR + */ +export function or(a: T, b: U): T | U; +export function or(a: T): (b: U) => T | U; + +/** + * It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function. + */ +export function any(predicate: (x: T) => boolean, list: readonly T[]): boolean; +export function any(predicate: (x: T) => boolean): (list: readonly T[]) => boolean; + +/** + * It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`. + */ +export function anyPass(predicates: readonly ((x: T) => boolean)[]): (input: T) => boolean; +export function anyPass(predicates: readonly ((...inputs: readonly T[]) => boolean)[]): (...inputs: readonly T[]) => boolean; + +/** + * It adds element `x` at the end of `list`. + */ +export function append(x: T, list: readonly T[]): readonly T[]; +export function append(x: T): (list: readonly T[]) => readonly T[]; + +export function applySpec>( + spec: Spec +): ( + ...args: Parameters> +) => { readonly [Key in keyof Spec]: ReturnType }; +export function applySpec(spec: any): (...args: readonly unknown[]) => T; + +/** + * It makes a shallow clone of `obj` with setting or overriding the property `prop` with `newValue`. + */ +export function assoc(prop: K, val: T, obj: U): Record & Omit; +export function assoc(prop: K, val: T): (obj: U) => Record & Omit; +export function assoc(prop: K): AssocPartialOne; + +/** + * It makes a shallow clone of `obj` with setting or overriding with `newValue` the property found with `path`. + */ +export function assocPath(path: Path, newValue: any, obj: object): Output; +export function assocPath(path: Path, newValue: any): (obj: object) => Output; +export function assocPath(path: Path): (newValue: any) => (obj: object) => Output; + +/** + * It returns a function with `input` argument. + * + * This function will return `true`, if both `firstCondition` and `secondCondition` return `true` when `input` is passed as their argument. + */ +export function both(pred1: Pred, pred2: Pred): Pred; +export function both(pred1: Predicate, pred2: Predicate): Predicate; +export function both(pred1: Predicate): (pred2: Predicate) => Predicate; +export function both(pred1: Pred): (pred2: Pred) => Pred; + +/** + * The method is also known as `flatMap`. + */ +export function chain(fn: (n: T) => readonly U[], list: readonly T[]): readonly U[]; +export function chain(fn: (n: T) => readonly U[]): (list: readonly T[]) => readonly U[]; + +/** + * Restrict a number `input` to be within `min` and `max` limits. + * + * If `input` is bigger than `max`, then the result is `max`. + * + * If `input` is smaller than `min`, then the result is `min`. + */ +export function clamp(min: number, max: number, input: number): number; +export function clamp(min: number, max: number): (input: number) => number; + +/** + * It creates a deep copy of the `input`, which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates. + */ +export function clone(input: T): T; +export function clone(input: readonly T[]): readonly T[]; + +/** + * It returns `inverted` version of `origin` function that accept `input` as argument. + * + * The return value of `inverted` is the negative boolean value of `origin(input)`. + */ +export function complement(predicate: (...args: T) => unknown): (...args: T) => boolean; + +/** + * It performs right-to-left function composition. + */ +export function compose( + ...func: readonly [ + fnLast: (a: any) => TResult, + ...func: ReadonlyArray<(a: any) => any>, + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 + ] +): (...args: TArgs) => TResult; // fallback overload if number of composed functions greater than 7 +export function compose( + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R7; +export function compose( + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R7; +export function compose( + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R6; +export function compose( + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R5; +export function compose( + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R4; +export function compose( + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R3; +export function compose( + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R2; +export function compose( + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R1; + +/** + * It returns a new string or array, which is the result of merging `x` and `y`. + */ +export function concat(x: readonly T[], y: readonly T[]): readonly T[]; +export function concat(x: readonly T[]): (y: readonly T[]) => readonly T[]; +export function concat(x: string, y: string): string; +export function concat(x: string): (y: string) => string; + +/** + * It takes list with `conditions` and returns a new function `fn` that expects `input` as argument. + * + * This function will start evaluating the `conditions` in order to find the first winner(order of conditions matter). + * + * The winner is this condition, which left side returns `true` when `input` is its argument. Then the evaluation of the right side of the winner will be the final result. + * + * If no winner is found, then `fn` returns `undefined`. + */ +export function cond(conditions: ReadonlyArray>): (...args: T) => R; + +/** + * Accepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value. + */ +export function converge(after: ((...a: readonly any[]) => any), fns: readonly ((...x: readonly any[]) => any)[]): (...y: readonly any[]) => any; + +/** + * It expects a function as input and returns its curried version. + */ +export function curry(fn: AnyFunction): (...a: readonly any[]) => any; + +/** + * It returns a curried equivalent of the provided function, with the specified arity. + */ +export function curryN(length: number, fn: AnyFunction): (...a: readonly any[]) => any; + +/** + * It decrements a number. + */ +export function dec(x: number): number; + +/** + * It returns `defaultValue`, if all of `inputArguments` are `undefined`, `null` or `NaN`. + * + * Else, it returns the first truthy `inputArguments` instance(from left to right). + */ +export function defaultTo(defaultValue: T, input: T | null | undefined): T; +export function defaultTo(defaultValue: T): (input: T | null | undefined) => T; + +/** + * It returns the uniq set of all elements in the first list `a` not contained in the second list `b`. + * + * `R.equals` is used to determine equality. + */ +export function difference(a: readonly T[], b: readonly T[]): readonly T[]; +export function difference(a: readonly T[]): (b: readonly T[]) => readonly T[]; + +/** + * It returns a new object that does not contain property `prop`. + */ +export function dissoc(prop: K, obj: T): Omit; +export function dissoc(prop: K): (obj: T) => Omit; + +export function divide(x: number, y: number): number; +export function divide(x: number): (y: number) => number; + +/** + * It returns `howMany` items dropped from beginning of list or string `input`. + */ +export function drop(howMany: number, input: readonly T[]): readonly T[]; +export function drop(howMany: number, input: string): string; +export function drop(howMany: number): { + (input: readonly T[]): readonly T[]; + (input: string): string; +}; + +/** + * It returns `howMany` items dropped from the end of list or string `input`. + */ +export function dropLast(howMany: number, input: readonly T[]): readonly T[]; +export function dropLast(howMany: number, input: string): string; +export function dropLast(howMany: number): { + (input: readonly T[]): readonly T[]; + (input: string): string; +}; + +/** + * It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs. + * + * This `predicate` function will return `true`, if any of the two input predicates return `true`. + */ +export function either(firstPredicate: Pred, secondPredicate: Pred): Pred; +export function either(firstPredicate: Predicate, secondPredicate: Predicate): Predicate; +export function either(firstPredicate: Predicate): (secondPredicate: Predicate) => Predicate; +export function either(firstPredicate: Pred): (secondPredicate: Pred) => Pred; + +/** + * When iterable is a string, then it behaves as `String.prototype.endsWith`. + * When iterable is a list, then it uses R.equals to determine if the target list ends in the same way as the given target. + */ +export function endsWith(target: string, iterable: string): boolean; +export function endsWith(target: string): (iterable: string) => boolean; +export function endsWith(target: readonly T[], list: readonly T[]): boolean; +export function endsWith(target: readonly T[]): (list: readonly T[]) => boolean; + +/** + * It deeply compares `x` and `y` and returns `true` if they are equal. + */ +export function equals(x: T, y: T): boolean; +export function equals(x: T): (y: T) => boolean; + +export function F(): boolean; + +/** + * It filters list or object `input` using a `predicate` function. + */ +export function filter(predicate: Predicate): (input: readonly T[]) => readonly T[]; +export function filter(predicate: Predicate, input: readonly T[]): readonly T[]; +export function filter(predicate: ObjectPredicate): (x: Dictionary) => Dictionary; +export function filter(predicate: ObjectPredicate, x: Dictionary): Dictionary; + +/** + * It returns the first element of `list` that satisfy the `predicate`. + * + * If there is no such element, it returns `undefined`. + */ +export function find(predicate: (x: T) => boolean, list: readonly T[]): T | undefined; +export function find(predicate: (x: T) => boolean): (list: readonly T[]) => T | undefined; + +/** + * It returns the index of the first element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `-1` is returned. + */ +export function findIndex(predicate: (x: T) => boolean, list: readonly T[]): number; +export function findIndex(predicate: (x: T) => boolean): (list: readonly T[]) => number; + +/** + * It returns the last element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `undefined` is returned. + */ +export function findLast(fn: (x: T) => boolean, list: readonly T[]): T | undefined; +export function findLast(fn: (x: T) => boolean): (list: readonly T[]) => T | undefined; + +/** + * It returns the index of the last element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `-1` is returned. + */ +export function findLastIndex(predicate: (x: T) => boolean, list: readonly T[]): number; +export function findLastIndex(predicate: (x: T) => boolean): (list: readonly T[]) => number; + +/** + * It deeply flattens an array. + */ +export function flatten(list: readonly any[]): readonly T[]; + +/** + * It returns function which calls `fn` with exchanged first and second argument. + */ +export function flip(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult; + +/** + * It applies `iterable` function over all members of `list` and returns `list`. + */ +export function forEach(fn: Iterator, list: readonly T[]): readonly T[]; +export function forEach(fn: Iterator): (list: readonly T[]) => readonly T[]; +export function forEach(fn: ObjectIterator, list: Dictionary): Dictionary; +export function forEach(fn: ObjectIterator): (list: Dictionary) => Dictionary; + +/** + * It transforms a `listOfPairs` to an object. + */ +export function fromPairs(listOfPairs: readonly ((readonly [number, V]))[]): { readonly [index: number]: V }; +export function fromPairs(listOfPairs: readonly ((readonly [string, V]))[]): { readonly [index: string]: V }; + +/** + * It splits `list` according to a provided `groupFn` function and returns an object. + */ +export function groupBy(groupFn: (x: T) => string, list: readonly T[]): { readonly [index: string]: readonly T[] }; +export function groupBy(groupFn: (x: T) => string): (list: readonly T[]) => { readonly [index: string]: readonly T[] }; +export function groupBy(groupFn: (x: T) => string, list: readonly T[]): U; +export function groupBy(groupFn: (x: T) => string): (list: readonly T[]) => U; + +/** + * It returns separated version of list or string `input`, where separation is done with equality `compareFn` function. + */ +export function groupWith(compareFn: (x: T, y: T) => boolean): (input: readonly T[]) => readonly ((readonly T[]))[]; +export function groupWith(compareFn: (x: T, y: T) => boolean, input: readonly T[]): readonly ((readonly T[]))[]; +export function groupWith(compareFn: (x: T, y: T) => boolean, input: string): readonly string[]; + +/** + * It returns `true` if `obj` has property `prop`. + */ +export function has(prop: string, obj: T): boolean; +export function has(prop: string): (obj: T) => boolean; + +/** + * It will return true, if `input` object has truthy `path`(calculated with `R.path`). + */ +export function hasPath( + path: string | readonly string[], + input: object +): boolean; +export function hasPath( + path: string | readonly string[] +): (input: object) => boolean; + +/** + * It returns the first element of list or string `input`. + */ +export function head(input: string): string; +export function head(emptyList: readonly []): undefined; +export function head(input: readonly T[]): T | undefined; + +/** + * It returns `true` if its arguments `a` and `b` are identical. + * + * Otherwise, it returns `false`. + */ +export function identical(x: T, y: T): boolean; +export function identical(x: T): (y: T) => boolean; + +/** + * It just passes back the supplied `input` argument. + */ +export function identity(input: T): T; + +/** + * It expects `condition`, `onTrue` and `onFalse` functions as inputs and it returns a new function with example name of `fn`. + * + * When `fn`` is called with `input` argument, it will return either `onTrue(input)` or `onFalse(input)` depending on `condition(input)` evaluation. + */ +export function ifElse( + pred: (a: T) => a is TFiltered, + onTrue: (a: TFiltered) => TOnTrueResult, + onFalse: (a: Exclude) => TOnFalseResult, +): (a: T) => TOnTrueResult | TOnFalseResult; +export function ifElse(fn: (...args: TArgs) => boolean, onTrue: (...args: TArgs) => TOnTrueResult, onFalse: (...args: TArgs) => TOnFalseResult): (...args: TArgs) => TOnTrueResult | TOnFalseResult; + +/** + * It increments a number. + */ +export function inc(x: number): number; + +/** + * If `input` is string, then this method work as native `String.includes`. + * + * If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list. + */ +export function includes(valueToFind: string, input: readonly string[] | string): boolean; +export function includes(valueToFind: string): (input: readonly string[] | string) => boolean; +export function includes(valueToFind: T, input: readonly T[]): boolean; +export function includes(valueToFind: T): (input: readonly T[]) => boolean; + +/** + * It generates object with properties provided by `condition` and values provided by `list` array. + * + * If `condition` is a function, then all list members are passed through it. + * + * If `condition` is a string, then all list members are passed through `R.path(condition)`. + */ +export function indexBy(condition: (key: T) => K, list: readonly T[]): { readonly [key in K]: T }; +export function indexBy(condition: (key: T) => K, list: readonly T[]): { readonly [key in NonNullable]?: T }; +export function indexBy(condition: (key: T) => K): (list: readonly T[]) => { readonly [key in K]: T }; +export function indexBy(condition: (key: T) => K | undefined): (list: readonly T[]) => { readonly [key in NonNullable]?: T }; +export function indexBy(condition: string, list: readonly T[]): { readonly [key: string]: T }; +export function indexBy(condition: string): (list: readonly T[]) => { readonly [key: string]: T }; + +/** + * It returns the index of the first element of `list` equals to `valueToFind`. + * + * If there is no such element, it returns `-1`. + */ +export function indexOf(valueToFind: T, list: readonly T[]): number; +export function indexOf(valueToFind: T): (list: readonly T[]) => number; + +/** + * It returns all but the last element of list or string `input`. + */ +export function init(input: T): T extends readonly [...infer U, any] ? U : readonly [...T]; +export function init(input: string): string; + +/** + * It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`. + */ +export function intersection(listA: readonly T[], listB: readonly T[]): readonly T[]; +export function intersection(listA: readonly T[]): (listB: readonly T[]) => readonly T[]; + +/** + * It adds a `separator` between members of `list`. + */ +export function intersperse(separator: T, list: readonly T[]): readonly T[]; +export function intersperse(separator: T): (list: readonly T[]) => readonly T[]; + +/** + * It returns `true` if `x` is instance of `targetPrototype`. + */ +export function is any>(targetPrototype: C, val: any): val is ReturnType; +export function is any>(targetPrototype: C, val: any): val is InstanceType; +export function is any>(targetPrototype: C): (val: any) => val is ReturnType; +export function is any>(targetPrototype: C): (val: any) => val is InstanceType; + +/** + * It returns `true` if `x` is `empty`. + */ +export function isEmpty(x: T): boolean; + +/** + * It returns `true` if `x` is either `null` or `undefined`. + */ +export function isNil(x: any): x is null | undefined; + +/** + * It returns a string of all `list` instances joined with a `glue`. + */ +export function join(glue: string, list: readonly T[]): string; +export function join(glue: string): (list: readonly T[]) => string; + +/** + * It applies `Object.keys` over `x` and returns its keys. + */ +export function keys(x: T): readonly (keyof T)[]; +export function keys(x: T): readonly string[]; + +/** + * It returns the last element of `input`, as the `input` can be either a string or an array. + */ +export function last(str: string): string; +export function last(emptyList: readonly []): undefined; +export function last(list: readonly T[]): T | undefined; + +/** + * It returns the last index of `target` in `list` array. + * + * `R.equals` is used to determine equality between `target` and members of `list`. + * + * If there is no such index, then `-1` is returned. + */ +export function lastIndexOf(target: T, list: readonly T[]): number; +export function lastIndexOf(target: T): (list: readonly T[]) => number; + +/** + * It returns the `length` property of list or string `input`. + */ +export function length(input: readonly T[]): number; + +/** + * It returns a `lens` for the given `getter` and `setter` functions. + * + * The `getter` **gets** the value of the focus; the `setter` **sets** the value of the focus. + * + * The setter should not mutate the data structure. + */ +export function lens(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens; + +/** + * It returns a lens that focuses on specified `index`. + */ +export function lensIndex(index: number): Lens; + +/** + * It returns a lens that focuses on specified `path`. + */ +export function lensPath(path: RamdaPath): Lens; +export function lensPath(path: string): Lens; + +/** + * It returns a lens that focuses on specified property `prop`. + */ +export function lensProp(prop: string): { + (obj: T): U; + set(val: T, obj: U): V; +}; + +/** + * It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus. + */ +export function over(lens: Lens, fn: Arity1Fn, value: T): T; +export function over(lens: Lens, fn: Arity1Fn, value: readonly T[]): readonly T[]; +export function over(lens: Lens, fn: Arity1Fn): (value: T) => T; +export function over(lens: Lens, fn: Arity1Fn): (value: readonly T[]) => readonly T[]; +export function over(lens: Lens): (fn: Arity1Fn, value: T) => T; +export function over(lens: Lens): (fn: Arity1Fn, value: readonly T[]) => readonly T[]; + +/** + * It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value. + */ +export function set(lens: Lens, replacer: U, obj: T): T; +export function set(lens: Lens, replacer: U): (obj: T) => T; +export function set(lens: Lens): (replacer: U, obj: T) => T; + +/** + * It returns the value of `lens` focus over `target` object. + */ +export function view(lens: Lens): (target: T) => U; +export function view(lens: Lens, target: T): U; + +/** + * It returns the result of looping through `iterable` with `fn`. + * + * It works with both array and object. + */ +export function map(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function map(fn: Iterator, iterable: readonly T[]): readonly U[]; +export function map(fn: Iterator): (iterable: readonly T[]) => readonly U[]; +export function map(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; +export function map(fn: Iterator): (iterable: readonly T[]) => readonly T[]; +export function map(fn: Iterator, iterable: readonly T[]): readonly T[]; + +/** + * It works the same way as `R.map` does for objects. It is added as Ramda also has this method. + */ +export function mapObjIndexed(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function mapObjIndexed(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function mapObjIndexed(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; +export function mapObjIndexed(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; + +/** + * Curried version of `String.prototype.match` which returns empty array, when there is no match. + */ +export function match(regExpression: RegExp, str: string): readonly string[]; +export function match(regExpression: RegExp): (str: string) => readonly string[]; + +/** + * `R.mathMod` behaves like the modulo operator should mathematically, unlike the `%` operator (and by extension, `R.modulo`). So while `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. + */ +export function mathMod(x: number, y: number): number; +export function mathMod(x: number): (y: number) => number; + +/** + * It returns the greater value between `x` and `y`. + */ +export function max(x: T, y: T): T; +export function max(x: T): (y: T) => T; + +/** + * It returns the greater value between `x` and `y` according to `compareFn` function. + */ +export function maxBy(compareFn: (input: T) => Ord, x: T, y: T): T; +export function maxBy(compareFn: (input: T) => Ord, x: T): (y: T) => T; +export function maxBy(compareFn: (input: T) => Ord): (x: T) => (y: T) => T; + +/** + * It returns the mean value of `list` input. + */ +export function mean(list: readonly number[]): number; + +/** + * It returns the median value of `list` input. + */ +export function median(list: readonly number[]): number; + +/** + * Same as `R.mergeRight`. + */ +export function merge(target: A, newProps: B): A & B +export function merge(target: any): (newProps: any) => Output; + +/** + * It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same. + */ +export function mergeRight(target: A, newProps: B): A & B +export function mergeRight(target: any): (newProps: any) => Output; + +/** + * It merges all objects of `list` array sequentially and returns the result. + */ +export function mergeAll(list: readonly object[]): T; +export function mergeAll(list: readonly object[]): object; + +/** + * Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects: + * + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the second object will be used. + */ +export function mergeDeepRight(target: object, newProps: object): Output; +export function mergeDeepRight(target: object): (newProps: object) => Output; + +/** + * Same as `R.merge`, but in opposite direction. + */ +export function mergeLeft(newProps: object, target: object): Output; +export function mergeLeft(newProps: object): (target: object) => Output; + +/** + * It returns the lesser value between `x` and `y`. + */ +export function min(x: T, y: T): T; +export function min(x: T): (y: T) => T; + +/** + * It returns the lesser value between `x` and `y` according to `compareFn` function. + */ +export function minBy(compareFn: (input: T) => Ord, x: T, y: T): T; +export function minBy(compareFn: (input: T) => Ord, x: T): (y: T) => T; +export function minBy(compareFn: (input: T) => Ord): (x: T) => (y: T) => T; + +/** + * Curried version of `x%y`. + */ +export function modulo(x: number, y: number): number; +export function modulo(x: number): (y: number) => number; + +/** + * It returns a copy of `list` with exchanged `fromIndex` and `toIndex` elements. + */ +export function move(fromIndex: number, toIndex: number, list: readonly T[]): readonly T[]; +export function move(fromIndex: number, toIndex: number): (list: readonly T[]) => readonly T[]; +export function move(fromIndex: number): { + (toIndex: number, list: readonly T[]): readonly T[]; + (toIndex: number): (list: readonly T[]) => readonly T[]; +}; + +/** + * Curried version of `x*y`. + */ +export function multiply(x: number, y: number): number; +export function multiply(x: number): (y: number) => number; + +export function negate(x: number): number; + +/** + * It returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function. + */ +export function none(predicate: (x: T) => boolean, list: readonly T[]): boolean; +export function none(predicate: (x: T) => boolean): (list: readonly T[]) => boolean; + +/** + * It returns a boolean negated version of `input`. + */ +export function not(input: any): boolean; + +/** + * Curried version of `input[index]`. + */ +export function nth(index: number, input: string): string; +export function nth(index: number, input: readonly T[]): T | undefined; +export function nth(n: number): { + (input: readonly T[]): T | undefined; + (input: string): string; +}; + +/** + * It creates an object with a single key-value pair. + */ +export function objOf(key: K, value: T): Record; +export function objOf(key: K): (value: T) => Record; + +/** + * It returns a function, which invokes only once `fn` function. + */ +export function once(func: T): T; + +/** + * It returns a partial copy of an `obj` without `propsToOmit` properties. + */ +export function omit(propsToOmit: readonly K[], obj: T): Omit; +export function omit(propsToOmit: readonly K[]): (obj: T) => Omit; +export function omit(propsToOmit: string, obj: T): U; +export function omit(propsToOmit: string): (obj: T) => U; +export function omit(propsToOmit: string, obj: object): T; +export function omit(propsToOmit: string): (obj: object) => T; + +export function of(x: T): readonly T[]; + +/** + * It is very similar to `R.curry`, but you can pass initial arguments when you create the curried function. + * + * `R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed. + * The name comes from the fact that you partially inject the inputs. + */ +export function partial(fn: (x0: V0, x1: V1) => T, args: readonly [V0]): (x1: V1) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2) => T, args: readonly [V0, V1]): (x2: V2) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2) => T, args: readonly [V0]): (x1: V1, x2: V2) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: readonly [V0, V1, V2]): (x2: V3) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: readonly [V0, V1]): (x2: V2, x3: V3) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: readonly [V0]): (x1: V1, x2: V2, x3: V3) => T; +export function partial(fn: (...a: readonly any[]) => T, args: readonly any[]): (...x: readonly any[]) => T; + +/** + * It will return array of two objects/arrays according to `predicate` function. The first member holds all instances of `input` that pass the `predicate` function, while the second member - those who doesn't. + */ +export function partition( + predicate: Predicate, + input: readonly T[] +): readonly [readonly T[], readonly T[]]; +export function partition( + predicate: Predicate +): (input: readonly T[]) => readonly [readonly T[], readonly T[]]; +export function partition( + predicate: (x: T, prop?: string) => boolean, + input: { readonly [key: string]: T} +): readonly [{ readonly [key: string]: T}, { readonly [key: string]: T}]; +export function partition( + predicate: (x: T, prop?: string) => boolean +): (input: { readonly [key: string]: T}) => readonly [{ readonly [key: string]: T}, { readonly [key: string]: T}]; + +/** + * If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`. + * + * It will return `undefined`, if such path is not found. + */ +export function path(pathToSearch: Path, obj: Input): T | undefined; +export function path(pathToSearch: Path, obj: any): T | undefined; +export function path(pathToSearch: Path): (obj: any) => T | undefined; +export function path(pathToSearch: Path): (obj: Input) => T | undefined; + +/** + * It returns `true` if `pathToSearch` of `input` object is equal to `target` value. + * + * `pathToSearch` is passed to `R.path`, which means that it can be either a string or an array. Also equality between `target` and the found value is determined by `R.equals`. + */ +export function pathEq(pathToSearch: Path, target: any, input: any): boolean; +export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean; +export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean; + +/** + * It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record)`. + * + * Because it calls `R.path`, then `singlePath` can be either string or a list. + */ +export function paths(pathsToSearch: readonly Path[], obj: Input): readonly (T | undefined)[]; +export function paths(pathsToSearch: readonly Path[]): (obj: Input) => readonly (T | undefined)[]; +export function paths(pathsToSearch: readonly Path[], obj: any): readonly (T | undefined)[]; +export function paths(pathsToSearch: readonly Path[]): (obj: any) => readonly (T | undefined)[]; + +/** + * It reads `obj` input and returns either `R.path(pathToSearch, Record)` result or `defaultValue` input. + */ +export function pathOr(defaultValue: T, pathToSearch: Path, obj: any): T; +export function pathOr(defaultValue: T, pathToSearch: Path): (obj: any) => T; +export function pathOr(defaultValue: T): (pathToSearch: Path) => (obj: any) => T; + +/** + * It returns a partial copy of an `input` containing only `propsToPick` properties. + * + * `input` can be either an object or an array. + * + * String anotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`. + */ +export function pick(propsToPick: readonly K[], input: T): Pick>>; +export function pick(propsToPick: readonly K[]): (input: T) => Pick>>; +export function pick(propsToPick: string, input: T): U; +export function pick(propsToPick: string): (input: T) => U; +export function pick(propsToPick: string, input: object): T; +export function pick(propsToPick: string): (input: object) => T; + +/** + * Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`. + */ +export function pickAll(propsToPick: readonly string[], input: T): U; +export function pickAll(propsToPick: readonly string[]): (input: T) => U; +export function pickAll(propsToPick: string, input: T): U; +export function pickAll(propsToPick: string): (input: T) => U; + +/** + * It performs left-to-right function composition. + */ +export function pipe( + ...funcs: readonly [ + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6, + f7: (a: R6) => R7, + ...func: ReadonlyArray<(a: any) => any>, + fnLast: (a: any) => TResult + ] +): (...args: TArgs) => TResult; // fallback overload if number of piped functions greater than 7 +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6, + f7: (a: R6) => R7 +): (...args: TArgs) => R7; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6 +): (...args: TArgs) => R6; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5 +): (...args: TArgs) => R5; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4 +): (...args: TArgs) => R4; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3 +): (...args: TArgs) => R3; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2 +): (...args: TArgs) => R2; +export function pipe( + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R1; + +/** + * It returns list of the values of `property` taken from the all objects inside `list`. + */ +export function pluck(property: K, list: readonly T[]): readonly T[K][]; +export function pluck(property: number, list: readonly { readonly [k: number]: T }[]): readonly T[]; +export function pluck

(property: P): (list: readonly Record[]) => readonly T[]; +export function pluck(property: number): (list: readonly { readonly [k: number]: T }[]) => readonly T[]; + +/** + * It adds element `x` at the beginning of `list`. + */ +export function prepend(x: T, input: readonly T[]): readonly T[]; +export function prepend(x: T): (input: readonly T[]) => readonly T[]; + +export function product(list: readonly number[]): number; + +/** + * It returns the value of property `propToFind` in `obj`. + * + * If there is no such property, it returns `undefined`. + */ +export function prop

(propToFind: P, obj: O): O[P]; +export function prop

(propToFind: P): (obj: O) => O[P]; +export function prop

(propToFind: P): (obj: Record) => T; +export function prop

(propToFind: P): (obj: Record) => T; + +/** + * It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`. + */ +export function propEq(propToFind: K, valueToMatch: any, obj: Record): boolean; +export function propEq(propToFind: K, valueToMatch: any): (obj: Record) => boolean; +export function propEq(propToFind: K): { + (valueToMatch: any, obj: Record): boolean; + (valueToMatch: any): (obj: Record) => boolean; +}; + +/** + * It returns `true` if `property` of `obj` is from `target` type. + */ +export function propIs(type: C, name: K, obj: any): obj is Record>; +export function propIs(type: C, name: K, obj: any): obj is Record>; +export function propIs(type: C, name: K): (obj: any) => obj is Record>; +export function propIs(type: C, name: K): (obj: any) => obj is Record>; +export function propIs(type: C): { + (name: K, obj: any): obj is Record>; + (name: K): (obj: any) => obj is Record>; +}; + +/** + * It returns either `defaultValue` or the value of `property` in `obj`. + */ +export function propOr(defaultValue: T, property: P, obj: Partial> | undefined): T; +export function propOr(defaultValue: T, property: P): (obj: Partial> | undefined) => T; +export function propOr(defaultValue: T): { +

(property: P, obj: Partial> | undefined): T; +

(property: P): (obj: Partial> | undefined) => T; +} + +/** + * It returns `true` if the object property satisfies a given predicate. + */ +export function propSatisfies(predicate: Predicate, property: string, obj: Record): boolean; +export function propSatisfies(predicate: Predicate, property: string): (obj: Record) => boolean; + +/** + * It returns list of numbers between `startInclusive` to `endExclusive` markers. + */ +export function range(startInclusive: number, endExclusive: number): readonly number[]; +export function range(startInclusive: number): (endExclusive: number) => readonly number[]; + +export function reduce(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: readonly T[]): TResult; +export function reduce(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: readonly T[]): TResult; +export function reduce(reducer: (prev: TResult, current: T, i?: number) => TResult): (initialValue: TResult, list: readonly T[]) => TResult; +export function reduce(reducer: (prev: TResult, current: T, i?: number) => TResult, initialValue: TResult): (list: readonly T[]) => TResult; + +/** + * It has the opposite effect of `R.filter`. + */ +export function reject(predicate: Predicate, list: readonly T[]): readonly T[]; +export function reject(predicate: Predicate): (list: readonly T[]) => readonly T[]; +export function reject(predicate: Predicate, obj: Dictionary): Dictionary; +export function reject(predicate: Predicate): (obj: Dictionary) => Dictionary; + +export function repeat(x: T): (timesToRepeat: number) => readonly T[]; +export function repeat(x: T, timesToRepeat: number): readonly T[]; + +/** + * It replaces `strOrRegex` found in `str` with `replacer`. + */ +export function replace(strOrRegex: RegExp | string, replacer: string, str: string): string; +export function replace(strOrRegex: RegExp | string, replacer: string): (str: string) => string; +export function replace(strOrRegex: RegExp | string): (replacer: string) => (str: string) => string; + +/** + * It returns a reversed copy of list or string `input`. + */ +export function reverse(input: readonly T[]): readonly T[]; +export function reverse(input: string): string; + +export function slice(from: number, to: number, input: string): string; +export function slice(from: number, to: number, input: readonly T[]): readonly T[]; +export function slice(from: number, to: number): { + (input: string): string; + (input: readonly T[]): readonly T[]; +}; +export function slice(from: number): { + (to: number, input: string): string; + (to: number, input: readonly T[]): readonly T[]; +}; + +/** + * It returns copy of `list` sorted by `sortFn` function, where `sortFn` needs to return only `-1`, `0` or `1`. + */ +export function sort(sortFn: (a: T, b: T) => number, list: readonly T[]): readonly T[]; +export function sort(sortFn: (a: T, b: T) => number): (list: readonly T[]) => readonly T[]; + +/** + * It returns copy of `list` sorted by `sortFn` function, where `sortFn` function returns a value to compare, i.e. it doesn't need to return only `-1`, `0` or `1`. + */ +export function sortBy(sortFn: (a: T) => Ord, list: readonly T[]): readonly T[]; +export function sortBy(sortFn: (a: T) => Ord): (list: readonly T[]) => readonly T[]; +export function sortBy(sortFn: (a: any) => Ord): (list: readonly T[]) => readonly T[]; + +/** + * Curried version of `String.prototype.split` + */ +export function split(separator: string | RegExp): (str: string) => readonly string[]; +export function split(separator: string | RegExp, str: string): readonly string[]; + +/** + * It splits `input` into slices of `sliceLength`. + */ +export function splitEvery(sliceLength: number, input: readonly T[]): readonly ((readonly T[]))[]; +export function splitEvery(sliceLength: number, input: string): readonly string[]; +export function splitEvery(sliceLength: number): { + (input: string): readonly string[]; + (input: readonly T[]): readonly ((readonly T[]))[]; +}; + +/** + * When iterable is a string, then it behaves as `String.prototype.startsWith`. + * When iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target. + */ +export function startsWith(target: string, str: string): boolean; +export function startsWith(target: string): (str: string) => boolean; +export function startsWith(target: readonly T[], list: readonly T[]): boolean; +export function startsWith(target: readonly T[]): (list: readonly T[]) => boolean; + +/** + * Curried version of `x - y` + */ +export function subtract(x: number, y: number): number; +export function subtract(x: number): (y: number) => number; + +export function sum(list: readonly number[]): number; + +/** + * It returns a merged list of `x` and `y` with all equal elements removed. + * + * `R.equals` is used to determine equality. + */ +export function symmetricDifference(x: readonly T[], y: readonly T[]): readonly T[]; +export function symmetricDifference(x: readonly T[]): (y: readonly T[]) => readonly T[]; + +export function T(): boolean; + +/** + * It returns all but the first element of `input`. + */ +export function tail(input: T): T extends readonly [any, ...infer U] ? U : readonly [...T]; +export function tail(input: string): string; + +/** + * It returns the first `howMany` elements of `input`. + */ +export function take(howMany: number, input: readonly T[]): readonly T[]; +export function take(howMany: number, input: string): string; +export function take(howMany: number): { + (input: readonly T[]): readonly T[]; + (input: string): string; +}; + +/** + * It returns the last `howMany` elements of `input`. + */ +export function takeLast(howMany: number, input: readonly T[]): readonly T[]; +export function takeLast(howMany: number, input: string): string; +export function takeLast(howMany: number): { + (input: readonly T[]): readonly T[]; + (input: string): string; +}; + +/** + * It applies function `fn` to input `x` and returns `x`. + * + * One use case is debuging in the middle of `R.compose`. + */ +export function tap(fn: (x: T) => void, input: T): T; +export function tap(fn: (x: T) => void): (input: T) => T; + +/** + * It determines whether `str` matches `regExpression`. + */ +export function test(regExpression: RegExp): (str: string) => boolean; +export function test(regExpression: RegExp, str: string): boolean; + +/** + * It returns the result of applying function `fn` over members of range array. + * + * The range array includes numbers between `0` and `howMany`(exclusive). + */ +export function times(fn: (i: number) => T, howMany: number): readonly T[]; +export function times(fn: (i: number) => T): (howMany: number) => readonly T[]; + +export function toLower(str: S): Lowercase; +export function toLower(str: string): string; + +export function toUpper(str: S): Uppercase; +export function toUpper(str: string): string; + +/** + * It transforms an object to a list. + */ +export function toPairs>(obj: O): ReadonlyArray<{ readonly [key in K]: readonly [`${key}`, O[key]] }[K]>; +export function toPairs(obj: Record): ReadonlyArray; + +export function toString(x: unknown): string; + +export function transpose(list: readonly ((readonly T[]))[]): readonly ((readonly T[]))[]; + +export function trim(str: string): string; + +/** + * It returns function that runs `fn` in `try/catch` block. If there was an error, then `fallback` is used to return the result. Note that `fn` can be value or asynchronous/synchronous function(unlike `Ramda` where fallback can only be a synchronous function). + */ +export function tryCatch( + fn: (input: T) => U, + fallback: U +): (input: T) => U; +export function tryCatch( + fn: (input: T) => U, + fallback: (input: T) => U +): (input: T) => U; +export function tryCatch( + fn: (input: any) => Promise, + fallback: T +): (input: any) => Promise; +export function tryCatch( + fn: (input: any) => Promise, + fallback: (input: any) => Promise, +): (input: any) => Promise; + +/** + * It accepts any input and it returns its type. + */ +export function type(x: any): RambdaTypes; + +/** + * It takes two lists and return a new list containing a merger of both list with removed duplicates. + * + * `R.equals` is used to compare for duplication. + */ +export function union(x: readonly T[], y: readonly T[]): readonly T[]; +export function union(x: readonly T[]): (y: readonly T[]) => readonly T[]; + +/** + * It returns a new array containing only one copy of each element of `list`. + * + * `R.equals` is used to determine equality. + */ +export function uniq(list: readonly T[]): readonly T[]; + +/** + * It returns a new array containing only one copy of each element in `list` according to `predicate` function. + * + * This predicate should return true, if two elements are equal. + */ +export function uniqWith(predicate: (x: T, y: T) => boolean, list: readonly T[]): readonly T[]; +export function uniqWith(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => readonly T[]; + +/** + * The method returns function that will be called with argument `input`. + * + * If `predicate(input)` returns `false`, then the end result will be the outcome of `whenFalse(input)`. + * + * In the other case, the final output will be the `input` itself. + */ +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U, x: T): T | U; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U): (x: T) => T | U; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T; + +/** + * It returns a copy of `list` with updated element at `index` with `newValue`. + */ +export function update(index: number, newValue: T, list: readonly T[]): readonly T[]; +export function update(index: number, newValue: T): (list: readonly T[]) => readonly T[]; + +/** + * With correct input, this is nothing more than `Object.values(Record)`. If `obj` is not an object, then it returns an empty array. + */ +export function values(obj: T): readonly T[K][]; + +export function when(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): T | U; +export function when(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U; +export function when(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U); + +/** + * It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object. + */ +export function where(conditions: T, input: U): boolean; +export function where(conditions: T): (input: U) => boolean; +export function where(conditions: ObjFunc2, input: U): boolean; +export function where(conditions: ObjFunc2): (input: U) => boolean; + +/** + * It will return `true` if all of `input` object fully or partially include `rule` object. + * + * `R.equals` is used to determine equality. + */ +export function whereEq(condition: T, input: U): boolean; +export function whereEq(condition: T): (input: U) => boolean; + +/** + * It will return a new array, based on all members of `source` list that are not part of `matchAgainst` list. + * + * `R.equals` is used to determine equality. + */ +export function without(matchAgainst: readonly T[], source: readonly T[]): readonly T[]; +export function without(matchAgainst: readonly T[]): (source: readonly T[]) => readonly T[]; + +/** + * Logical XOR + */ +export function xor(x: boolean, y: boolean): boolean; +export function xor(y: boolean): (y: boolean) => boolean; + +/** + * It will return a new array containing tuples of equally positions items from both `x` and `y` lists. + * + * The returned list will be truncated to match the length of the shortest supplied list. + */ +export function zip(x: readonly K[], y: readonly V[]): readonly KeyValuePair[]; +export function zip(x: readonly K[]): (y: readonly V[]) => readonly KeyValuePair[]; + +/** + * It will return a new object with keys of `keys` array and values of `values` array. + */ +export function zipObj(keys: readonly K[], values: readonly T[]): { readonly [P in K]: T }; +export function zipObj(keys: readonly K[]): (values: readonly T[]) => { readonly [P in K]: T }; +export function zipObj(keys: readonly K[], values: readonly T[]): { readonly [P in K]: T }; +export function zipObj(keys: readonly K[]): (values: readonly T[]) => { readonly [P in K]: T }; + +/** + * It takes list with properties `propsToPick` and returns a list with property values in `obj`. + */ +export function props

(propsToPick: readonly P[], obj: Record): readonly T[]; +export function props

(propsToPick: readonly P[]): (obj: Record) => readonly T[]; +export function props

(propsToPick: readonly P[]): (obj: Record) => readonly T[]; + +export function zipWith(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): readonly TResult[]; +export function zipWith(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => readonly TResult[]; +export function zipWith(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => readonly TResult[]; + +/** + * It splits string or array at a given index. + */ +export function splitAt(index: number, input: readonly T[]): readonly [readonly T[], readonly T[]]; +export function splitAt(index: number, input: string): readonly [string, string]; +export function splitAt(index: number): { + (input: readonly T[]): readonly [readonly T[], readonly T[]]; + (input: string): readonly [string, string]; +}; + +/** + * It splits `list` to two arrays according to a `predicate` function. + * + * The first array contains all members of `list` before `predicate` returns `true`. + */ +export function splitWhen(predicate: Predicate, list: readonly U[]): readonly ((readonly U[]))[]; +export function splitWhen(predicate: Predicate): (list: readonly U[]) => readonly ((readonly U[]))[]; + +export function takeLastWhile(predicate: (x: string) => boolean, input: string): string; +export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string; +export function takeLastWhile(predicate: (x: T) => boolean, input: readonly T[]): readonly T[]; +export function takeLastWhile(predicate: (x: T) => boolean): (input: readonly T[]) => readonly T[]; + +/** + * It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result. + */ +export function evolve(rules: readonly ((x: T) => U)[], list: readonly T[]): readonly U[]; +export function evolve(rules: readonly ((x: T) => U)[]) : (list: readonly T[]) => readonly U[]; +export function evolve>(rules: E, obj: V): Evolve; +export function evolve(rules: E): >(obj: V) => Evolve; + +export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string; +export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string; +export function dropLastWhile(predicate: (x: T) => boolean, iterable: readonly T[]): readonly T[]; +export function dropLastWhile(predicate: (x: T) => boolean): (iterable: readonly T[]) => readonly T[]; + +/** + * It removes any successive duplicates according to `R.equals`. + */ +export function dropRepeats(list: readonly T[]): readonly T[]; + +export function dropRepeatsWith(predicate: (x: T, y: T) => boolean, list: readonly T[]): readonly T[]; +export function dropRepeatsWith(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => readonly T[]; + +export function dropWhile(fn: Predicate, iterable: string): string; +export function dropWhile(fn: Predicate): (iterable: string) => string; +export function dropWhile(fn: Predicate, iterable: readonly T[]): readonly T[]; +export function dropWhile(fn: Predicate): (iterable: readonly T[]) => readonly T[]; + +export function takeWhile(fn: Predicate, iterable: string): string; +export function takeWhile(fn: Predicate): (iterable: string) => string; +export function takeWhile(fn: Predicate, iterable: readonly T[]): readonly T[]; +export function takeWhile(fn: Predicate): (iterable: readonly T[]) => readonly T[]; + +/** + * It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`. + */ +export function eqProps(prop: string, obj1: T, obj2: U): boolean; +export function eqProps

(prop: P): (obj1: Record, obj2: Record) => boolean; +export function eqProps(prop: string, obj1: T): (obj2: U) => boolean; + +/** + * It calls a function `fn` with the list of values of the returned function. + * + * `R.unapply` is the opposite of `R.apply` method. + */ +export function unapply(fn: (args: readonly any[]) => T): (...args: readonly any[]) => T; + +/** + * It applies function `fn` to the list of arguments. + * + * This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant. + */ +export function apply(fn: (...args: readonly any[]) => T, args: readonly any[]): T; +export function apply(fn: (...args: readonly any[]) => T): (args: readonly any[]) => T; + +/** + * Creates a function that is bound to a context. + */ +export function bind(fn: F, thisObj: T): (...args: Parameters) => ReturnType; +export function bind(fn: F): (thisObj: T) => (...args: Parameters) => ReturnType; + +/** + * It takes two objects and a function, which will be used when there is an overlap between the keys. + */ +export function mergeWith(fn: (x: any, z: any) => any, a: Record, b: Record): Record; +export function mergeWith(fn: (x: any, z: any) => any, a: Record, b: Record): Output; +export function mergeWith(fn: (x: any, z: any) => any, a: Record): (b: Record) => Record; +export function mergeWith(fn: (x: any, z: any) => any, a: Record): (b: Record) => Output; +export function mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => Record; +export function mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => Output; + +/** + * It applies list of function to a list of inputs. + */ +export function juxt(fns: readonly [(...a: A) => R1]): (...a: A) => readonly [R1]; +export function juxt(fns: readonly [(...a: A) => R1, (...a: A) => R2]): (...a: A) => readonly [R1, R2]; +export function juxt(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => readonly [R1, R2, R3]; +export function juxt(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => readonly [R1, R2, R3, R4]; +export function juxt(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => readonly [R1, R2, R3, R4, R5]; +export function juxt(fns: ReadonlyArray<(...args: A) => U>): (...args: A) => readonly U[]; + +/** + * It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`. + */ +export function count(predicate: (x: T) => boolean, list: readonly T[]): number; +export function count(predicate: (x: T) => boolean): (list: readonly T[]) => number; + +/** + * It counts elements in a list after each instance of the input list is passed through `transformFn` function. + */ +export function countBy(transformFn: (x: T) => any, list: readonly T[]): Record; +export function countBy(transformFn: (x: T) => any): (list: readonly T[]) => Record; + +export function unwind(prop: keyof T, obj: T): readonly U[]; +export function unwind(prop: keyof T): (obj: T) => readonly U[]; + +/** + * It passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`). + * + * This method is also known as P combinator. + */ +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R; +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R; +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): { + (a: T, b: T): R; + (a: T): (b: T) => R; +}; + +/** + * Same as `R.where`, but it will return `true` if at least one condition check returns `true`. + */ +export function whereAny(conditions: T, input: U): boolean; +export function whereAny(conditions: T): (input: U) => boolean; +export function whereAny(conditions: ObjFunc2, input: U): boolean; +export function whereAny(conditions: ObjFunc2): (input: U) => boolean; + +/** + * `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument. + * + * Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input. + */ +export function partialObject( + fn: (input: Input) => Output, + partialInput: PartialInput, +): (input: Pick>) => Output; + +export function uniqBy(fn: (a: T) => U, list: readonly T[]): readonly T[]; +export function uniqBy(fn: (a: T) => U): (list: readonly T[]) => readonly T[]; + +/** + * It changes a property of object on the base of provided path and transformer function. + */ +export function modifyPath>(path: Path, fn: (x: any) => unknown, object: Record): T; +export function modifyPath>(path: Path, fn: (x: any) => unknown): (object: Record) => T; +export function modifyPath>(path: Path): (fn: (x: any) => unknown) => (object: Record) => T; + +export function modify( + prop: K, + fn: (a: T[K]) => P, + obj: T, +): Omit & Record; +export function modify( + prop: K, + fn: (a: A) => P, +): >(target: T) => Omit & Record; diff --git a/src/lib/node_modules/rambda/immutable.js b/src/lib/node_modules/rambda/immutable.js new file mode 100644 index 0000000..d16c943 --- /dev/null +++ b/src/lib/node_modules/rambda/immutable.js @@ -0,0 +1 @@ +module.exports = require('./dist/rambda.js') \ No newline at end of file diff --git a/src/lib/node_modules/rambda/index.d.ts b/src/lib/node_modules/rambda/index.d.ts new file mode 100644 index 0000000..71b982d --- /dev/null +++ b/src/lib/node_modules/rambda/index.d.ts @@ -0,0 +1,1570 @@ +export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error" | "Map" | "WeakMap" | "Generator" | "GeneratorFunction" | "BigInt" | "ArrayBuffer"; + +// used in R.reduce to stop the loop +export function reduceStopper(input: T) : T +export type IndexedIterator = (x: T, i: number) => U; +export type Iterator = (x: T) => U; +export type ObjectIterator = (x: T, prop: string, inputObj: Dictionary) => U; +type Ord = number | string | boolean | Date; +type Path = string | (number | string)[]; +type Predicate = (x: T) => boolean; +export type IndexedPredicate = (x: T, i: number) => boolean; +export type ObjectPredicate = (x: T, prop: string, inputObj: Dictionary) => boolean; +export type RamdaPath = (number | string)[]; +type CondPair = [(...val: T) => boolean, (...val: T) => R] + +type ValueOfRecord = + R extends Record + ? T + : never; + +interface KeyValuePair extends Array { + 0: K; + 1: V; +} + +export interface Lens { + (obj: T): U; + set(str: string, obj: T): U; +} + +type Arity1Fn = (x: any) => any; +type Arity2Fn = (x: any, y: any) => any; + +type Pred = (...x: any[]) => boolean; + +export interface Dictionary {[index: string]: T} +type Partial = { [P in keyof T]?: T[P]}; + +type Evolvable = { [P in keyof E]?: Evolved; +}; + +type Evolver = any> = { [key in keyof Partial]: ((value: T[key]) => T[key]) | (T[key] extends Evolvable ? Evolver : never); +}; + +type Evolve, E extends Evolver> = { [P in keyof O]: P extends keyof E + ? EvolveValue + : O[P]; +}; + +type Evolved = + A extends (value: infer V) => any + ? V + : A extends Evolver + ? Evolvable + : never; + +type EvolveNestedValue = + O extends object + ? O extends Evolvable + ? Evolve + : never + : never; + +type EvolveValue = + E extends (value: V) => any + ? ReturnType + : E extends Evolver + ? EvolveNestedValue + : never; + +interface AssocPartialOne { + (val: T): (obj: U) => Record & U; + (val: T, obj: U): Record & U; +} + +type AnyFunction = (...args: any[]) => unknown; +type AnyConstructor = new (...args: any[]) => unknown; + +// RAMBDAX INTERFACES +// ============================================ +type Func = (input: any) => T; +type VoidInputFunc = () => T; +type Fn = (x: In) => Out; +type SortObjectPredicate = (aProp: string, bProp: string, aValue: T, bValue: T) => number; + +type IdentityFunction = (x: T) => T; + +interface Filter { + (list: T[]): T[]; + (obj: Dictionary): Dictionary; +} + +type ArgumentTypes = T extends (...args: infer U) => infer R ? U : never; +type isfn = (x: any, y: any) => T; + +interface Switchem { + is: isfn>; + default: IdentityFunction; +} + +interface Schema { + [key: string]: any; +} + +interface SchemaAsync { + [key: string]: Promise; +} + +interface IsValid { + input: object; + schema: Schema; +} + +interface IsValidAsync { + input: object; + schema: Schema | SchemaAsync; +} + +type ProduceRules = { [P in K]: (input: Input) => Output[P]; +}; +type ProduceAsyncRules = { [P in K]: (input: Input) => Promise; +}; +type ProduceAsyncRule = (input: Input) => Promise; +type Async = (x: any) => Promise; +type AsyncIterable = (x: T) => Promise; +type AsyncIterableIndexed = (x: T, i: number) => Promise; +type AsyncPredicate = (x: T) => Promise; +type AsyncPredicateIndexed = (x: T, i: number) => Promise; +type AsyncWithProp = (x: any, prop?: string) => Promise; + +type ApplyDiffUpdate = {op:'update', path: string, value: any}; +type ApplyDiffAdd = {op:'add', path: string, value: any}; +type ApplyDiffRemove = {op:'remove', path: string}; +type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove; + +type Resolved = {status: 'fulfilled', value: T} | {status: 'rejected', reason: string|Error} + + +/** + * It adds `a` and `b`. + */ +export function add(a: number, b: number): number; +export function add(a: number): (b: number) => number; + +/** + * It replaces `index` in array `list` with the result of `replaceFn(list[i])`. + */ +export function adjust(index: number, replaceFn: (x: T) => T, list: T[]): T[]; +export function adjust(index: number, replaceFn: (x: T) => T): (list: T[]) => T[]; + +/** + * It returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function. + */ +export function all(predicate: (x: T) => boolean, list: T[]): boolean; +export function all(predicate: (x: T) => boolean): (list: T[]) => boolean; + +/** + * It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument. + */ +export function allPass(predicates: ((x: T) => boolean)[]): (input: T) => boolean; +export function allPass(predicates: ((...inputs: T[]) => boolean)[]): (...inputs: T[]) => boolean; + +/** + * It returns function that always returns `x`. + */ +export function always(x: T): (...args: unknown[]) => T; + +/** + * Logical AND + */ +export function and(x: T, y: U): T | U; +export function and(x: T): (y: U) => T | U; + +/** + * Logical OR + */ +export function or(a: T, b: U): T | U; +export function or(a: T): (b: U) => T | U; + +/** + * It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function. + */ +export function any(predicate: (x: T) => boolean, list: T[]): boolean; +export function any(predicate: (x: T) => boolean): (list: T[]) => boolean; + +/** + * It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`. + */ +export function anyPass(predicates: ((x: T) => boolean)[]): (input: T) => boolean; +export function anyPass(predicates: ((...inputs: T[]) => boolean)[]): (...inputs: T[]) => boolean; + +/** + * It adds element `x` at the end of `list`. + */ +export function append(x: T, list: T[]): T[]; +export function append(x: T): (list: T[]) => T[]; + +export function applySpec>( + spec: Spec +): ( + ...args: Parameters> +) => { [Key in keyof Spec]: ReturnType }; +export function applySpec(spec: any): (...args: unknown[]) => T; + +/** + * It makes a shallow clone of `obj` with setting or overriding the property `prop` with `newValue`. + */ +export function assoc(prop: K, val: T, obj: U): Record & Omit; +export function assoc(prop: K, val: T): (obj: U) => Record & Omit; +export function assoc(prop: K): AssocPartialOne; + +/** + * It makes a shallow clone of `obj` with setting or overriding with `newValue` the property found with `path`. + */ +export function assocPath(path: Path, newValue: any, obj: object): Output; +export function assocPath(path: Path, newValue: any): (obj: object) => Output; +export function assocPath(path: Path): (newValue: any) => (obj: object) => Output; + +/** + * It returns a function with `input` argument. + * + * This function will return `true`, if both `firstCondition` and `secondCondition` return `true` when `input` is passed as their argument. + */ +export function both(pred1: Pred, pred2: Pred): Pred; +export function both(pred1: Predicate, pred2: Predicate): Predicate; +export function both(pred1: Predicate): (pred2: Predicate) => Predicate; +export function both(pred1: Pred): (pred2: Pred) => Pred; + +/** + * The method is also known as `flatMap`. + */ +export function chain(fn: (n: T) => U[], list: T[]): U[]; +export function chain(fn: (n: T) => U[]): (list: T[]) => U[]; + +/** + * Restrict a number `input` to be within `min` and `max` limits. + * + * If `input` is bigger than `max`, then the result is `max`. + * + * If `input` is smaller than `min`, then the result is `min`. + */ +export function clamp(min: number, max: number, input: number): number; +export function clamp(min: number, max: number): (input: number) => number; + +/** + * It creates a deep copy of the `input`, which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates. + */ +export function clone(input: T): T; +export function clone(input: T[]): T[]; + +/** + * It returns `inverted` version of `origin` function that accept `input` as argument. + * + * The return value of `inverted` is the negative boolean value of `origin(input)`. + */ +export function complement(predicate: (...args: T) => unknown): (...args: T) => boolean; + +/** + * It performs right-to-left function composition. + */ +export function compose( + ...func: [ + fnLast: (a: any) => TResult, + ...func: Array<(a: any) => any>, + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 + ] +): (...args: TArgs) => TResult; // fallback overload if number of composed functions greater than 7 +export function compose( + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R7; +export function compose( + f7: (a: R6) => R7, + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R7; +export function compose( + f6: (a: R5) => R6, + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R6; +export function compose( + f5: (a: R4) => R5, + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R5; +export function compose( + f4: (a: R3) => R4, + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R4; +export function compose( + f3: (a: R2) => R3, + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R3; +export function compose( + f2: (a: R1) => R2, + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R2; +export function compose( + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R1; + +/** + * It returns a new string or array, which is the result of merging `x` and `y`. + */ +export function concat(x: T[], y: T[]): T[]; +export function concat(x: T[]): (y: T[]) => T[]; +export function concat(x: string, y: string): string; +export function concat(x: string): (y: string) => string; + +/** + * It takes list with `conditions` and returns a new function `fn` that expects `input` as argument. + * + * This function will start evaluating the `conditions` in order to find the first winner(order of conditions matter). + * + * The winner is this condition, which left side returns `true` when `input` is its argument. Then the evaluation of the right side of the winner will be the final result. + * + * If no winner is found, then `fn` returns `undefined`. + */ +export function cond(conditions: Array>): (...args: T) => R; + +/** + * Accepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value. + */ +export function converge(after: ((...a: any[]) => any), fns: ((...x: any[]) => any)[]): (...y: any[]) => any; + +/** + * It expects a function as input and returns its curried version. + */ +export function curry(fn: AnyFunction): (...a: any[]) => any; + +/** + * It returns a curried equivalent of the provided function, with the specified arity. + */ +export function curryN(length: number, fn: AnyFunction): (...a: any[]) => any; + +/** + * It decrements a number. + */ +export function dec(x: number): number; + +/** + * It returns `defaultValue`, if all of `inputArguments` are `undefined`, `null` or `NaN`. + * + * Else, it returns the first truthy `inputArguments` instance(from left to right). + */ +export function defaultTo(defaultValue: T, input: T | null | undefined): T; +export function defaultTo(defaultValue: T): (input: T | null | undefined) => T; + +/** + * It returns the uniq set of all elements in the first list `a` not contained in the second list `b`. + * + * `R.equals` is used to determine equality. + */ +export function difference(a: T[], b: T[]): T[]; +export function difference(a: T[]): (b: T[]) => T[]; + +/** + * It returns a new object that does not contain property `prop`. + */ +export function dissoc(prop: K, obj: T): Omit; +export function dissoc(prop: K): (obj: T) => Omit; + +export function divide(x: number, y: number): number; +export function divide(x: number): (y: number) => number; + +/** + * It returns `howMany` items dropped from beginning of list or string `input`. + */ +export function drop(howMany: number, input: T[]): T[]; +export function drop(howMany: number, input: string): string; +export function drop(howMany: number): { + (input: T[]): T[]; + (input: string): string; +}; + +/** + * It returns `howMany` items dropped from the end of list or string `input`. + */ +export function dropLast(howMany: number, input: T[]): T[]; +export function dropLast(howMany: number, input: string): string; +export function dropLast(howMany: number): { + (input: T[]): T[]; + (input: string): string; +}; + +/** + * It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs. + * + * This `predicate` function will return `true`, if any of the two input predicates return `true`. + */ +export function either(firstPredicate: Pred, secondPredicate: Pred): Pred; +export function either(firstPredicate: Predicate, secondPredicate: Predicate): Predicate; +export function either(firstPredicate: Predicate): (secondPredicate: Predicate) => Predicate; +export function either(firstPredicate: Pred): (secondPredicate: Pred) => Pred; + +/** + * When iterable is a string, then it behaves as `String.prototype.endsWith`. + * When iterable is a list, then it uses R.equals to determine if the target list ends in the same way as the given target. + */ +export function endsWith(target: string, iterable: string): boolean; +export function endsWith(target: string): (iterable: string) => boolean; +export function endsWith(target: T[], list: T[]): boolean; +export function endsWith(target: T[]): (list: T[]) => boolean; + +/** + * It deeply compares `x` and `y` and returns `true` if they are equal. + */ +export function equals(x: T, y: T): boolean; +export function equals(x: T): (y: T) => boolean; + +export function F(): boolean; + +/** + * It filters list or object `input` using a `predicate` function. + */ +export function filter(predicate: Predicate): (input: T[]) => T[]; +export function filter(predicate: Predicate, input: T[]): T[]; +export function filter(predicate: ObjectPredicate): (x: Dictionary) => Dictionary; +export function filter(predicate: ObjectPredicate, x: Dictionary): Dictionary; + +/** + * It returns the first element of `list` that satisfy the `predicate`. + * + * If there is no such element, it returns `undefined`. + */ +export function find(predicate: (x: T) => boolean, list: T[]): T | undefined; +export function find(predicate: (x: T) => boolean): (list: T[]) => T | undefined; + +/** + * It returns the index of the first element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `-1` is returned. + */ +export function findIndex(predicate: (x: T) => boolean, list: T[]): number; +export function findIndex(predicate: (x: T) => boolean): (list: T[]) => number; + +/** + * It returns the last element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `undefined` is returned. + */ +export function findLast(fn: (x: T) => boolean, list: T[]): T | undefined; +export function findLast(fn: (x: T) => boolean): (list: T[]) => T | undefined; + +/** + * It returns the index of the last element of `list` satisfying the `predicate` function. + * + * If there is no such element, then `-1` is returned. + */ +export function findLastIndex(predicate: (x: T) => boolean, list: T[]): number; +export function findLastIndex(predicate: (x: T) => boolean): (list: T[]) => number; + +/** + * It deeply flattens an array. + */ +export function flatten(list: any[]): T[]; + +/** + * It returns function which calls `fn` with exchanged first and second argument. + */ +export function flip(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult; + +/** + * It applies `iterable` function over all members of `list` and returns `list`. + */ +export function forEach(fn: Iterator, list: T[]): T[]; +export function forEach(fn: Iterator): (list: T[]) => T[]; +export function forEach(fn: ObjectIterator, list: Dictionary): Dictionary; +export function forEach(fn: ObjectIterator): (list: Dictionary) => Dictionary; + +/** + * It transforms a `listOfPairs` to an object. + */ +export function fromPairs(listOfPairs: ([number, V])[]): { [index: number]: V }; +export function fromPairs(listOfPairs: ([string, V])[]): { [index: string]: V }; + +/** + * It splits `list` according to a provided `groupFn` function and returns an object. + */ +export function groupBy(groupFn: (x: T) => string, list: T[]): { [index: string]: T[] }; +export function groupBy(groupFn: (x: T) => string): (list: T[]) => { [index: string]: T[] }; +export function groupBy(groupFn: (x: T) => string, list: T[]): U; +export function groupBy(groupFn: (x: T) => string): (list: T[]) => U; + +/** + * It returns separated version of list or string `input`, where separation is done with equality `compareFn` function. + */ +export function groupWith(compareFn: (x: T, y: T) => boolean): (input: T[]) => (T[])[]; +export function groupWith(compareFn: (x: T, y: T) => boolean, input: T[]): (T[])[]; +export function groupWith(compareFn: (x: T, y: T) => boolean, input: string): string[]; + +/** + * It returns `true` if `obj` has property `prop`. + */ +export function has(prop: string, obj: T): boolean; +export function has(prop: string): (obj: T) => boolean; + +/** + * It will return true, if `input` object has truthy `path`(calculated with `R.path`). + */ +export function hasPath( + path: string | string[], + input: object +): boolean; +export function hasPath( + path: string | string[] +): (input: object) => boolean; + +/** + * It returns the first element of list or string `input`. + */ +export function head(input: string): string; +export function head(emptyList: []): undefined; +export function head(input: T[]): T | undefined; + +/** + * It returns `true` if its arguments `a` and `b` are identical. + * + * Otherwise, it returns `false`. + */ +export function identical(x: T, y: T): boolean; +export function identical(x: T): (y: T) => boolean; + +/** + * It just passes back the supplied `input` argument. + */ +export function identity(input: T): T; + +/** + * It expects `condition`, `onTrue` and `onFalse` functions as inputs and it returns a new function with example name of `fn`. + * + * When `fn`` is called with `input` argument, it will return either `onTrue(input)` or `onFalse(input)` depending on `condition(input)` evaluation. + */ +export function ifElse( + pred: (a: T) => a is TFiltered, + onTrue: (a: TFiltered) => TOnTrueResult, + onFalse: (a: Exclude) => TOnFalseResult, +): (a: T) => TOnTrueResult | TOnFalseResult; +export function ifElse(fn: (...args: TArgs) => boolean, onTrue: (...args: TArgs) => TOnTrueResult, onFalse: (...args: TArgs) => TOnFalseResult): (...args: TArgs) => TOnTrueResult | TOnFalseResult; + +/** + * It increments a number. + */ +export function inc(x: number): number; + +/** + * If `input` is string, then this method work as native `String.includes`. + * + * If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list. + */ +export function includes(valueToFind: string, input: string[] | string): boolean; +export function includes(valueToFind: string): (input: string[] | string) => boolean; +export function includes(valueToFind: T, input: T[]): boolean; +export function includes(valueToFind: T): (input: T[]) => boolean; + +/** + * It generates object with properties provided by `condition` and values provided by `list` array. + * + * If `condition` is a function, then all list members are passed through it. + * + * If `condition` is a string, then all list members are passed through `R.path(condition)`. + */ +export function indexBy(condition: (key: T) => K, list: T[]): { [key in K]: T }; +export function indexBy(condition: (key: T) => K, list: T[]): { [key in NonNullable]?: T }; +export function indexBy(condition: (key: T) => K): (list: T[]) => { [key in K]: T }; +export function indexBy(condition: (key: T) => K | undefined): (list: T[]) => { [key in NonNullable]?: T }; +export function indexBy(condition: string, list: T[]): { [key: string]: T }; +export function indexBy(condition: string): (list: T[]) => { [key: string]: T }; + +/** + * It returns the index of the first element of `list` equals to `valueToFind`. + * + * If there is no such element, it returns `-1`. + */ +export function indexOf(valueToFind: T, list: T[]): number; +export function indexOf(valueToFind: T): (list: T[]) => number; + +/** + * It returns all but the last element of list or string `input`. + */ +export function init(input: T): T extends readonly [...infer U, any] ? U : [...T]; +export function init(input: string): string; + +/** + * It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`. + */ +export function intersection(listA: T[], listB: T[]): T[]; +export function intersection(listA: T[]): (listB: T[]) => T[]; + +/** + * It adds a `separator` between members of `list`. + */ +export function intersperse(separator: T, list: T[]): T[]; +export function intersperse(separator: T): (list: T[]) => T[]; + +/** + * It returns `true` if `x` is instance of `targetPrototype`. + */ +export function is any>(targetPrototype: C, val: any): val is ReturnType; +export function is any>(targetPrototype: C, val: any): val is InstanceType; +export function is any>(targetPrototype: C): (val: any) => val is ReturnType; +export function is any>(targetPrototype: C): (val: any) => val is InstanceType; + +/** + * It returns `true` if `x` is `empty`. + */ +export function isEmpty(x: T): boolean; + +/** + * It returns `true` if `x` is either `null` or `undefined`. + */ +export function isNil(x: any): x is null | undefined; + +/** + * It returns a string of all `list` instances joined with a `glue`. + */ +export function join(glue: string, list: T[]): string; +export function join(glue: string): (list: T[]) => string; + +/** + * It applies `Object.keys` over `x` and returns its keys. + */ +export function keys(x: T): (keyof T)[]; +export function keys(x: T): string[]; + +/** + * It returns the last element of `input`, as the `input` can be either a string or an array. + */ +export function last(str: string): string; +export function last(emptyList: []): undefined; +export function last(list: T[]): T | undefined; + +/** + * It returns the last index of `target` in `list` array. + * + * `R.equals` is used to determine equality between `target` and members of `list`. + * + * If there is no such index, then `-1` is returned. + */ +export function lastIndexOf(target: T, list: T[]): number; +export function lastIndexOf(target: T): (list: T[]) => number; + +/** + * It returns the `length` property of list or string `input`. + */ +export function length(input: T[]): number; + +/** + * It returns a `lens` for the given `getter` and `setter` functions. + * + * The `getter` **gets** the value of the focus; the `setter` **sets** the value of the focus. + * + * The setter should not mutate the data structure. + */ +export function lens(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens; + +/** + * It returns a lens that focuses on specified `index`. + */ +export function lensIndex(index: number): Lens; + +/** + * It returns a lens that focuses on specified `path`. + */ +export function lensPath(path: RamdaPath): Lens; +export function lensPath(path: string): Lens; + +/** + * It returns a lens that focuses on specified property `prop`. + */ +export function lensProp(prop: string): { + (obj: T): U; + set(val: T, obj: U): V; +}; + +/** + * It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus. + */ +export function over(lens: Lens, fn: Arity1Fn, value: T): T; +export function over(lens: Lens, fn: Arity1Fn, value: T[]): T[]; +export function over(lens: Lens, fn: Arity1Fn): (value: T) => T; +export function over(lens: Lens, fn: Arity1Fn): (value: T[]) => T[]; +export function over(lens: Lens): (fn: Arity1Fn, value: T) => T; +export function over(lens: Lens): (fn: Arity1Fn, value: T[]) => T[]; + +/** + * It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value. + */ +export function set(lens: Lens, replacer: U, obj: T): T; +export function set(lens: Lens, replacer: U): (obj: T) => T; +export function set(lens: Lens): (replacer: U, obj: T) => T; + +/** + * It returns the value of `lens` focus over `target` object. + */ +export function view(lens: Lens): (target: T) => U; +export function view(lens: Lens, target: T): U; + +/** + * It returns the result of looping through `iterable` with `fn`. + * + * It works with both array and object. + */ +export function map(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function map(fn: Iterator, iterable: T[]): U[]; +export function map(fn: Iterator): (iterable: T[]) => U[]; +export function map(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; +export function map(fn: Iterator): (iterable: T[]) => T[]; +export function map(fn: Iterator, iterable: T[]): T[]; + +/** + * It works the same way as `R.map` does for objects. It is added as Ramda also has this method. + */ +export function mapObjIndexed(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function mapObjIndexed(fn: ObjectIterator, iterable: Dictionary): Dictionary; +export function mapObjIndexed(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; +export function mapObjIndexed(fn: ObjectIterator): (iterable: Dictionary) => Dictionary; + +/** + * Curried version of `String.prototype.match` which returns empty array, when there is no match. + */ +export function match(regExpression: RegExp, str: string): string[]; +export function match(regExpression: RegExp): (str: string) => string[]; + +/** + * `R.mathMod` behaves like the modulo operator should mathematically, unlike the `%` operator (and by extension, `R.modulo`). So while `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. + */ +export function mathMod(x: number, y: number): number; +export function mathMod(x: number): (y: number) => number; + +/** + * It returns the greater value between `x` and `y`. + */ +export function max(x: T, y: T): T; +export function max(x: T): (y: T) => T; + +/** + * It returns the greater value between `x` and `y` according to `compareFn` function. + */ +export function maxBy(compareFn: (input: T) => Ord, x: T, y: T): T; +export function maxBy(compareFn: (input: T) => Ord, x: T): (y: T) => T; +export function maxBy(compareFn: (input: T) => Ord): (x: T) => (y: T) => T; + +/** + * It returns the mean value of `list` input. + */ +export function mean(list: number[]): number; + +/** + * It returns the median value of `list` input. + */ +export function median(list: number[]): number; + +/** + * Same as `R.mergeRight`. + */ +export function merge(target: A, newProps: B): A & B +export function merge(target: any): (newProps: any) => Output; + +/** + * It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same. + */ +export function mergeRight(target: A, newProps: B): A & B +export function mergeRight(target: any): (newProps: any) => Output; + +/** + * It merges all objects of `list` array sequentially and returns the result. + */ +export function mergeAll(list: object[]): T; +export function mergeAll(list: object[]): object; + +/** + * Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects: + * + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the second object will be used. + */ +export function mergeDeepRight(target: object, newProps: object): Output; +export function mergeDeepRight(target: object): (newProps: object) => Output; + +/** + * Same as `R.merge`, but in opposite direction. + */ +export function mergeLeft(newProps: object, target: object): Output; +export function mergeLeft(newProps: object): (target: object) => Output; + +/** + * It returns the lesser value between `x` and `y`. + */ +export function min(x: T, y: T): T; +export function min(x: T): (y: T) => T; + +/** + * It returns the lesser value between `x` and `y` according to `compareFn` function. + */ +export function minBy(compareFn: (input: T) => Ord, x: T, y: T): T; +export function minBy(compareFn: (input: T) => Ord, x: T): (y: T) => T; +export function minBy(compareFn: (input: T) => Ord): (x: T) => (y: T) => T; + +/** + * Curried version of `x%y`. + */ +export function modulo(x: number, y: number): number; +export function modulo(x: number): (y: number) => number; + +/** + * It returns a copy of `list` with exchanged `fromIndex` and `toIndex` elements. + */ +export function move(fromIndex: number, toIndex: number, list: T[]): T[]; +export function move(fromIndex: number, toIndex: number): (list: T[]) => T[]; +export function move(fromIndex: number): { + (toIndex: number, list: T[]): T[]; + (toIndex: number): (list: T[]) => T[]; +}; + +/** + * Curried version of `x*y`. + */ +export function multiply(x: number, y: number): number; +export function multiply(x: number): (y: number) => number; + +export function negate(x: number): number; + +/** + * It returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function. + */ +export function none(predicate: (x: T) => boolean, list: T[]): boolean; +export function none(predicate: (x: T) => boolean): (list: T[]) => boolean; + +/** + * It returns a boolean negated version of `input`. + */ +export function not(input: any): boolean; + +/** + * Curried version of `input[index]`. + */ +export function nth(index: number, input: string): string; +export function nth(index: number, input: T[]): T | undefined; +export function nth(n: number): { + (input: T[]): T | undefined; + (input: string): string; +}; + +/** + * It creates an object with a single key-value pair. + */ +export function objOf(key: K, value: T): Record; +export function objOf(key: K): (value: T) => Record; + +/** + * It returns a function, which invokes only once `fn` function. + */ +export function once(func: T): T; + +/** + * It returns a partial copy of an `obj` without `propsToOmit` properties. + */ +export function omit(propsToOmit: K[], obj: T): Omit; +export function omit(propsToOmit: K[]): (obj: T) => Omit; +export function omit(propsToOmit: string, obj: T): U; +export function omit(propsToOmit: string): (obj: T) => U; +export function omit(propsToOmit: string, obj: object): T; +export function omit(propsToOmit: string): (obj: object) => T; + +export function of(x: T): T[]; + +/** + * It is very similar to `R.curry`, but you can pass initial arguments when you create the curried function. + * + * `R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed. + * The name comes from the fact that you partially inject the inputs. + */ +export function partial(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (x2: V2) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (x1: V1, x2: V2) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1, V2]): (x2: V3) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1]): (x2: V2, x3: V3) => T; +export function partial(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0]): (x1: V1, x2: V2, x3: V3) => T; +export function partial(fn: (...a: any[]) => T, args: any[]): (...x: any[]) => T; + +/** + * It will return array of two objects/arrays according to `predicate` function. The first member holds all instances of `input` that pass the `predicate` function, while the second member - those who doesn't. + */ +export function partition( + predicate: Predicate, + input: T[] +): [T[], T[]]; +export function partition( + predicate: Predicate +): (input: T[]) => [T[], T[]]; +export function partition( + predicate: (x: T, prop?: string) => boolean, + input: { [key: string]: T} +): [{ [key: string]: T}, { [key: string]: T}]; +export function partition( + predicate: (x: T, prop?: string) => boolean +): (input: { [key: string]: T}) => [{ [key: string]: T}, { [key: string]: T}]; + +/** + * If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`. + * + * It will return `undefined`, if such path is not found. + */ +export function path(pathToSearch: Path, obj: Input): T | undefined; +export function path(pathToSearch: Path, obj: any): T | undefined; +export function path(pathToSearch: Path): (obj: any) => T | undefined; +export function path(pathToSearch: Path): (obj: Input) => T | undefined; + +/** + * It returns `true` if `pathToSearch` of `input` object is equal to `target` value. + * + * `pathToSearch` is passed to `R.path`, which means that it can be either a string or an array. Also equality between `target` and the found value is determined by `R.equals`. + */ +export function pathEq(pathToSearch: Path, target: any, input: any): boolean; +export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean; +export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean; + +/** + * It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record)`. + * + * Because it calls `R.path`, then `singlePath` can be either string or a list. + */ +export function paths(pathsToSearch: Path[], obj: Input): (T | undefined)[]; +export function paths(pathsToSearch: Path[]): (obj: Input) => (T | undefined)[]; +export function paths(pathsToSearch: Path[], obj: any): (T | undefined)[]; +export function paths(pathsToSearch: Path[]): (obj: any) => (T | undefined)[]; + +/** + * It reads `obj` input and returns either `R.path(pathToSearch, Record)` result or `defaultValue` input. + */ +export function pathOr(defaultValue: T, pathToSearch: Path, obj: any): T; +export function pathOr(defaultValue: T, pathToSearch: Path): (obj: any) => T; +export function pathOr(defaultValue: T): (pathToSearch: Path) => (obj: any) => T; + +/** + * It returns a partial copy of an `input` containing only `propsToPick` properties. + * + * `input` can be either an object or an array. + * + * String anotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`. + */ +export function pick(propsToPick: K[], input: T): Pick>>; +export function pick(propsToPick: K[]): (input: T) => Pick>>; +export function pick(propsToPick: string, input: T): U; +export function pick(propsToPick: string): (input: T) => U; +export function pick(propsToPick: string, input: object): T; +export function pick(propsToPick: string): (input: object) => T; + +/** + * Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`. + */ +export function pickAll(propsToPick: string[], input: T): U; +export function pickAll(propsToPick: string[]): (input: T) => U; +export function pickAll(propsToPick: string, input: T): U; +export function pickAll(propsToPick: string): (input: T) => U; + +/** + * It performs left-to-right function composition. + */ +export function pipe( + ...funcs: [ + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6, + f7: (a: R6) => R7, + ...func: Array<(a: any) => any>, + fnLast: (a: any) => TResult + ] +): (...args: TArgs) => TResult; // fallback overload if number of piped functions greater than 7 +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6, + f7: (a: R6) => R7 +): (...args: TArgs) => R7; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5, + f6: (a: R5) => R6 +): (...args: TArgs) => R6; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4, + f5: (a: R4) => R5 +): (...args: TArgs) => R5; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3, + f4: (a: R3) => R4 +): (...args: TArgs) => R4; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2, + f3: (a: R2) => R3 +): (...args: TArgs) => R3; +export function pipe( + f1: (...args: TArgs) => R1, + f2: (a: R1) => R2 +): (...args: TArgs) => R2; +export function pipe( + f1: (...args: TArgs) => R1 +): (...args: TArgs) => R1; + +/** + * It returns list of the values of `property` taken from the all objects inside `list`. + */ +export function pluck(property: K, list: T[]): T[K][]; +export function pluck(property: number, list: { [k: number]: T }[]): T[]; +export function pluck

(property: P): (list: Record[]) => T[]; +export function pluck(property: number): (list: { [k: number]: T }[]) => T[]; + +/** + * It adds element `x` at the beginning of `list`. + */ +export function prepend(x: T, input: T[]): T[]; +export function prepend(x: T): (input: T[]) => T[]; + +export function product(list: number[]): number; + +/** + * It returns the value of property `propToFind` in `obj`. + * + * If there is no such property, it returns `undefined`. + */ +export function prop

(propToFind: P, obj: O): O[P]; +export function prop

(propToFind: P): (obj: O) => O[P]; +export function prop

(propToFind: P): (obj: Record) => T; +export function prop

(propToFind: P): (obj: Record) => T; + +/** + * It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`. + */ +export function propEq(propToFind: K, valueToMatch: any, obj: Record): boolean; +export function propEq(propToFind: K, valueToMatch: any): (obj: Record) => boolean; +export function propEq(propToFind: K): { + (valueToMatch: any, obj: Record): boolean; + (valueToMatch: any): (obj: Record) => boolean; +}; + +/** + * It returns `true` if `property` of `obj` is from `target` type. + */ +export function propIs(type: C, name: K, obj: any): obj is Record>; +export function propIs(type: C, name: K, obj: any): obj is Record>; +export function propIs(type: C, name: K): (obj: any) => obj is Record>; +export function propIs(type: C, name: K): (obj: any) => obj is Record>; +export function propIs(type: C): { + (name: K, obj: any): obj is Record>; + (name: K): (obj: any) => obj is Record>; +}; + +/** + * It returns either `defaultValue` or the value of `property` in `obj`. + */ +export function propOr(defaultValue: T, property: P, obj: Partial> | undefined): T; +export function propOr(defaultValue: T, property: P): (obj: Partial> | undefined) => T; +export function propOr(defaultValue: T): { +

(property: P, obj: Partial> | undefined): T; +

(property: P): (obj: Partial> | undefined) => T; +} + +/** + * It returns `true` if the object property satisfies a given predicate. + */ +export function propSatisfies(predicate: Predicate, property: string, obj: Record): boolean; +export function propSatisfies(predicate: Predicate, property: string): (obj: Record) => boolean; + +/** + * It returns list of numbers between `startInclusive` to `endExclusive` markers. + */ +export function range(startInclusive: number, endExclusive: number): number[]; +export function range(startInclusive: number): (endExclusive: number) => number[]; + +export function reduce(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: T[]): TResult; +export function reduce(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: T[]): TResult; +export function reduce(reducer: (prev: TResult, current: T, i?: number) => TResult): (initialValue: TResult, list: T[]) => TResult; +export function reduce(reducer: (prev: TResult, current: T, i?: number) => TResult, initialValue: TResult): (list: T[]) => TResult; + +/** + * It has the opposite effect of `R.filter`. + */ +export function reject(predicate: Predicate, list: T[]): T[]; +export function reject(predicate: Predicate): (list: T[]) => T[]; +export function reject(predicate: Predicate, obj: Dictionary): Dictionary; +export function reject(predicate: Predicate): (obj: Dictionary) => Dictionary; + +export function repeat(x: T): (timesToRepeat: number) => T[]; +export function repeat(x: T, timesToRepeat: number): T[]; + +/** + * It replaces `strOrRegex` found in `str` with `replacer`. + */ +export function replace(strOrRegex: RegExp | string, replacer: string, str: string): string; +export function replace(strOrRegex: RegExp | string, replacer: string): (str: string) => string; +export function replace(strOrRegex: RegExp | string): (replacer: string) => (str: string) => string; + +/** + * It returns a reversed copy of list or string `input`. + */ +export function reverse(input: T[]): T[]; +export function reverse(input: string): string; + +export function slice(from: number, to: number, input: string): string; +export function slice(from: number, to: number, input: T[]): T[]; +export function slice(from: number, to: number): { + (input: string): string; + (input: T[]): T[]; +}; +export function slice(from: number): { + (to: number, input: string): string; + (to: number, input: T[]): T[]; +}; + +/** + * It returns copy of `list` sorted by `sortFn` function, where `sortFn` needs to return only `-1`, `0` or `1`. + */ +export function sort(sortFn: (a: T, b: T) => number, list: T[]): T[]; +export function sort(sortFn: (a: T, b: T) => number): (list: T[]) => T[]; + +/** + * It returns copy of `list` sorted by `sortFn` function, where `sortFn` function returns a value to compare, i.e. it doesn't need to return only `-1`, `0` or `1`. + */ +export function sortBy(sortFn: (a: T) => Ord, list: T[]): T[]; +export function sortBy(sortFn: (a: T) => Ord): (list: T[]) => T[]; +export function sortBy(sortFn: (a: any) => Ord): (list: T[]) => T[]; + +/** + * Curried version of `String.prototype.split` + */ +export function split(separator: string | RegExp): (str: string) => string[]; +export function split(separator: string | RegExp, str: string): string[]; + +/** + * It splits `input` into slices of `sliceLength`. + */ +export function splitEvery(sliceLength: number, input: T[]): (T[])[]; +export function splitEvery(sliceLength: number, input: string): string[]; +export function splitEvery(sliceLength: number): { + (input: string): string[]; + (input: T[]): (T[])[]; +}; + +/** + * When iterable is a string, then it behaves as `String.prototype.startsWith`. + * When iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target. + */ +export function startsWith(target: string, str: string): boolean; +export function startsWith(target: string): (str: string) => boolean; +export function startsWith(target: T[], list: T[]): boolean; +export function startsWith(target: T[]): (list: T[]) => boolean; + +/** + * Curried version of `x - y` + */ +export function subtract(x: number, y: number): number; +export function subtract(x: number): (y: number) => number; + +export function sum(list: number[]): number; + +/** + * It returns a merged list of `x` and `y` with all equal elements removed. + * + * `R.equals` is used to determine equality. + */ +export function symmetricDifference(x: T[], y: T[]): T[]; +export function symmetricDifference(x: T[]): (y: T[]) => T[]; + +export function T(): boolean; + +/** + * It returns all but the first element of `input`. + */ +export function tail(input: T): T extends [any, ...infer U] ? U : [...T]; +export function tail(input: string): string; + +/** + * It returns the first `howMany` elements of `input`. + */ +export function take(howMany: number, input: T[]): T[]; +export function take(howMany: number, input: string): string; +export function take(howMany: number): { + (input: T[]): T[]; + (input: string): string; +}; + +/** + * It returns the last `howMany` elements of `input`. + */ +export function takeLast(howMany: number, input: T[]): T[]; +export function takeLast(howMany: number, input: string): string; +export function takeLast(howMany: number): { + (input: T[]): T[]; + (input: string): string; +}; + +/** + * It applies function `fn` to input `x` and returns `x`. + * + * One use case is debuging in the middle of `R.compose`. + */ +export function tap(fn: (x: T) => void, input: T): T; +export function tap(fn: (x: T) => void): (input: T) => T; + +/** + * It determines whether `str` matches `regExpression`. + */ +export function test(regExpression: RegExp): (str: string) => boolean; +export function test(regExpression: RegExp, str: string): boolean; + +/** + * It returns the result of applying function `fn` over members of range array. + * + * The range array includes numbers between `0` and `howMany`(exclusive). + */ +export function times(fn: (i: number) => T, howMany: number): T[]; +export function times(fn: (i: number) => T): (howMany: number) => T[]; + +export function toLower(str: S): Lowercase; +export function toLower(str: string): string; + +export function toUpper(str: S): Uppercase; +export function toUpper(str: string): string; + +/** + * It transforms an object to a list. + */ +export function toPairs>(obj: O): Array<{ [key in K]: [`${key}`, O[key]] }[K]>; +export function toPairs(obj: Record): Array<[string, S]>; + +export function toString(x: unknown): string; + +export function transpose(list: (T[])[]): (T[])[]; + +export function trim(str: string): string; + +/** + * It returns function that runs `fn` in `try/catch` block. If there was an error, then `fallback` is used to return the result. Note that `fn` can be value or asynchronous/synchronous function(unlike `Ramda` where fallback can only be a synchronous function). + */ +export function tryCatch( + fn: (input: T) => U, + fallback: U +): (input: T) => U; +export function tryCatch( + fn: (input: T) => U, + fallback: (input: T) => U +): (input: T) => U; +export function tryCatch( + fn: (input: any) => Promise, + fallback: T +): (input: any) => Promise; +export function tryCatch( + fn: (input: any) => Promise, + fallback: (input: any) => Promise, +): (input: any) => Promise; + +/** + * It accepts any input and it returns its type. + */ +export function type(x: any): RambdaTypes; + +/** + * It takes two lists and return a new list containing a merger of both list with removed duplicates. + * + * `R.equals` is used to compare for duplication. + */ +export function union(x: T[], y: T[]): T[]; +export function union(x: T[]): (y: T[]) => T[]; + +/** + * It returns a new array containing only one copy of each element of `list`. + * + * `R.equals` is used to determine equality. + */ +export function uniq(list: T[]): T[]; + +/** + * It returns a new array containing only one copy of each element in `list` according to `predicate` function. + * + * This predicate should return true, if two elements are equal. + */ +export function uniqWith(predicate: (x: T, y: T) => boolean, list: T[]): T[]; +export function uniqWith(predicate: (x: T, y: T) => boolean): (list: T[]) => T[]; + +/** + * The method returns function that will be called with argument `input`. + * + * If `predicate(input)` returns `false`, then the end result will be the outcome of `whenFalse(input)`. + * + * In the other case, the final output will be the `input` itself. + */ +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U, x: T): T | U; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U): (x: T) => T | U; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T; +export function unless(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T; + +/** + * It returns a copy of `list` with updated element at `index` with `newValue`. + */ +export function update(index: number, newValue: T, list: T[]): T[]; +export function update(index: number, newValue: T): (list: T[]) => T[]; + +/** + * With correct input, this is nothing more than `Object.values(Record)`. If `obj` is not an object, then it returns an empty array. + */ +export function values(obj: T): T[K][]; + +export function when(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): T | U; +export function when(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U; +export function when(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U); + +/** + * It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object. + */ +export function where(conditions: T, input: U): boolean; +export function where(conditions: T): (input: U) => boolean; +export function where(conditions: ObjFunc2, input: U): boolean; +export function where(conditions: ObjFunc2): (input: U) => boolean; + +/** + * It will return `true` if all of `input` object fully or partially include `rule` object. + * + * `R.equals` is used to determine equality. + */ +export function whereEq(condition: T, input: U): boolean; +export function whereEq(condition: T): (input: U) => boolean; + +/** + * It will return a new array, based on all members of `source` list that are not part of `matchAgainst` list. + * + * `R.equals` is used to determine equality. + */ +export function without(matchAgainst: T[], source: T[]): T[]; +export function without(matchAgainst: T[]): (source: T[]) => T[]; + +/** + * Logical XOR + */ +export function xor(x: boolean, y: boolean): boolean; +export function xor(y: boolean): (y: boolean) => boolean; + +/** + * It will return a new array containing tuples of equally positions items from both `x` and `y` lists. + * + * The returned list will be truncated to match the length of the shortest supplied list. + */ +export function zip(x: K[], y: V[]): KeyValuePair[]; +export function zip(x: K[]): (y: V[]) => KeyValuePair[]; + +/** + * It will return a new object with keys of `keys` array and values of `values` array. + */ +export function zipObj(keys: K[], values: T[]): { [P in K]: T }; +export function zipObj(keys: K[]): (values: T[]) => { [P in K]: T }; +export function zipObj(keys: K[], values: T[]): { [P in K]: T }; +export function zipObj(keys: K[]): (values: T[]) => { [P in K]: T }; + +/** + * It takes list with properties `propsToPick` and returns a list with property values in `obj`. + */ +export function props

(propsToPick: P[], obj: Record): T[]; +export function props

(propsToPick: P[]): (obj: Record) => T[]; +export function props

(propsToPick: P[]): (obj: Record) => T[]; + +export function zipWith(fn: (x: T, y: U) => TResult, list1: T[], list2: U[]): TResult[]; +export function zipWith(fn: (x: T, y: U) => TResult, list1: T[]): (list2: U[]) => TResult[]; +export function zipWith(fn: (x: T, y: U) => TResult): (list1: T[], list2: U[]) => TResult[]; + +/** + * It splits string or array at a given index. + */ +export function splitAt(index: number, input: T[]): [T[], T[]]; +export function splitAt(index: number, input: string): [string, string]; +export function splitAt(index: number): { + (input: T[]): [T[], T[]]; + (input: string): [string, string]; +}; + +/** + * It splits `list` to two arrays according to a `predicate` function. + * + * The first array contains all members of `list` before `predicate` returns `true`. + */ +export function splitWhen(predicate: Predicate, list: U[]): (U[])[]; +export function splitWhen(predicate: Predicate): (list: U[]) => (U[])[]; + +export function takeLastWhile(predicate: (x: string) => boolean, input: string): string; +export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string; +export function takeLastWhile(predicate: (x: T) => boolean, input: T[]): T[]; +export function takeLastWhile(predicate: (x: T) => boolean): (input: T[]) => T[]; + +/** + * It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result. + */ +export function evolve(rules: ((x: T) => U)[], list: T[]): U[]; +export function evolve(rules: ((x: T) => U)[]) : (list: T[]) => U[]; +export function evolve>(rules: E, obj: V): Evolve; +export function evolve(rules: E): >(obj: V) => Evolve; + +export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string; +export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string; +export function dropLastWhile(predicate: (x: T) => boolean, iterable: T[]): T[]; +export function dropLastWhile(predicate: (x: T) => boolean): (iterable: T[]) => T[]; + +/** + * It removes any successive duplicates according to `R.equals`. + */ +export function dropRepeats(list: T[]): T[]; + +export function dropRepeatsWith(predicate: (x: T, y: T) => boolean, list: T[]): T[]; +export function dropRepeatsWith(predicate: (x: T, y: T) => boolean): (list: T[]) => T[]; + +export function dropWhile(fn: Predicate, iterable: string): string; +export function dropWhile(fn: Predicate): (iterable: string) => string; +export function dropWhile(fn: Predicate, iterable: T[]): T[]; +export function dropWhile(fn: Predicate): (iterable: T[]) => T[]; + +export function takeWhile(fn: Predicate, iterable: string): string; +export function takeWhile(fn: Predicate): (iterable: string) => string; +export function takeWhile(fn: Predicate, iterable: T[]): T[]; +export function takeWhile(fn: Predicate): (iterable: T[]) => T[]; + +/** + * It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`. + */ +export function eqProps(prop: string, obj1: T, obj2: U): boolean; +export function eqProps

(prop: P): (obj1: Record, obj2: Record) => boolean; +export function eqProps(prop: string, obj1: T): (obj2: U) => boolean; + +/** + * It calls a function `fn` with the list of values of the returned function. + * + * `R.unapply` is the opposite of `R.apply` method. + */ +export function unapply(fn: (args: any[]) => T): (...args: any[]) => T; + +/** + * It applies function `fn` to the list of arguments. + * + * This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant. + */ +export function apply(fn: (...args: any[]) => T, args: any[]): T; +export function apply(fn: (...args: any[]) => T): (args: any[]) => T; + +/** + * Creates a function that is bound to a context. + */ +export function bind(fn: F, thisObj: T): (...args: Parameters) => ReturnType; +export function bind(fn: F): (thisObj: T) => (...args: Parameters) => ReturnType; + +/** + * It takes two objects and a function, which will be used when there is an overlap between the keys. + */ +export function mergeWith(fn: (x: any, z: any) => any, a: Record, b: Record): Record; +export function mergeWith(fn: (x: any, z: any) => any, a: Record, b: Record): Output; +export function mergeWith(fn: (x: any, z: any) => any, a: Record): (b: Record) => Record; +export function mergeWith(fn: (x: any, z: any) => any, a: Record): (b: Record) => Output; +export function mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => Record; +export function mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => Output; + +/** + * It applies list of function to a list of inputs. + */ +export function juxt(fns: [(...a: A) => R1]): (...a: A) => [R1]; +export function juxt(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2]; +export function juxt(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3]; +export function juxt(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4]; +export function juxt(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5]; +export function juxt(fns: Array<(...args: A) => U>): (...args: A) => U[]; + +/** + * It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`. + */ +export function count(predicate: (x: T) => boolean, list: T[]): number; +export function count(predicate: (x: T) => boolean): (list: T[]) => number; + +/** + * It counts elements in a list after each instance of the input list is passed through `transformFn` function. + */ +export function countBy(transformFn: (x: T) => any, list: T[]): Record; +export function countBy(transformFn: (x: T) => any): (list: T[]) => Record; + +export function unwind(prop: keyof T, obj: T): U[]; +export function unwind(prop: keyof T): (obj: T) => U[]; + +/** + * It passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`). + * + * This method is also known as P combinator. + */ +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R; +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R; +export function on(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): { + (a: T, b: T): R; + (a: T): (b: T) => R; +}; + +/** + * Same as `R.where`, but it will return `true` if at least one condition check returns `true`. + */ +export function whereAny(conditions: T, input: U): boolean; +export function whereAny(conditions: T): (input: U) => boolean; +export function whereAny(conditions: ObjFunc2, input: U): boolean; +export function whereAny(conditions: ObjFunc2): (input: U) => boolean; + +/** + * `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument. + * + * Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input. + */ +export function partialObject( + fn: (input: Input) => Output, + partialInput: PartialInput, +): (input: Pick>) => Output; + +export function uniqBy(fn: (a: T) => U, list: T[]): T[]; +export function uniqBy(fn: (a: T) => U): (list: T[]) => T[]; + +/** + * It changes a property of object on the base of provided path and transformer function. + */ +export function modifyPath>(path: Path, fn: (x: any) => unknown, object: Record): T; +export function modifyPath>(path: Path, fn: (x: any) => unknown): (object: Record) => T; +export function modifyPath>(path: Path): (fn: (x: any) => unknown) => (object: Record) => T; + +export function modify( + prop: K, + fn: (a: T[K]) => P, + obj: T, +): Omit & Record; +export function modify( + prop: K, + fn: (a: A) => P, +): >(target: T) => Omit & Record; diff --git a/src/lib/node_modules/rambda/package.json b/src/lib/node_modules/rambda/package.json new file mode 100644 index 0000000..e06327a --- /dev/null +++ b/src/lib/node_modules/rambda/package.json @@ -0,0 +1,128 @@ +{ + "name": "rambda", + "version": "7.3.0", + "scripts": { + "publishx": "node files/publish", + "populatedocs": "cd ../rambda-scripts && yarn populate:docs", + "populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax", + "populatereadme": "cd ../rambda-scripts && yarn populate:readme", + "populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax", + "out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build", + "pull": "cd ../rambda-scripts && git pull", + "outx": "yarn pull && yarn out", + "x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x", + "github": "cd ../rambda-scripts && yarn github", + "fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda", + "immutable": "cd ../rambda-scripts && yarn immutable:rambda", + "immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax", + "usedby": "cd ../rambda-scripts && yarn usedby", + "lint:all": "cd ../rambda-scripts && yarn lint", + "lint:staged": "cd ../rambda-scripts && yarn lint:staged", + "lint": "yarn git:add && yarn lint:staged && yarn git:add", + "git:add": "git add -A", + "build": "yarn build:main && yarn build:web", + "build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js", + "build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js", + "docs": "npx docsify-cli init ./docs && yarn fix-docsify", + "new": "cd ../rambda-scripts && yarn new", + "run:ramda:test": "cd ../rambda-scripts && yarn run:ramda:test", + "consume-typings:clone": "cd .. && git clone --depth 1 https://github.com/selfrefactor/rambda-scripts.git rambda-scripts-clone", + "consume-typings:execute": "cd ../rambda-scripts-clone/scripts/consume-typings && yarn start", + "consume-typings": "yarn consume-typings:clone && yarn consume-typings:execute", + "test:consume-typings": "jest source/_consumeTypings.test.js", + "test:typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source", + "test:all": "jest source/*.spec.js -u --bail=false", + "test": "jest -o -u --watch", + "test:ci": "jest source/*.spec.js --coverage --no-cache -w 1", + "build:step": "yarn populatedocs && yarn populatereadme && yarn build:main", + "benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all", + "benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply", + "benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark", + "benchmark": "cd ../rambda-scripts && RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark", + "d:rambda-scripts": "cd ../rambda-scripts && run d", + "d": "yarn out && yarn lint && run d && yarn d:rambda-scripts" + }, + "dependencies": {}, + "devDependencies": { + "@babel/core": "7.18.9", + "@babel/plugin-proposal-object-rest-spread": "7.18.9", + "@babel/preset-env": "7.18.9", + "@rollup/plugin-babel": "5.3.1", + "@rollup/plugin-commonjs": "22.0.1", + "@rollup/plugin-json": "4.1.0", + "@rollup/plugin-node-resolve": "13.3.0", + "@rollup/plugin-replace": "4.0.0", + "@types/jest": "28.1.6", + "@types/ramda": "0.28.15", + "combinate": "1.1.11", + "cross-env": "7.0.3", + "dtslint": "4.2.1", + "helpers-fn": "1.6.0", + "is-ci": "3.0.1", + "jest": "28.1.3", + "jest-extended": "3.0.1", + "lodash": "4.17.21", + "rambdax": "8.0.1", + "ramda": "0.28.0", + "rollup": "2.77.2", + "rollup-plugin-cleanup": "3.2.1", + "rollup-plugin-sourcemaps": "0.6.3", + "rollup-plugin-uglify": "6.0.4", + "typescript": "4.7.4" + }, + "jest": { + "testEnvironment": "node", + "testRegex": ".*\\.(spec|test)\\.js$", + "setupFilesAfterEnv": [ + "./files/testSetup.js" + ], + "collectCoverageFrom": [ + "source/*.js", + "!_internals", + "!benchmarks" + ] + }, + "files": [ + "dist", + "src", + "README.md", + "CHANGELOG.md", + "index.d.ts", + "immutable.d.ts", + "immutable.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/selfrefactor/rambda.git" + }, + "license": "MIT", + "author": "self_refactor", + "description": "Lightweight and faster alternative to Ramda with included TS definitions", + "sideEffects": false, + "main": "./dist/rambda.js", + "umd": "./dist/rambda.umd.js", + "module": "./dist/rambda.mjs", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./dist/rambda.mjs", + "require": "./dist/rambda.js", + "default": "./dist/rambda.js", + "types": "./index.d.ts" + }, + "./immutable": { + "import": "./immutable.js", + "require": "./immutable.js", + "default": "./immutable.js", + "types": "./immutable.d.ts" + } + }, + "keywords": [ + "ramda", + "fp", + "functional", + "utility", + "lodash" + ], + "homepage": "https://github.com/selfrefactor/rambda#readme" +} diff --git a/src/lib/node_modules/rambda/src/F.js b/src/lib/node_modules/rambda/src/F.js new file mode 100644 index 0000000..95033a2 --- /dev/null +++ b/src/lib/node_modules/rambda/src/F.js @@ -0,0 +1,3 @@ +export function F(){ + return false +} diff --git a/src/lib/node_modules/rambda/src/T.js b/src/lib/node_modules/rambda/src/T.js new file mode 100644 index 0000000..d616259 --- /dev/null +++ b/src/lib/node_modules/rambda/src/T.js @@ -0,0 +1,3 @@ +export function T(){ + return true +} diff --git a/src/lib/node_modules/rambda/src/_internals/baseSlice.js b/src/lib/node_modules/rambda/src/_internals/baseSlice.js new file mode 100644 index 0000000..3d35186 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/baseSlice.js @@ -0,0 +1,21 @@ +export default function baseSlice( + array, start, end +){ + let index = -1 + let { length } = array + + end = end > length ? length : end + if (end < 0){ + end += length + } + length = start > end ? 0 : end - start >>> 0 + start >>>= 0 + + const result = Array(length) + + while (++index < length){ + result[ index ] = array[ index + start ] + } + + return result +} diff --git a/src/lib/node_modules/rambda/src/_internals/cloneList.js b/src/lib/node_modules/rambda/src/_internals/cloneList.js new file mode 100644 index 0000000..9fd50c1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/cloneList.js @@ -0,0 +1 @@ +export const cloneList = list => Array.prototype.slice.call(list) diff --git a/src/lib/node_modules/rambda/src/_internals/constants.js b/src/lib/node_modules/rambda/src/_internals/constants.js new file mode 100644 index 0000000..a482b9b --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/constants.js @@ -0,0 +1 @@ +export const INCORRECT_ITERABLE_INPUT = 'Incorrect iterable input' diff --git a/src/lib/node_modules/rambda/src/_internals/createPath.js b/src/lib/node_modules/rambda/src/_internals/createPath.js new file mode 100644 index 0000000..bbe284e --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/createPath.js @@ -0,0 +1,3 @@ +export function createPath(path, delimiter = '.'){ + return typeof path === 'string' ? path.split(delimiter) : path +} diff --git a/src/lib/node_modules/rambda/src/_internals/isArray.js b/src/lib/node_modules/rambda/src/_internals/isArray.js new file mode 100644 index 0000000..3ec44e0 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isArray.js @@ -0,0 +1 @@ +export const { isArray } = Array diff --git a/src/lib/node_modules/rambda/src/_internals/isFalsy.js b/src/lib/node_modules/rambda/src/_internals/isFalsy.js new file mode 100644 index 0000000..646dbc2 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isFalsy.js @@ -0,0 +1,13 @@ +import { type } from '../type.js' +import { isArray } from './isArray.js' + +export function isFalsy(x){ + if (isArray(x)){ + return x.length === 0 + } + if (type(x) === 'Object'){ + return Object.keys(x).length === 0 + } + + return !x +} diff --git a/src/lib/node_modules/rambda/src/_internals/isInteger.js b/src/lib/node_modules/rambda/src/_internals/isInteger.js new file mode 100644 index 0000000..bcee10a --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isInteger.js @@ -0,0 +1,5 @@ +function _isInteger(n){ + return n << 0 === n +} + +export const isInteger = Number.isInteger || _isInteger diff --git a/src/lib/node_modules/rambda/src/_internals/isIterable.js b/src/lib/node_modules/rambda/src/_internals/isIterable.js new file mode 100644 index 0000000..94f8a1a --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isIterable.js @@ -0,0 +1,5 @@ +import { type } from '../type.js' + +export function isIterable(input){ + return Array.isArray(input) || type(input) === 'Object' +} diff --git a/src/lib/node_modules/rambda/src/_internals/isObject.js b/src/lib/node_modules/rambda/src/_internals/isObject.js new file mode 100644 index 0000000..720e37e --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isObject.js @@ -0,0 +1,5 @@ +import { type } from '../type.js' + +export function isObject(input){ + return type(input) === 'Object' +} diff --git a/src/lib/node_modules/rambda/src/_internals/isTruthy.js b/src/lib/node_modules/rambda/src/_internals/isTruthy.js new file mode 100644 index 0000000..f87d0fd --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/isTruthy.js @@ -0,0 +1,13 @@ +import { type } from '../type.js' +import { isArray } from './isArray.js' + +export function isTruthy(x){ + if (isArray(x)){ + return x.length > 0 + } + if (type(x) === 'Object'){ + return Object.keys(x).length > 0 + } + + return Boolean(x) +} diff --git a/src/lib/node_modules/rambda/src/_internals/keys.js b/src/lib/node_modules/rambda/src/_internals/keys.js new file mode 100644 index 0000000..050171e --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/keys.js @@ -0,0 +1 @@ +export const { keys } = Object diff --git a/src/lib/node_modules/rambda/src/_internals/objectIs.js b/src/lib/node_modules/rambda/src/_internals/objectIs.js new file mode 100644 index 0000000..4fcaff6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/objectIs.js @@ -0,0 +1,9 @@ +function _objectIs(a, b){ + if (a === b){ + return a !== 0 || 1 / a === 1 / b + } + + return a !== a && b !== b +} + +export const objectIs = Object.is || _objectIs diff --git a/src/lib/node_modules/rambda/src/_internals/set.js b/src/lib/node_modules/rambda/src/_internals/set.js new file mode 100644 index 0000000..1327915 --- /dev/null +++ b/src/lib/node_modules/rambda/src/_internals/set.js @@ -0,0 +1,41 @@ +import { _indexOf } from '../equals.js' +import { type as typeMethod } from '../type.js' + +export class _Set{ + constructor(){ + this.set = new Set() + this.items = {} + } + + checkUniqueness(item){ + const type = typeMethod(item) + if ([ 'Null', 'Undefined', 'NaN' ].includes(type)){ + if (type in this.items){ + return false + } + this.items[ type ] = true + + return true + } + if (![ 'Object', 'Array' ].includes(type)){ + const prevSize = this.set.size + this.set.add(item) + + return this.set.size !== prevSize + } + + if (!(type in this.items)){ + this.items[ type ] = [ item ] + + return true + } + + if (_indexOf(item, this.items[ type ]) === -1){ + this.items[ type ].push(item) + + return true + } + + return false + } +} diff --git a/src/lib/node_modules/rambda/src/add.js b/src/lib/node_modules/rambda/src/add.js new file mode 100644 index 0000000..c5bca38 --- /dev/null +++ b/src/lib/node_modules/rambda/src/add.js @@ -0,0 +1,5 @@ +export function add(a, b){ + if (arguments.length === 1) return _b => add(a, _b) + + return Number(a) + Number(b) +} diff --git a/src/lib/node_modules/rambda/src/adjust.js b/src/lib/node_modules/rambda/src/adjust.js new file mode 100644 index 0000000..f41a72d --- /dev/null +++ b/src/lib/node_modules/rambda/src/adjust.js @@ -0,0 +1,16 @@ +import { cloneList } from './_internals/cloneList.js' +import { curry } from './curry.js' + +function adjustFn( + index, replaceFn, list +){ + const actualIndex = index < 0 ? list.length + index : index + if (index >= list.length || actualIndex < 0) return list + + const clone = cloneList(list) + clone[ actualIndex ] = replaceFn(clone[ actualIndex ]) + + return clone +} + +export const adjust = curry(adjustFn) diff --git a/src/lib/node_modules/rambda/src/all.js b/src/lib/node_modules/rambda/src/all.js new file mode 100644 index 0000000..eb13bbe --- /dev/null +++ b/src/lib/node_modules/rambda/src/all.js @@ -0,0 +1,9 @@ +export function all(predicate, list){ + if (arguments.length === 1) return _list => all(predicate, _list) + + for (let i = 0; i < list.length; i++){ + if (!predicate(list[ i ])) return false + } + + return true +} diff --git a/src/lib/node_modules/rambda/src/allPass.js b/src/lib/node_modules/rambda/src/allPass.js new file mode 100644 index 0000000..86ca493 --- /dev/null +++ b/src/lib/node_modules/rambda/src/allPass.js @@ -0,0 +1,13 @@ +export function allPass(predicates){ + return (...input) => { + let counter = 0 + while (counter < predicates.length){ + if (!predicates[ counter ](...input)){ + return false + } + counter++ + } + + return true + } +} diff --git a/src/lib/node_modules/rambda/src/always.js b/src/lib/node_modules/rambda/src/always.js new file mode 100644 index 0000000..afca99c --- /dev/null +++ b/src/lib/node_modules/rambda/src/always.js @@ -0,0 +1,3 @@ +export function always(x){ + return _ => x +} diff --git a/src/lib/node_modules/rambda/src/and.js b/src/lib/node_modules/rambda/src/and.js new file mode 100644 index 0000000..ab40409 --- /dev/null +++ b/src/lib/node_modules/rambda/src/and.js @@ -0,0 +1,5 @@ +export function and(a, b){ + if (arguments.length === 1) return _b => and(a, _b) + + return a && b +} diff --git a/src/lib/node_modules/rambda/src/any.js b/src/lib/node_modules/rambda/src/any.js new file mode 100644 index 0000000..5aa2c0f --- /dev/null +++ b/src/lib/node_modules/rambda/src/any.js @@ -0,0 +1,13 @@ +export function any(predicate, list){ + if (arguments.length === 1) return _list => any(predicate, _list) + + let counter = 0 + while (counter < list.length){ + if (predicate(list[ counter ], counter)){ + return true + } + counter++ + } + + return false +} diff --git a/src/lib/node_modules/rambda/src/anyPass.js b/src/lib/node_modules/rambda/src/anyPass.js new file mode 100644 index 0000000..0fae01e --- /dev/null +++ b/src/lib/node_modules/rambda/src/anyPass.js @@ -0,0 +1,13 @@ +export function anyPass(predicates){ + return (...input) => { + let counter = 0 + while (counter < predicates.length){ + if (predicates[ counter ](...input)){ + return true + } + counter++ + } + + return false + } +} diff --git a/src/lib/node_modules/rambda/src/append.js b/src/lib/node_modules/rambda/src/append.js new file mode 100644 index 0000000..500fd52 --- /dev/null +++ b/src/lib/node_modules/rambda/src/append.js @@ -0,0 +1,12 @@ +import { cloneList } from './_internals/cloneList.js' + +export function append(x, input){ + if (arguments.length === 1) return _input => append(x, _input) + + if (typeof input === 'string') return input.split('').concat(x) + + const clone = cloneList(input) + clone.push(x) + + return clone +} diff --git a/src/lib/node_modules/rambda/src/apply.js b/src/lib/node_modules/rambda/src/apply.js new file mode 100644 index 0000000..291a66a --- /dev/null +++ b/src/lib/node_modules/rambda/src/apply.js @@ -0,0 +1,7 @@ +export function apply(fn, args){ + if (arguments.length === 1){ + return _args => apply(fn, _args) + } + + return fn.apply(this, args) +} diff --git a/src/lib/node_modules/rambda/src/applySpec.js b/src/lib/node_modules/rambda/src/applySpec.js new file mode 100644 index 0000000..a453ed5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/applySpec.js @@ -0,0 +1,132 @@ +import { isArray } from './_internals/isArray.js' + +// recursively traverse the given spec object to find the highest arity function +export function __findHighestArity(spec, max = 0){ + for (const key in spec){ + if (spec.hasOwnProperty(key) === false || key === 'constructor') continue + + if (typeof spec[ key ] === 'object'){ + max = Math.max(max, __findHighestArity(spec[ key ])) + } + + if (typeof spec[ key ] === 'function'){ + max = Math.max(max, spec[ key ].length) + } + } + + return max +} + +function __filterUndefined(){ + const defined = [] + let i = 0 + const l = arguments.length + while (i < l){ + if (typeof arguments[ i ] === 'undefined') break + defined[ i ] = arguments[ i ] + i++ + } + + return defined +} + +function __applySpecWithArity( + spec, arity, cache +){ + const remaining = arity - cache.length + + if (remaining === 1) + return x => + __applySpecWithArity( + spec, arity, __filterUndefined(...cache, x) + ) + if (remaining === 2) + return (x, y) => + __applySpecWithArity( + spec, arity, __filterUndefined( + ...cache, x, y + ) + ) + if (remaining === 3) + return ( + x, y, z + ) => + __applySpecWithArity( + spec, arity, __filterUndefined( + ...cache, x, y, z + ) + ) + if (remaining === 4) + return ( + x, y, z, a + ) => + __applySpecWithArity( + spec, + arity, + __filterUndefined( + ...cache, x, y, z, a + ) + ) + if (remaining > 4) + return (...args) => + __applySpecWithArity( + spec, arity, __filterUndefined(...cache, ...args) + ) + + // handle spec as Array + if (isArray(spec)){ + const ret = [] + let i = 0 + const l = spec.length + for (; i < l; i++){ + // handle recursive spec inside array + if (typeof spec[ i ] === 'object' || isArray(spec[ i ])){ + ret[ i ] = __applySpecWithArity( + spec[ i ], arity, cache + ) + } + // apply spec to the key + if (typeof spec[ i ] === 'function'){ + ret[ i ] = spec[ i ](...cache) + } + } + + return ret + } + + // handle spec as Object + const ret = {} + // apply callbacks to each property in the spec object + for (const key in spec){ + if (spec.hasOwnProperty(key) === false || key === 'constructor') continue + + // apply the spec recursively + if (typeof spec[ key ] === 'object'){ + ret[ key ] = __applySpecWithArity( + spec[ key ], arity, cache + ) + continue + } + + // apply spec to the key + if (typeof spec[ key ] === 'function'){ + ret[ key ] = spec[ key ](...cache) + } + } + + return ret +} + +export function applySpec(spec, ...args){ + // get the highest arity spec function, cache the result and pass to __applySpecWithArity + const arity = __findHighestArity(spec) + + if (arity === 0){ + return () => ({}) + } + const toReturn = __applySpecWithArity( + spec, arity, args + ) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/assoc.js b/src/lib/node_modules/rambda/src/assoc.js new file mode 100644 index 0000000..ec095dc --- /dev/null +++ b/src/lib/node_modules/rambda/src/assoc.js @@ -0,0 +1,11 @@ +import { curry } from './curry.js' + +function assocFn( + prop, newValue, obj +){ + return Object.assign( + {}, obj, { [ prop ] : newValue } + ) +} + +export const assoc = curry(assocFn) diff --git a/src/lib/node_modules/rambda/src/assocPath.js b/src/lib/node_modules/rambda/src/assocPath.js new file mode 100644 index 0000000..68a8ba4 --- /dev/null +++ b/src/lib/node_modules/rambda/src/assocPath.js @@ -0,0 +1,50 @@ +import { cloneList } from './_internals/cloneList.js' +import { isArray } from './_internals/isArray.js' +import { isInteger } from './_internals/isInteger.js' +import { assoc } from './assoc.js' +import { curry } from './curry.js' + +function assocPathFn( + path, newValue, input +){ + const pathArrValue = + typeof path === 'string' ? + path.split('.').map(x => isInteger(Number(x)) ? Number(x) : x) : + path + if (pathArrValue.length === 0){ + return newValue + } + + const index = pathArrValue[ 0 ] + if (pathArrValue.length > 1){ + const condition = + typeof input !== 'object' || + input === null || + !input.hasOwnProperty(index) + + const nextInput = condition ? + isInteger(pathArrValue[ 1 ]) ? + [] : + {} : + input[ index ] + + newValue = assocPathFn( + Array.prototype.slice.call(pathArrValue, 1), + newValue, + nextInput + ) + } + + if (isInteger(index) && isArray(input)){ + const arr = cloneList(input) + arr[ index ] = newValue + + return arr + } + + return assoc( + index, newValue, input + ) +} + +export const assocPath = curry(assocPathFn) diff --git a/src/lib/node_modules/rambda/src/bind.js b/src/lib/node_modules/rambda/src/bind.js new file mode 100644 index 0000000..16d1d01 --- /dev/null +++ b/src/lib/node_modules/rambda/src/bind.js @@ -0,0 +1,9 @@ +import { curryN } from './curryN.js' + +export function bind(fn, thisObj){ + if (arguments.length === 1){ + return _thisObj => bind(fn, _thisObj) + } + + return curryN(fn.length, (...args) => fn.apply(thisObj, args)) +} diff --git a/src/lib/node_modules/rambda/src/both.js b/src/lib/node_modules/rambda/src/both.js new file mode 100644 index 0000000..b78269c --- /dev/null +++ b/src/lib/node_modules/rambda/src/both.js @@ -0,0 +1,5 @@ +export function both(f, g){ + if (arguments.length === 1) return _g => both(f, _g) + + return (...input) => f(...input) && g(...input) +} diff --git a/src/lib/node_modules/rambda/src/chain.js b/src/lib/node_modules/rambda/src/chain.js new file mode 100644 index 0000000..11cb030 --- /dev/null +++ b/src/lib/node_modules/rambda/src/chain.js @@ -0,0 +1,7 @@ +export function chain(fn, list){ + if (arguments.length === 1){ + return _list => chain(fn, _list) + } + + return [].concat(...list.map(fn)) +} diff --git a/src/lib/node_modules/rambda/src/clamp.js b/src/lib/node_modules/rambda/src/clamp.js new file mode 100644 index 0000000..8bed360 --- /dev/null +++ b/src/lib/node_modules/rambda/src/clamp.js @@ -0,0 +1,15 @@ +import { curry } from './curry.js' + +function clampFn( + min, max, input +){ + if (min > max){ + throw new Error('min must not be greater than max in clamp(min, max, value)') + } + if (input >= min && input <= max) return input + + if (input > max) return max + if (input < min) return min +} + +export const clamp = curry(clampFn) diff --git a/src/lib/node_modules/rambda/src/clone.js b/src/lib/node_modules/rambda/src/clone.js new file mode 100644 index 0000000..3915f3b --- /dev/null +++ b/src/lib/node_modules/rambda/src/clone.js @@ -0,0 +1,18 @@ +import { isArray } from './_internals/isArray.js' + +export function clone(input){ + const out = isArray(input) ? Array(input.length) : {} + if (input && input.getTime) return new Date(input.getTime()) + + for (const key in input){ + const v = input[ key ] + out[ key ] = + typeof v === 'object' && v !== null ? + v.getTime ? + new Date(v.getTime()) : + clone(v) : + v + } + + return out +} diff --git a/src/lib/node_modules/rambda/src/complement.js b/src/lib/node_modules/rambda/src/complement.js new file mode 100644 index 0000000..bf1b99d --- /dev/null +++ b/src/lib/node_modules/rambda/src/complement.js @@ -0,0 +1,3 @@ +export function complement(fn){ + return (...input) => !fn(...input) +} diff --git a/src/lib/node_modules/rambda/src/compose.js b/src/lib/node_modules/rambda/src/compose.js new file mode 100644 index 0000000..98ef387 --- /dev/null +++ b/src/lib/node_modules/rambda/src/compose.js @@ -0,0 +1,9 @@ +import { pipe } from './pipe.js' + +export function compose(){ + if (arguments.length === 0){ + throw new Error('compose requires at least one argument') + } + + return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse()) +} diff --git a/src/lib/node_modules/rambda/src/concat.js b/src/lib/node_modules/rambda/src/concat.js new file mode 100644 index 0000000..cf0b61f --- /dev/null +++ b/src/lib/node_modules/rambda/src/concat.js @@ -0,0 +1,5 @@ +export function concat(x, y){ + if (arguments.length === 1) return _y => concat(x, _y) + + return typeof x === 'string' ? `${ x }${ y }` : [ ...x, ...y ] +} diff --git a/src/lib/node_modules/rambda/src/cond.js b/src/lib/node_modules/rambda/src/cond.js new file mode 100644 index 0000000..16d5115 --- /dev/null +++ b/src/lib/node_modules/rambda/src/cond.js @@ -0,0 +1,14 @@ +export function cond(conditions){ + return input => { + let done = false + let toReturn + conditions.forEach(([ predicate, resultClosure ]) => { + if (!done && predicate(input)){ + done = true + toReturn = resultClosure(input) + } + }) + + return toReturn + } +} diff --git a/src/lib/node_modules/rambda/src/converge.js b/src/lib/node_modules/rambda/src/converge.js new file mode 100644 index 0000000..45db6d1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/converge.js @@ -0,0 +1,18 @@ +import { curryN } from './curryN.js' +import { map } from './map.js' +import { max } from './max.js' +import { reduce } from './reduce.js' + +export function converge(fn, transformers){ + if (arguments.length === 1) + return _transformers => converge(fn, _transformers) + + const highestArity = reduce( + (a, b) => max(a, b.length), 0, transformers + ) + + return curryN(highestArity, function (){ + return fn.apply(this, + map(g => g.apply(this, arguments), transformers)) + }) +} diff --git a/src/lib/node_modules/rambda/src/count.js b/src/lib/node_modules/rambda/src/count.js new file mode 100644 index 0000000..c4f6e26 --- /dev/null +++ b/src/lib/node_modules/rambda/src/count.js @@ -0,0 +1,10 @@ +import { isArray } from './_internals/isArray.js' + +export function count(predicate, list){ + if (arguments.length === 1){ + return _list => count(predicate, _list) + } + if (!isArray(list)) return 0 + + return list.filter(x => predicate(x)).length +} diff --git a/src/lib/node_modules/rambda/src/countBy.js b/src/lib/node_modules/rambda/src/countBy.js new file mode 100644 index 0000000..87a9896 --- /dev/null +++ b/src/lib/node_modules/rambda/src/countBy.js @@ -0,0 +1,17 @@ +export function countBy(fn, list){ + if (arguments.length === 1){ + return _list => countBy(fn, _list) + } + const willReturn = {} + + list.forEach(item => { + const key = fn(item) + if (!willReturn[ key ]){ + willReturn[ key ] = 1 + } else { + willReturn[ key ]++ + } + }) + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/curry.js b/src/lib/node_modules/rambda/src/curry.js new file mode 100644 index 0000000..2c4cb49 --- /dev/null +++ b/src/lib/node_modules/rambda/src/curry.js @@ -0,0 +1,7 @@ +export function curry(fn, args = []){ + return (..._args) => + (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([ + ...args, + ..._args, + ]) +} diff --git a/src/lib/node_modules/rambda/src/curryN.js b/src/lib/node_modules/rambda/src/curryN.js new file mode 100644 index 0000000..d04c750 --- /dev/null +++ b/src/lib/node_modules/rambda/src/curryN.js @@ -0,0 +1,103 @@ +function _curryN( + n, cache, fn +){ + return function (){ + let ci = 0 + let ai = 0 + const cl = cache.length + const al = arguments.length + const args = new Array(cl + al) + while (ci < cl){ + args[ ci ] = cache[ ci ] + ci++ + } + while (ai < al){ + args[ cl + ai ] = arguments[ ai ] + ai++ + } + const remaining = n - args.length + + return args.length >= n ? + fn.apply(this, args) : + _arity(remaining, _curryN( + n, args, fn + )) + } +} + +function _arity(n, fn){ + switch (n){ + case 0: + return function (){ + return fn.apply(this, arguments) + } + case 1: + return function (_1){ + return fn.apply(this, arguments) + } + case 2: + return function (_1, _2){ + return fn.apply(this, arguments) + } + case 3: + return function ( + _1, _2, _3 + ){ + return fn.apply(this, arguments) + } + case 4: + return function ( + _1, _2, _3, _4 + ){ + return fn.apply(this, arguments) + } + case 5: + return function ( + _1, _2, _3, _4, _5 + ){ + return fn.apply(this, arguments) + } + case 6: + return function ( + _1, _2, _3, _4, _5, _6 + ){ + return fn.apply(this, arguments) + } + case 7: + return function ( + _1, _2, _3, _4, _5, _6, _7 + ){ + return fn.apply(this, arguments) + } + case 8: + return function ( + _1, _2, _3, _4, _5, _6, _7, _8 + ){ + return fn.apply(this, arguments) + } + case 9: + return function ( + _1, _2, _3, _4, _5, _6, _7, _8, _9 + ){ + return fn.apply(this, arguments) + } + default: + return function ( + _1, _2, _3, _4, _5, _6, _7, _8, _9, _10 + ){ + return fn.apply(this, arguments) + } + } +} + +export function curryN(n, fn){ + if (arguments.length === 1) return _fn => curryN(n, _fn) + + if (n > 10){ + throw new Error('First argument to _arity must be a non-negative integer no greater than ten') + } + + return _arity(n, _curryN( + n, [], fn + )) +} diff --git a/src/lib/node_modules/rambda/src/dec.js b/src/lib/node_modules/rambda/src/dec.js new file mode 100644 index 0000000..c2e554c --- /dev/null +++ b/src/lib/node_modules/rambda/src/dec.js @@ -0,0 +1 @@ +export const dec = x => x - 1 diff --git a/src/lib/node_modules/rambda/src/defaultTo.js b/src/lib/node_modules/rambda/src/defaultTo.js new file mode 100644 index 0000000..f5f2b7a --- /dev/null +++ b/src/lib/node_modules/rambda/src/defaultTo.js @@ -0,0 +1,13 @@ +function isFalsy(input){ + return ( + input === undefined || input === null || Number.isNaN(input) === true + ) +} + +export function defaultTo(defaultArgument, input){ + if (arguments.length === 1){ + return _input => defaultTo(defaultArgument, _input) + } + + return isFalsy(input) ? defaultArgument : input +} diff --git a/src/lib/node_modules/rambda/src/difference.js b/src/lib/node_modules/rambda/src/difference.js new file mode 100644 index 0000000..f195349 --- /dev/null +++ b/src/lib/node_modules/rambda/src/difference.js @@ -0,0 +1,8 @@ +import { includes } from './includes.js' +import { uniq } from './uniq.js' + +export function difference(a, b){ + if (arguments.length === 1) return _b => difference(a, _b) + + return uniq(a).filter(aInstance => !includes(aInstance, b)) +} diff --git a/src/lib/node_modules/rambda/src/dissoc.js b/src/lib/node_modules/rambda/src/dissoc.js new file mode 100644 index 0000000..beb09f6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/dissoc.js @@ -0,0 +1,13 @@ +export function dissoc(prop, obj){ + if (arguments.length === 1) return _obj => dissoc(prop, _obj) + + if (obj === null || obj === undefined) return {} + + const willReturn = {} + for (const p in obj){ + willReturn[ p ] = obj[ p ] + } + delete willReturn[ prop ] + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/divide.js b/src/lib/node_modules/rambda/src/divide.js new file mode 100644 index 0000000..d1a31c3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/divide.js @@ -0,0 +1,5 @@ +export function divide(a, b){ + if (arguments.length === 1) return _b => divide(a, _b) + + return a / b +} diff --git a/src/lib/node_modules/rambda/src/drop.js b/src/lib/node_modules/rambda/src/drop.js new file mode 100644 index 0000000..a3aad47 --- /dev/null +++ b/src/lib/node_modules/rambda/src/drop.js @@ -0,0 +1,5 @@ +export function drop(howManyToDrop, listOrString){ + if (arguments.length === 1) return _list => drop(howManyToDrop, _list) + + return listOrString.slice(howManyToDrop > 0 ? howManyToDrop : 0) +} diff --git a/src/lib/node_modules/rambda/src/dropLast.js b/src/lib/node_modules/rambda/src/dropLast.js new file mode 100644 index 0000000..b1004f3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/dropLast.js @@ -0,0 +1,9 @@ +export function dropLast(howManyToDrop, listOrString){ + if (arguments.length === 1){ + return _listOrString => dropLast(howManyToDrop, _listOrString) + } + + return howManyToDrop > 0 ? + listOrString.slice(0, -howManyToDrop) : + listOrString.slice() +} diff --git a/src/lib/node_modules/rambda/src/dropLastWhile.js b/src/lib/node_modules/rambda/src/dropLastWhile.js new file mode 100644 index 0000000..de3669f --- /dev/null +++ b/src/lib/node_modules/rambda/src/dropLastWhile.js @@ -0,0 +1,32 @@ +import { isArray as isArrayMethod } from './_internals/isArray.js' + +export function dropLastWhile(predicate, iterable){ + if (arguments.length === 1){ + return _iterable => dropLastWhile(predicate, _iterable) + } + if (iterable.length === 0) return iterable + const isArray = isArrayMethod(iterable) + + if (typeof predicate !== 'function'){ + throw new Error(`'predicate' is from wrong type ${ typeof predicate }`) + } + if (!isArray && typeof iterable !== 'string'){ + throw new Error(`'iterable' is from wrong type ${ typeof iterable }`) + } + + let found = false + const toReturn = [] + let counter = iterable.length + + while (counter > 0){ + counter-- + if (!found && predicate(iterable[ counter ]) === false){ + found = true + toReturn.push(iterable[ counter ]) + } else if (found){ + toReturn.push(iterable[ counter ]) + } + } + + return isArray ? toReturn.reverse() : toReturn.reverse().join('') +} diff --git a/src/lib/node_modules/rambda/src/dropRepeats.js b/src/lib/node_modules/rambda/src/dropRepeats.js new file mode 100644 index 0000000..431e523 --- /dev/null +++ b/src/lib/node_modules/rambda/src/dropRepeats.js @@ -0,0 +1,20 @@ +import { isArray } from './_internals/isArray.js' +import { equals } from './equals.js' + +export function dropRepeats(list){ + if (!isArray(list)){ + throw new Error(`${ list } is not a list`) + } + + const toReturn = [] + + list.reduce((prev, current) => { + if (!equals(prev, current)){ + toReturn.push(current) + } + + return current + }, undefined) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/dropRepeatsWith.js b/src/lib/node_modules/rambda/src/dropRepeatsWith.js new file mode 100644 index 0000000..21fbffa --- /dev/null +++ b/src/lib/node_modules/rambda/src/dropRepeatsWith.js @@ -0,0 +1,28 @@ +import { isArray } from './_internals/isArray.js' + +export function dropRepeatsWith(predicate, list){ + if (arguments.length === 1){ + return _iterable => dropRepeatsWith(predicate, _iterable) + } + + if (!isArray(list)){ + throw new Error(`${ list } is not a list`) + } + + const toReturn = [] + + list.reduce((prev, current) => { + if (prev === undefined){ + toReturn.push(current) + + return current + } + if (!predicate(prev, current)){ + toReturn.push(current) + } + + return current + }, undefined) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/dropWhile.js b/src/lib/node_modules/rambda/src/dropWhile.js new file mode 100644 index 0000000..bf15d71 --- /dev/null +++ b/src/lib/node_modules/rambda/src/dropWhile.js @@ -0,0 +1,26 @@ +import { isArray as isArrayMethod } from './_internals/isArray.js' + +export function dropWhile(predicate, iterable){ + if (arguments.length === 1){ + return _iterable => dropWhile(predicate, _iterable) + } + const isArray = isArrayMethod(iterable) + if (!isArray && typeof iterable !== 'string'){ + throw new Error('`iterable` is neither list nor a string') + } + let flag = false + const holder = [] + let counter = -1 + + while (counter++ < iterable.length - 1){ + if (flag){ + holder.push(iterable[ counter ]) + } else if (!predicate(iterable[ counter ])){ + if (!flag) flag = true + + holder.push(iterable[ counter ]) + } + } + + return isArray ? holder : holder.join('') +} diff --git a/src/lib/node_modules/rambda/src/either.js b/src/lib/node_modules/rambda/src/either.js new file mode 100644 index 0000000..1fcd7a2 --- /dev/null +++ b/src/lib/node_modules/rambda/src/either.js @@ -0,0 +1,8 @@ +export function either(firstPredicate, secondPredicate){ + if (arguments.length === 1){ + return _secondPredicate => either(firstPredicate, _secondPredicate) + } + + return (...input) => + Boolean(firstPredicate(...input) || secondPredicate(...input)) +} diff --git a/src/lib/node_modules/rambda/src/endsWith.js b/src/lib/node_modules/rambda/src/endsWith.js new file mode 100644 index 0000000..6940b44 --- /dev/null +++ b/src/lib/node_modules/rambda/src/endsWith.js @@ -0,0 +1,23 @@ +import { isArray } from './_internals/isArray.js' +import { equals } from './equals.js' + +export function endsWith(target, iterable){ + if (arguments.length === 1) return _iterable => endsWith(target, _iterable) + + if (typeof iterable === 'string'){ + return iterable.endsWith(target) + } + if (!isArray(target)) return false + + const diff = iterable.length - target.length + let correct = true + const filtered = target.filter((x, index) => { + if (!correct) return false + const result = equals(x, iterable[ index + diff ]) + if (!result) correct = false + + return result + }) + + return filtered.length === target.length +} diff --git a/src/lib/node_modules/rambda/src/eqProps.js b/src/lib/node_modules/rambda/src/eqProps.js new file mode 100644 index 0000000..bdcf987 --- /dev/null +++ b/src/lib/node_modules/rambda/src/eqProps.js @@ -0,0 +1,11 @@ +import { curry } from './curry.js' +import { equals } from './equals.js' +import { prop } from './prop.js' + +function eqPropsFn( + property, objA, objB +){ + return equals(prop(property, objA), prop(property, objB)) +} + +export const eqProps = curry(eqPropsFn) diff --git a/src/lib/node_modules/rambda/src/equals.js b/src/lib/node_modules/rambda/src/equals.js new file mode 100644 index 0000000..f5fdbe1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/equals.js @@ -0,0 +1,192 @@ +import { isArray } from './_internals/isArray.js' +import { type } from './type.js' + +export function _lastIndexOf(valueToFind, list){ + if (!isArray(list)){ + throw new Error(`Cannot read property 'indexOf' of ${ list }`) + } + const typeOfValue = type(valueToFind) + if (![ 'Object', 'Array', 'NaN', 'RegExp' ].includes(typeOfValue)) + return list.lastIndexOf(valueToFind) + + const { length } = list + let index = length + let foundIndex = -1 + + while (--index > -1 && foundIndex === -1){ + if (equals(list[ index ], valueToFind)){ + foundIndex = index + } + } + + return foundIndex +} + +export function _indexOf(valueToFind, list){ + if (!isArray(list)){ + throw new Error(`Cannot read property 'indexOf' of ${ list }`) + } + const typeOfValue = type(valueToFind) + if (![ 'Object', 'Array', 'NaN', 'RegExp' ].includes(typeOfValue)) + return list.indexOf(valueToFind) + + let index = -1 + let foundIndex = -1 + const { length } = list + + while (++index < length && foundIndex === -1){ + if (equals(list[ index ], valueToFind)){ + foundIndex = index + } + } + + return foundIndex +} + +function _arrayFromIterator(iter){ + const list = [] + let next + while (!(next = iter.next()).done){ + list.push(next.value) + } + + return list +} + +function _equalsSets(a, b){ + if (a.size !== b.size){ + return false + } + const aList = _arrayFromIterator(a.values()) + const bList = _arrayFromIterator(b.values()) + + const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1) + + return filtered.length === 0 +} + +function parseError(maybeError){ + const typeofError = maybeError.__proto__.toString() + if (![ 'Error', 'TypeError' ].includes(typeofError)) return [] + + return [ typeofError, maybeError.message ] +} + +function parseDate(maybeDate){ + if (!maybeDate.toDateString) return [ false ] + + return [ true, maybeDate.getTime() ] +} + +function parseRegex(maybeRegex){ + if (maybeRegex.constructor !== RegExp) return [ false ] + + return [ true, maybeRegex.toString() ] +} + +function equalsSets(a, b){ + if (a.size !== b.size){ + return false + } + const aList = _arrayFromIterator(a.values()) + const bList = _arrayFromIterator(b.values()) + + const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1) + + return filtered.length === 0 +} + +export function equals(a, b){ + if (arguments.length === 1) return _b => equals(a, _b) + + const aType = type(a) + + if (aType !== type(b)) return false + if (aType === 'Function'){ + return a.name === undefined ? false : a.name === b.name + } + + if ([ 'NaN', 'Undefined', 'Null' ].includes(aType)) return true + + if (aType === 'Number'){ + if (Object.is(-0, a) !== Object.is(-0, b)) return false + + return a.toString() === b.toString() + } + + if ([ 'String', 'Boolean' ].includes(aType)){ + return a.toString() === b.toString() + } + + if (aType === 'Array'){ + const aClone = Array.from(a) + const bClone = Array.from(b) + + if (aClone.toString() !== bClone.toString()){ + return false + } + + let loopArrayFlag = true + aClone.forEach((aCloneInstance, aCloneIndex) => { + if (loopArrayFlag){ + if ( + aCloneInstance !== bClone[ aCloneIndex ] && + !equals(aCloneInstance, bClone[ aCloneIndex ]) + ){ + loopArrayFlag = false + } + } + }) + + return loopArrayFlag + } + + const aRegex = parseRegex(a) + const bRegex = parseRegex(b) + + if (aRegex[ 0 ]){ + return bRegex[ 0 ] ? aRegex[ 1 ] === bRegex[ 1 ] : false + } else if (bRegex[ 0 ]) return false + + const aDate = parseDate(a) + const bDate = parseDate(b) + + if (aDate[ 0 ]){ + return bDate[ 0 ] ? aDate[ 1 ] === bDate[ 1 ] : false + } else if (bDate[ 0 ]) return false + + const aError = parseError(a) + const bError = parseError(b) + + if (aError[ 0 ]){ + return bError[ 0 ] ? + aError[ 0 ] === bError[ 0 ] && aError[ 1 ] === bError[ 1 ] : + false + } + if (aType === 'Set'){ + return _equalsSets(a, b) + } + if (aType === 'Object'){ + const aKeys = Object.keys(a) + + if (aKeys.length !== Object.keys(b).length){ + return false + } + + let loopObjectFlag = true + aKeys.forEach(aKeyInstance => { + if (loopObjectFlag){ + const aValue = a[ aKeyInstance ] + const bValue = b[ aKeyInstance ] + + if (aValue !== bValue && !equals(aValue, bValue)){ + loopObjectFlag = false + } + } + }) + + return loopObjectFlag + } + + return false +} diff --git a/src/lib/node_modules/rambda/src/evolve.js b/src/lib/node_modules/rambda/src/evolve.js new file mode 100644 index 0000000..335e053 --- /dev/null +++ b/src/lib/node_modules/rambda/src/evolve.js @@ -0,0 +1,60 @@ +import { isArray } from './_internals/isArray.js' +import { mapArray, mapObject } from './map.js' +import { type } from './type.js' + +export function evolveArray(rules, list){ + return mapArray( + (x, i) => { + if (type(rules[ i ]) === 'Function'){ + return rules[ i ](x) + } + + return x + }, + list, + true + ) +} + +export function evolveObject(rules, iterable){ + return mapObject((x, prop) => { + if (type(x) === 'Object'){ + const typeRule = type(rules[ prop ]) + if (typeRule === 'Function'){ + return rules[ prop ](x) + } + if (typeRule === 'Object'){ + return evolve(rules[ prop ], x) + } + + return x + } + if (type(rules[ prop ]) === 'Function'){ + return rules[ prop ](x) + } + + return x + }, iterable) +} + +export function evolve(rules, iterable){ + if (arguments.length === 1){ + return _iterable => evolve(rules, _iterable) + } + const rulesType = type(rules) + const iterableType = type(iterable) + + if (iterableType !== rulesType){ + throw new Error('iterableType !== rulesType') + } + + if (![ 'Object', 'Array' ].includes(rulesType)){ + throw new Error(`'iterable' and 'rules' are from wrong type ${ rulesType }`) + } + + if (iterableType === 'Object'){ + return evolveObject(rules, iterable) + } + + return evolveArray(rules, iterable) +} diff --git a/src/lib/node_modules/rambda/src/filter.js b/src/lib/node_modules/rambda/src/filter.js new file mode 100644 index 0000000..3ad69c6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/filter.js @@ -0,0 +1,50 @@ +import { isArray } from './_internals/isArray.js' + +export function filterObject(predicate, obj){ + const willReturn = {} + + for (const prop in obj){ + if (predicate( + obj[ prop ], prop, obj + )){ + willReturn[ prop ] = obj[ prop ] + } + } + + return willReturn +} + +export function filterArray( + predicate, list, indexed = false +){ + let index = 0 + const len = list.length + const willReturn = [] + + while (index < len){ + const predicateResult = indexed ? + predicate(list[ index ], index) : + predicate(list[ index ]) + if (predicateResult){ + willReturn.push(list[ index ]) + } + + index++ + } + + return willReturn +} + +export function filter(predicate, iterable){ + if (arguments.length === 1) + return _iterable => filter(predicate, _iterable) + if (!iterable){ + throw new Error('Incorrect iterable input') + } + + if (isArray(iterable)) return filterArray( + predicate, iterable, false + ) + + return filterObject(predicate, iterable) +} diff --git a/src/lib/node_modules/rambda/src/find.js b/src/lib/node_modules/rambda/src/find.js new file mode 100644 index 0000000..aacf0eb --- /dev/null +++ b/src/lib/node_modules/rambda/src/find.js @@ -0,0 +1,15 @@ +export function find(predicate, list){ + if (arguments.length === 1) return _list => find(predicate, _list) + + let index = 0 + const len = list.length + + while (index < len){ + const x = list[ index ] + if (predicate(x)){ + return x + } + + index++ + } +} diff --git a/src/lib/node_modules/rambda/src/findIndex.js b/src/lib/node_modules/rambda/src/findIndex.js new file mode 100644 index 0000000..d9411ad --- /dev/null +++ b/src/lib/node_modules/rambda/src/findIndex.js @@ -0,0 +1,14 @@ +export function findIndex(predicate, list){ + if (arguments.length === 1) return _list => findIndex(predicate, _list) + + const len = list.length + let index = -1 + + while (++index < len){ + if (predicate(list[ index ])){ + return index + } + } + + return -1 +} diff --git a/src/lib/node_modules/rambda/src/findLast.js b/src/lib/node_modules/rambda/src/findLast.js new file mode 100644 index 0000000..7bac275 --- /dev/null +++ b/src/lib/node_modules/rambda/src/findLast.js @@ -0,0 +1,13 @@ +export function findLast(predicate, list){ + if (arguments.length === 1) return _list => findLast(predicate, _list) + + let index = list.length + + while (--index >= 0){ + if (predicate(list[ index ])){ + return list[ index ] + } + } + + return undefined +} diff --git a/src/lib/node_modules/rambda/src/findLastIndex.js b/src/lib/node_modules/rambda/src/findLastIndex.js new file mode 100644 index 0000000..c25ba1b --- /dev/null +++ b/src/lib/node_modules/rambda/src/findLastIndex.js @@ -0,0 +1,13 @@ +export function findLastIndex(fn, list){ + if (arguments.length === 1) return _list => findLastIndex(fn, _list) + + let index = list.length + + while (--index >= 0){ + if (fn(list[ index ])){ + return index + } + } + + return -1 +} diff --git a/src/lib/node_modules/rambda/src/flatten.js b/src/lib/node_modules/rambda/src/flatten.js new file mode 100644 index 0000000..de8c9a5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/flatten.js @@ -0,0 +1,15 @@ +import { isArray } from './_internals/isArray.js' + +export function flatten(list, input){ + const willReturn = input === undefined ? [] : input + + for (let i = 0; i < list.length; i++){ + if (isArray(list[ i ])){ + flatten(list[ i ], willReturn) + } else { + willReturn.push(list[ i ]) + } + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/flip.js b/src/lib/node_modules/rambda/src/flip.js new file mode 100644 index 0000000..f094f09 --- /dev/null +++ b/src/lib/node_modules/rambda/src/flip.js @@ -0,0 +1,23 @@ +function flipFn(fn){ + return (...input) => { + if (input.length === 1){ + return holder => fn(holder, input[ 0 ]) + } else if (input.length === 2){ + return fn(input[ 1 ], input[ 0 ]) + } else if (input.length === 3){ + return fn( + input[ 1 ], input[ 0 ], input[ 2 ] + ) + } else if (input.length === 4){ + return fn( + input[ 1 ], input[ 0 ], input[ 2 ], input[ 3 ] + ) + } + + throw new Error('R.flip doesn\'t work with arity > 4') + } +} + +export function flip(fn){ + return flipFn(fn) +} diff --git a/src/lib/node_modules/rambda/src/forEach.js b/src/lib/node_modules/rambda/src/forEach.js new file mode 100644 index 0000000..4f7e6d3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/forEach.js @@ -0,0 +1,34 @@ +import { isArray } from './_internals/isArray.js' +import { keys } from './_internals/keys.js' + +export function forEach(fn, list){ + if (arguments.length === 1) return _list => forEach(fn, _list) + + if (list === undefined){ + return + } + + if (isArray(list)){ + let index = 0 + const len = list.length + + while (index < len){ + fn(list[ index ]) + index++ + } + } else { + let index = 0 + const listKeys = keys(list) + const len = listKeys.length + + while (index < len){ + const key = listKeys[ index ] + fn( + list[ key ], key, list + ) + index++ + } + } + + return list +} diff --git a/src/lib/node_modules/rambda/src/fromPairs.js b/src/lib/node_modules/rambda/src/fromPairs.js new file mode 100644 index 0000000..5e13cb0 --- /dev/null +++ b/src/lib/node_modules/rambda/src/fromPairs.js @@ -0,0 +1,6 @@ +export function fromPairs(listOfPairs){ + const toReturn = {} + listOfPairs.forEach(([ prop, value ]) => toReturn[ prop ] = value) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/groupBy.js b/src/lib/node_modules/rambda/src/groupBy.js new file mode 100644 index 0000000..cbdef27 --- /dev/null +++ b/src/lib/node_modules/rambda/src/groupBy.js @@ -0,0 +1,17 @@ +export function groupBy(groupFn, list){ + if (arguments.length === 1) return _list => groupBy(groupFn, _list) + + const result = {} + for (let i = 0; i < list.length; i++){ + const item = list[ i ] + const key = groupFn(item) + + if (!result[ key ]){ + result[ key ] = [] + } + + result[ key ].push(item) + } + + return result +} diff --git a/src/lib/node_modules/rambda/src/groupWith.js b/src/lib/node_modules/rambda/src/groupWith.js new file mode 100644 index 0000000..b6d3eba --- /dev/null +++ b/src/lib/node_modules/rambda/src/groupWith.js @@ -0,0 +1,46 @@ +import { cloneList } from './_internals/cloneList.js' +import { isArray } from './_internals/isArray.js' + +export function groupWith(compareFn, list){ + if (!isArray(list)) throw new TypeError('list.reduce is not a function') + + const clone = cloneList(list) + + if (list.length === 1) return [ clone ] + + const toReturn = [] + let holder = [] + + clone.reduce(( + prev, current, i + ) => { + if (i === 0) return current + + const okCompare = compareFn(prev, current) + const holderIsEmpty = holder.length === 0 + const lastCall = i === list.length - 1 + + if (okCompare){ + if (holderIsEmpty) holder.push(prev) + holder.push(current) + if (lastCall) toReturn.push(holder) + + return current + } + + if (holderIsEmpty){ + toReturn.push([ prev ]) + if (lastCall) toReturn.push([ current ]) + + return current + } + + toReturn.push(holder) + if (lastCall) toReturn.push([ current ]) + holder = [] + + return current + }, undefined) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/has.js b/src/lib/node_modules/rambda/src/has.js new file mode 100644 index 0000000..3cafc76 --- /dev/null +++ b/src/lib/node_modules/rambda/src/has.js @@ -0,0 +1,7 @@ +export function has(prop, obj){ + if (arguments.length === 1) return _obj => has(prop, _obj) + + if (!obj) return false + + return obj.hasOwnProperty(prop) +} diff --git a/src/lib/node_modules/rambda/src/hasPath.js b/src/lib/node_modules/rambda/src/hasPath.js new file mode 100644 index 0000000..76c479e --- /dev/null +++ b/src/lib/node_modules/rambda/src/hasPath.js @@ -0,0 +1,9 @@ +import { path } from './path.js' + +export function hasPath(pathInput, obj){ + if (arguments.length === 1){ + return objHolder => hasPath(pathInput, objHolder) + } + + return path(pathInput, obj) !== undefined +} diff --git a/src/lib/node_modules/rambda/src/head.js b/src/lib/node_modules/rambda/src/head.js new file mode 100644 index 0000000..5359728 --- /dev/null +++ b/src/lib/node_modules/rambda/src/head.js @@ -0,0 +1,5 @@ +export function head(listOrString){ + if (typeof listOrString === 'string') return listOrString[ 0 ] || '' + + return listOrString[ 0 ] +} diff --git a/src/lib/node_modules/rambda/src/identical.js b/src/lib/node_modules/rambda/src/identical.js new file mode 100644 index 0000000..ecc04e3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/identical.js @@ -0,0 +1,7 @@ +import { objectIs } from './_internals/objectIs.js' + +export function identical(a, b){ + if (arguments.length === 1) return _b => identical(a, _b) + + return objectIs(a, b) +} diff --git a/src/lib/node_modules/rambda/src/identity.js b/src/lib/node_modules/rambda/src/identity.js new file mode 100644 index 0000000..f546438 --- /dev/null +++ b/src/lib/node_modules/rambda/src/identity.js @@ -0,0 +1,3 @@ +export function identity(x){ + return x +} diff --git a/src/lib/node_modules/rambda/src/ifElse.js b/src/lib/node_modules/rambda/src/ifElse.js new file mode 100644 index 0000000..2f4949d --- /dev/null +++ b/src/lib/node_modules/rambda/src/ifElse.js @@ -0,0 +1,18 @@ +import { curry } from './curry.js' + +function ifElseFn( + condition, onTrue, onFalse +){ + return (...input) => { + const conditionResult = + typeof condition === 'boolean' ? condition : condition(...input) + + if (conditionResult === true){ + return onTrue(...input) + } + + return onFalse(...input) + } +} + +export const ifElse = curry(ifElseFn) diff --git a/src/lib/node_modules/rambda/src/inc.js b/src/lib/node_modules/rambda/src/inc.js new file mode 100644 index 0000000..5e663a1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/inc.js @@ -0,0 +1 @@ +export const inc = x => x + 1 diff --git a/src/lib/node_modules/rambda/src/includes.js b/src/lib/node_modules/rambda/src/includes.js new file mode 100644 index 0000000..445b102 --- /dev/null +++ b/src/lib/node_modules/rambda/src/includes.js @@ -0,0 +1,16 @@ +import { isArray } from './_internals/isArray.js' +import { _indexOf } from './equals.js' + +export function includes(valueToFind, iterable){ + if (arguments.length === 1) + return _iterable => includes(valueToFind, _iterable) + if (typeof iterable === 'string'){ + return iterable.includes(valueToFind) + } + if (!iterable){ + throw new TypeError(`Cannot read property \'indexOf\' of ${ iterable }`) + } + if (!isArray(iterable)) return false + + return _indexOf(valueToFind, iterable) > -1 +} diff --git a/src/lib/node_modules/rambda/src/indexBy.js b/src/lib/node_modules/rambda/src/indexBy.js new file mode 100644 index 0000000..7e6fa86 --- /dev/null +++ b/src/lib/node_modules/rambda/src/indexBy.js @@ -0,0 +1,29 @@ +import { path } from './path.js' + +function indexByPath(pathInput, list){ + const toReturn = {} + for (let i = 0; i < list.length; i++){ + const item = list[ i ] + toReturn[ path(pathInput, item) ] = item + } + + return toReturn +} + +export function indexBy(condition, list){ + if (arguments.length === 1){ + return _list => indexBy(condition, _list) + } + + if (typeof condition === 'string'){ + return indexByPath(condition, list) + } + + const toReturn = {} + for (let i = 0; i < list.length; i++){ + const item = list[ i ] + toReturn[ condition(item) ] = item + } + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/indexOf.js b/src/lib/node_modules/rambda/src/indexOf.js new file mode 100644 index 0000000..731b5b4 --- /dev/null +++ b/src/lib/node_modules/rambda/src/indexOf.js @@ -0,0 +1,9 @@ +import { _indexOf } from './equals.js' + +export function indexOf(valueToFind, list){ + if (arguments.length === 1){ + return _list => _indexOf(valueToFind, _list) + } + + return _indexOf(valueToFind, list) +} diff --git a/src/lib/node_modules/rambda/src/init.js b/src/lib/node_modules/rambda/src/init.js new file mode 100644 index 0000000..04cc280 --- /dev/null +++ b/src/lib/node_modules/rambda/src/init.js @@ -0,0 +1,11 @@ +import baseSlice from './_internals/baseSlice.js' + +export function init(listOrString){ + if (typeof listOrString === 'string') return listOrString.slice(0, -1) + + return listOrString.length ? + baseSlice( + listOrString, 0, -1 + ) : + [] +} diff --git a/src/lib/node_modules/rambda/src/intersection.js b/src/lib/node_modules/rambda/src/intersection.js new file mode 100644 index 0000000..5d4b82b --- /dev/null +++ b/src/lib/node_modules/rambda/src/intersection.js @@ -0,0 +1,8 @@ +import { filter } from './filter.js' +import { includes } from './includes.js' + +export function intersection(listA, listB){ + if (arguments.length === 1) return _list => intersection(listA, _list) + + return filter(x => includes(x, listA), listB) +} diff --git a/src/lib/node_modules/rambda/src/intersperse.js b/src/lib/node_modules/rambda/src/intersperse.js new file mode 100644 index 0000000..62fffe7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/intersperse.js @@ -0,0 +1,17 @@ +export function intersperse(separator, list){ + if (arguments.length === 1) return _list => intersperse(separator, _list) + + let index = -1 + const len = list.length + const willReturn = [] + + while (++index < len){ + if (index === len - 1){ + willReturn.push(list[ index ]) + } else { + willReturn.push(list[ index ], separator) + } + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/is.js b/src/lib/node_modules/rambda/src/is.js new file mode 100644 index 0000000..532549d --- /dev/null +++ b/src/lib/node_modules/rambda/src/is.js @@ -0,0 +1,8 @@ +export function is(targetPrototype, x){ + if (arguments.length === 1) return _x => is(targetPrototype, _x) + + return ( + x != null && x.constructor === targetPrototype || + x instanceof targetPrototype + ) +} diff --git a/src/lib/node_modules/rambda/src/isEmpty.js b/src/lib/node_modules/rambda/src/isEmpty.js new file mode 100644 index 0000000..8d14d1c --- /dev/null +++ b/src/lib/node_modules/rambda/src/isEmpty.js @@ -0,0 +1,18 @@ +import { type } from './type.js' + +export function isEmpty(input){ + const inputType = type(input) + if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType)) + return false + if (!input) return true + + if (inputType === 'Object'){ + return Object.keys(input).length === 0 + } + + if (inputType === 'Array'){ + return input.length === 0 + } + + return false +} diff --git a/src/lib/node_modules/rambda/src/isNil.js b/src/lib/node_modules/rambda/src/isNil.js new file mode 100644 index 0000000..c7290d9 --- /dev/null +++ b/src/lib/node_modules/rambda/src/isNil.js @@ -0,0 +1,3 @@ +export function isNil(x){ + return x === undefined || x === null +} diff --git a/src/lib/node_modules/rambda/src/isPromise.js b/src/lib/node_modules/rambda/src/isPromise.js new file mode 100644 index 0000000..47c870f --- /dev/null +++ b/src/lib/node_modules/rambda/src/isPromise.js @@ -0,0 +1,5 @@ +import { type } from './type.js' + +export function isPromise(x){ + return 'Promise' === type(x) +} diff --git a/src/lib/node_modules/rambda/src/join.js b/src/lib/node_modules/rambda/src/join.js new file mode 100644 index 0000000..eada611 --- /dev/null +++ b/src/lib/node_modules/rambda/src/join.js @@ -0,0 +1,5 @@ +export function join(glue, list){ + if (arguments.length === 1) return _list => join(glue, _list) + + return list.join(glue) +} diff --git a/src/lib/node_modules/rambda/src/juxt.js b/src/lib/node_modules/rambda/src/juxt.js new file mode 100644 index 0000000..b9bc2fc --- /dev/null +++ b/src/lib/node_modules/rambda/src/juxt.js @@ -0,0 +1,3 @@ +export function juxt(listOfFunctions){ + return (...args) => listOfFunctions.map(fn => fn(...args)) +} diff --git a/src/lib/node_modules/rambda/src/keys.js b/src/lib/node_modules/rambda/src/keys.js new file mode 100644 index 0000000..569cb43 --- /dev/null +++ b/src/lib/node_modules/rambda/src/keys.js @@ -0,0 +1,3 @@ +export function keys(x){ + return Object.keys(x) +} diff --git a/src/lib/node_modules/rambda/src/last.js b/src/lib/node_modules/rambda/src/last.js new file mode 100644 index 0000000..127dba7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/last.js @@ -0,0 +1,7 @@ +export function last(listOrString){ + if (typeof listOrString === 'string'){ + return listOrString[ listOrString.length - 1 ] || '' + } + + return listOrString[ listOrString.length - 1 ] +} diff --git a/src/lib/node_modules/rambda/src/lastIndexOf.js b/src/lib/node_modules/rambda/src/lastIndexOf.js new file mode 100644 index 0000000..59b59c8 --- /dev/null +++ b/src/lib/node_modules/rambda/src/lastIndexOf.js @@ -0,0 +1,9 @@ +import { _lastIndexOf } from './equals.js' + +export function lastIndexOf(valueToFind, list){ + if (arguments.length === 1){ + return _list => _lastIndexOf(valueToFind, _list) + } + + return _lastIndexOf(valueToFind, list) +} diff --git a/src/lib/node_modules/rambda/src/length.js b/src/lib/node_modules/rambda/src/length.js new file mode 100644 index 0000000..82b7f31 --- /dev/null +++ b/src/lib/node_modules/rambda/src/length.js @@ -0,0 +1,8 @@ +import { isArray } from './_internals/isArray.js' + +export function length(x){ + if (isArray(x)) return x.length + if (typeof x === 'string') return x.length + + return NaN +} diff --git a/src/lib/node_modules/rambda/src/lens.js b/src/lib/node_modules/rambda/src/lens.js new file mode 100644 index 0000000..292aab4 --- /dev/null +++ b/src/lib/node_modules/rambda/src/lens.js @@ -0,0 +1,7 @@ +export function lens(getter, setter){ + return function (functor){ + return function (target){ + return functor(getter(target)).map(focus => setter(focus, target)) + } + } +} diff --git a/src/lib/node_modules/rambda/src/lensIndex.js b/src/lib/node_modules/rambda/src/lensIndex.js new file mode 100644 index 0000000..17c6eca --- /dev/null +++ b/src/lib/node_modules/rambda/src/lensIndex.js @@ -0,0 +1,7 @@ +import { lens } from './lens.js' +import { nth } from './nth.js' +import { update } from './update.js' + +export function lensIndex(index){ + return lens(nth(index), update(index)) +} diff --git a/src/lib/node_modules/rambda/src/lensPath.js b/src/lib/node_modules/rambda/src/lensPath.js new file mode 100644 index 0000000..df445d0 --- /dev/null +++ b/src/lib/node_modules/rambda/src/lensPath.js @@ -0,0 +1,7 @@ +import { assocPath } from './assocPath.js' +import { lens } from './lens.js' +import { path } from './path.js' + +export function lensPath(key){ + return lens(path(key), assocPath(key)) +} diff --git a/src/lib/node_modules/rambda/src/lensProp.js b/src/lib/node_modules/rambda/src/lensProp.js new file mode 100644 index 0000000..28ab578 --- /dev/null +++ b/src/lib/node_modules/rambda/src/lensProp.js @@ -0,0 +1,7 @@ +import { assoc } from './assoc.js' +import { lens } from './lens.js' +import { prop } from './prop.js' + +export function lensProp(key){ + return lens(prop(key), assoc(key)) +} diff --git a/src/lib/node_modules/rambda/src/map.js b/src/lib/node_modules/rambda/src/map.js new file mode 100644 index 0000000..7ea0aac --- /dev/null +++ b/src/lib/node_modules/rambda/src/map.js @@ -0,0 +1,50 @@ +import { isArray } from './_internals/isArray.js' +import { keys } from './_internals/keys.js' + +export function mapArray( + fn, list, isIndexed = false +){ + let index = 0 + const willReturn = Array(list.length) + + while (index < list.length){ + willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ]) + + index++ + } + + return willReturn +} + +export function mapObject(fn, obj){ + if (arguments.length === 1){ + return _obj => mapObject(fn, _obj) + } + let index = 0 + const objKeys = keys(obj) + const len = objKeys.length + const willReturn = {} + + while (index < len){ + const key = objKeys[ index ] + willReturn[ key ] = fn( + obj[ key ], key, obj + ) + index++ + } + + return willReturn +} + +export const mapObjIndexed = mapObject + +export function map(fn, iterable){ + if (arguments.length === 1) return _iterable => map(fn, _iterable) + if (!iterable){ + throw new Error(INCORRECT_ITERABLE_INPUT) + } + + if (isArray(iterable)) return mapArray(fn, iterable) + + return mapObject(fn, iterable) +} diff --git a/src/lib/node_modules/rambda/src/match.js b/src/lib/node_modules/rambda/src/match.js new file mode 100644 index 0000000..c734990 --- /dev/null +++ b/src/lib/node_modules/rambda/src/match.js @@ -0,0 +1,7 @@ +export function match(pattern, input){ + if (arguments.length === 1) return _input => match(pattern, _input) + + const willReturn = input.match(pattern) + + return willReturn === null ? [] : willReturn +} diff --git a/src/lib/node_modules/rambda/src/mathMod.js b/src/lib/node_modules/rambda/src/mathMod.js new file mode 100644 index 0000000..bd135d2 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mathMod.js @@ -0,0 +1,8 @@ +import { isInteger } from './_internals/isInteger.js' + +export function mathMod(x, y){ + if (arguments.length === 1) return _y => mathMod(x, _y) + if (!isInteger(x) || !isInteger(y) || y < 1) return NaN + + return (x % y + y) % y +} diff --git a/src/lib/node_modules/rambda/src/max.js b/src/lib/node_modules/rambda/src/max.js new file mode 100644 index 0000000..a7f751b --- /dev/null +++ b/src/lib/node_modules/rambda/src/max.js @@ -0,0 +1,5 @@ +export function max(x, y){ + if (arguments.length === 1) return _y => max(x, _y) + + return y > x ? y : x +} diff --git a/src/lib/node_modules/rambda/src/maxBy.js b/src/lib/node_modules/rambda/src/maxBy.js new file mode 100644 index 0000000..305988f --- /dev/null +++ b/src/lib/node_modules/rambda/src/maxBy.js @@ -0,0 +1,9 @@ +import { curry } from './curry.js' + +export function maxByFn( + compareFn, x, y +){ + return compareFn(y) > compareFn(x) ? y : x +} + +export const maxBy = curry(maxByFn) diff --git a/src/lib/node_modules/rambda/src/maybe.js b/src/lib/node_modules/rambda/src/maybe.js new file mode 100644 index 0000000..1f9c0b3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/maybe.js @@ -0,0 +1,13 @@ +import { type } from './type.js' + +export function maybe( + ifRule, whenIf, whenElse +){ + const whenIfInput = + ifRule && type(whenIf) === 'Function' ? whenIf() : whenIf + + const whenElseInput = + !ifRule && type(whenElse) === 'Function' ? whenElse() : whenElse + + return ifRule ? whenIfInput : whenElseInput +} diff --git a/src/lib/node_modules/rambda/src/mean.js b/src/lib/node_modules/rambda/src/mean.js new file mode 100644 index 0000000..cbafbaf --- /dev/null +++ b/src/lib/node_modules/rambda/src/mean.js @@ -0,0 +1,5 @@ +import { sum } from './sum.js' + +export function mean(list){ + return sum(list) / list.length +} diff --git a/src/lib/node_modules/rambda/src/median.js b/src/lib/node_modules/rambda/src/median.js new file mode 100644 index 0000000..d5c2864 --- /dev/null +++ b/src/lib/node_modules/rambda/src/median.js @@ -0,0 +1,17 @@ +import { mean } from './mean.js' + +export function median(list){ + const len = list.length + if (len === 0) return NaN + const width = 2 - len % 2 + const idx = (len - width) / 2 + + return mean(Array.prototype.slice + .call(list, 0) + .sort((a, b) => { + if (a === b) return 0 + + return a < b ? -1 : 1 + }) + .slice(idx, idx + width)) +} diff --git a/src/lib/node_modules/rambda/src/merge.js b/src/lib/node_modules/rambda/src/merge.js new file mode 100644 index 0000000..2e49bc7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/merge.js @@ -0,0 +1 @@ +export { mergeRight as merge } from './mergeRight.js' diff --git a/src/lib/node_modules/rambda/src/mergeAll.js b/src/lib/node_modules/rambda/src/mergeAll.js new file mode 100644 index 0000000..8390df5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mergeAll.js @@ -0,0 +1,11 @@ +import { map } from './map.js' +import { mergeRight } from './mergeRight.js' + +export function mergeAll(arr){ + let willReturn = {} + map(val => { + willReturn = mergeRight(willReturn, val) + }, arr) + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/mergeDeepRight.js b/src/lib/node_modules/rambda/src/mergeDeepRight.js new file mode 100644 index 0000000..e28a801 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mergeDeepRight.js @@ -0,0 +1,24 @@ +import { clone } from './clone.js' +import { type } from './type.js' + +export function mergeDeepRight(target, source){ + if (arguments.length === 1){ + return sourceHolder => mergeDeepRight(target, sourceHolder) + } + + const willReturn = clone(target) + + Object.keys(source).forEach(key => { + if (type(source[ key ]) === 'Object'){ + if (type(target[ key ]) === 'Object'){ + willReturn[ key ] = mergeDeepRight(target[ key ], source[ key ]) + } else { + willReturn[ key ] = source[ key ] + } + } else { + willReturn[ key ] = source[ key ] + } + }) + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/mergeLeft.js b/src/lib/node_modules/rambda/src/mergeLeft.js new file mode 100644 index 0000000..925ea07 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mergeLeft.js @@ -0,0 +1,7 @@ +import { mergeRight } from './mergeRight.js' + +export function mergeLeft(x, y){ + if (arguments.length === 1) return _y => mergeLeft(x, _y) + + return mergeRight(y, x) +} diff --git a/src/lib/node_modules/rambda/src/mergeRight.js b/src/lib/node_modules/rambda/src/mergeRight.js new file mode 100644 index 0000000..ff0eaa3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mergeRight.js @@ -0,0 +1,8 @@ +export function mergeRight(target, newProps){ + if (arguments.length === 1) + return _newProps => mergeRight(target, _newProps) + + return Object.assign( + {}, target || {}, newProps || {} + ) +} diff --git a/src/lib/node_modules/rambda/src/mergeWith.js b/src/lib/node_modules/rambda/src/mergeWith.js new file mode 100644 index 0000000..a932ed4 --- /dev/null +++ b/src/lib/node_modules/rambda/src/mergeWith.js @@ -0,0 +1,29 @@ +import { curry } from './curry.js' + +function mergeWithFn( + mergeFn, a, b +){ + const willReturn = {} + + Object.keys(a).forEach(key => { + if (b[ key ] === undefined){ + willReturn[ key ] = a[ key ] + } else { + willReturn[ key ] = mergeFn(a[ key ], b[ key ]) + } + }) + + Object.keys(b).forEach(key => { + if (willReturn[ key ] !== undefined) return + + if (a[ key ] === undefined){ + willReturn[ key ] = b[ key ] + } else { + willReturn[ key ] = mergeFn(a[ key ], b[ key ]) + } + }) + + return willReturn +} + +export const mergeWith = curry(mergeWithFn) diff --git a/src/lib/node_modules/rambda/src/min.js b/src/lib/node_modules/rambda/src/min.js new file mode 100644 index 0000000..916df9e --- /dev/null +++ b/src/lib/node_modules/rambda/src/min.js @@ -0,0 +1,5 @@ +export function min(x, y){ + if (arguments.length === 1) return _y => min(x, _y) + + return y < x ? y : x +} diff --git a/src/lib/node_modules/rambda/src/minBy.js b/src/lib/node_modules/rambda/src/minBy.js new file mode 100644 index 0000000..84bc066 --- /dev/null +++ b/src/lib/node_modules/rambda/src/minBy.js @@ -0,0 +1,9 @@ +import { curry } from './curry.js' + +export function minByFn( + compareFn, x, y +){ + return compareFn(y) < compareFn(x) ? y : x +} + +export const minBy = curry(minByFn) diff --git a/src/lib/node_modules/rambda/src/modify.js b/src/lib/node_modules/rambda/src/modify.js new file mode 100644 index 0000000..3780bb6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/modify.js @@ -0,0 +1,23 @@ +import { isArray } from './_internals/isArray.js' +import { isIterable } from './_internals/isIterable.js' +import { curry } from './curry.js' +import { updateFn } from './update.js' + +function modifyFn( + property, fn, iterable +){ + if (!isIterable(iterable)) return iterable + if (iterable[ property ] === undefined) return iterable + if (isArray(iterable)){ + return updateFn( + property, fn(iterable[ property ]), iterable + ) + } + + return { + ...iterable, + [ property ] : fn(iterable[ property ]), + } +} + +export const modify = curry(modifyFn) diff --git a/src/lib/node_modules/rambda/src/modifyPath.js b/src/lib/node_modules/rambda/src/modifyPath.js new file mode 100644 index 0000000..87cff47 --- /dev/null +++ b/src/lib/node_modules/rambda/src/modifyPath.js @@ -0,0 +1,33 @@ +import { createPath } from './_internals/createPath.js' +import { isArray } from './_internals/isArray.js' +import { assoc } from './assoc.js' +import { curry } from './curry.js' +import { path as pathModule } from './path.js' + +export function modifyPathFn( + pathInput, fn, object +){ + const path = createPath(pathInput) + if (path.length === 1){ + return { + ...object, + [ path[ 0 ] ] : fn(object[ path[ 0 ] ]), + } + } + if (pathModule(path, object) === undefined) return object + + const val = modifyPath( + Array.prototype.slice.call(path, 1), + fn, + object[ path[ 0 ] ] + ) + if (val === object[ path[ 0 ] ]){ + return object + } + + return assoc( + path[ 0 ], val, object + ) +} + +export const modifyPath = curry(modifyPathFn) diff --git a/src/lib/node_modules/rambda/src/modulo.js b/src/lib/node_modules/rambda/src/modulo.js new file mode 100644 index 0000000..9e31649 --- /dev/null +++ b/src/lib/node_modules/rambda/src/modulo.js @@ -0,0 +1,5 @@ +export function modulo(x, y){ + if (arguments.length === 1) return _y => modulo(x, _y) + + return x % y +} diff --git a/src/lib/node_modules/rambda/src/move.js b/src/lib/node_modules/rambda/src/move.js new file mode 100644 index 0000000..8ec2e4c --- /dev/null +++ b/src/lib/node_modules/rambda/src/move.js @@ -0,0 +1,19 @@ +import { cloneList } from './_internals/cloneList.js' +import { curry } from './curry.js' + +function moveFn( + fromIndex, toIndex, list +){ + if (fromIndex < 0 || toIndex < 0){ + throw new Error('Rambda.move does not support negative indexes') + } + if (fromIndex > list.length - 1 || toIndex > list.length - 1) return list + + const clone = cloneList(list) + clone[ fromIndex ] = list[ toIndex ] + clone[ toIndex ] = list[ fromIndex ] + + return clone +} + +export const move = curry(moveFn) diff --git a/src/lib/node_modules/rambda/src/multiply.js b/src/lib/node_modules/rambda/src/multiply.js new file mode 100644 index 0000000..5766ecc --- /dev/null +++ b/src/lib/node_modules/rambda/src/multiply.js @@ -0,0 +1,5 @@ +export function multiply(x, y){ + if (arguments.length === 1) return _y => multiply(x, _y) + + return x * y +} diff --git a/src/lib/node_modules/rambda/src/negate.js b/src/lib/node_modules/rambda/src/negate.js new file mode 100644 index 0000000..fbe0cdd --- /dev/null +++ b/src/lib/node_modules/rambda/src/negate.js @@ -0,0 +1,3 @@ +export function negate(x){ + return -x +} diff --git a/src/lib/node_modules/rambda/src/none.js b/src/lib/node_modules/rambda/src/none.js new file mode 100644 index 0000000..4ec58aa --- /dev/null +++ b/src/lib/node_modules/rambda/src/none.js @@ -0,0 +1,9 @@ +export function none(predicate, list){ + if (arguments.length === 1) return _list => none(predicate, _list) + + for (let i = 0; i < list.length; i++){ + if (predicate(list[ i ])) return false + } + + return true +} diff --git a/src/lib/node_modules/rambda/src/not.js b/src/lib/node_modules/rambda/src/not.js new file mode 100644 index 0000000..be2d0f1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/not.js @@ -0,0 +1,3 @@ +export function not(input){ + return !input +} diff --git a/src/lib/node_modules/rambda/src/nth.js b/src/lib/node_modules/rambda/src/nth.js new file mode 100644 index 0000000..c2ba7a2 --- /dev/null +++ b/src/lib/node_modules/rambda/src/nth.js @@ -0,0 +1,9 @@ +export function nth(index, input){ + if (arguments.length === 1) return _input => nth(index, _input) + + const idx = index < 0 ? input.length + index : index + + return Object.prototype.toString.call(input) === '[object String]' ? + input.charAt(idx) : + input[ idx ] +} diff --git a/src/lib/node_modules/rambda/src/objOf.js b/src/lib/node_modules/rambda/src/objOf.js new file mode 100644 index 0000000..050ad53 --- /dev/null +++ b/src/lib/node_modules/rambda/src/objOf.js @@ -0,0 +1,7 @@ +export function objOf(key, value){ + if (arguments.length === 1){ + return _value => objOf(key, _value) + } + + return { [ key ] : value } +} diff --git a/src/lib/node_modules/rambda/src/of.js b/src/lib/node_modules/rambda/src/of.js new file mode 100644 index 0000000..82201cf --- /dev/null +++ b/src/lib/node_modules/rambda/src/of.js @@ -0,0 +1,3 @@ +export function of(value){ + return [ value ] +} diff --git a/src/lib/node_modules/rambda/src/omit.js b/src/lib/node_modules/rambda/src/omit.js new file mode 100644 index 0000000..ce64d60 --- /dev/null +++ b/src/lib/node_modules/rambda/src/omit.js @@ -0,0 +1,20 @@ +import { createPath } from './_internals/createPath.js' + +export function omit(propsToOmit, obj){ + if (arguments.length === 1) return _obj => omit(propsToOmit, _obj) + + if (obj === null || obj === undefined){ + return undefined + } + + const propsToOmitValue = createPath(propsToOmit, ',') + const willReturn = {} + + for (const key in obj){ + if (!propsToOmitValue.includes(key)){ + willReturn[ key ] = obj[ key ] + } + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/on.js b/src/lib/node_modules/rambda/src/on.js new file mode 100644 index 0000000..15ac4f7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/on.js @@ -0,0 +1,16 @@ +export function on( + binaryFn, unaryFn, a, b +){ + if (arguments.length === 3){ + return _b => on( + binaryFn, unaryFn, a, _b + ) + } + if (arguments.length === 2){ + return (_a, _b) => on( + binaryFn, unaryFn, _a, _b + ) + } + + return binaryFn(unaryFn(a), unaryFn(b)) +} diff --git a/src/lib/node_modules/rambda/src/once.js b/src/lib/node_modules/rambda/src/once.js new file mode 100644 index 0000000..ce4d038 --- /dev/null +++ b/src/lib/node_modules/rambda/src/once.js @@ -0,0 +1,24 @@ +import { curry } from './curry.js' + +function onceFn(fn, context){ + let result + + return function (){ + if (fn){ + result = fn.apply(context || this, arguments) + fn = null + } + + return result + } +} + +export function once(fn, context){ + if (arguments.length === 1){ + const wrap = onceFn(fn, context) + + return curry(wrap) + } + + return onceFn(fn, context) +} diff --git a/src/lib/node_modules/rambda/src/or.js b/src/lib/node_modules/rambda/src/or.js new file mode 100644 index 0000000..3666850 --- /dev/null +++ b/src/lib/node_modules/rambda/src/or.js @@ -0,0 +1,5 @@ +export function or(a, b){ + if (arguments.length === 1) return _b => or(a, _b) + + return a || b +} diff --git a/src/lib/node_modules/rambda/src/over.js b/src/lib/node_modules/rambda/src/over.js new file mode 100644 index 0000000..91de36b --- /dev/null +++ b/src/lib/node_modules/rambda/src/over.js @@ -0,0 +1,14 @@ +import { curry } from './curry.js' + +const Identity = x => ({ + x, + map : fn => Identity(fn(x)), +}) + +function overFn( + lens, fn, object +){ + return lens(x => Identity(fn(x)))(object).x +} + +export const over = curry(overFn) diff --git a/src/lib/node_modules/rambda/src/partial.js b/src/lib/node_modules/rambda/src/partial.js new file mode 100644 index 0000000..46825cc --- /dev/null +++ b/src/lib/node_modules/rambda/src/partial.js @@ -0,0 +1,11 @@ +export function partial(fn, ...args){ + const len = fn.length + + return (...rest) => { + if (args.length + rest.length >= len){ + return fn(...args, ...rest) + } + + return partial(fn, ...[ ...args, ...rest ]) + } +} diff --git a/src/lib/node_modules/rambda/src/partialObject.js b/src/lib/node_modules/rambda/src/partialObject.js new file mode 100644 index 0000000..15dd9b6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/partialObject.js @@ -0,0 +1,5 @@ +import { mergeDeepRight } from './mergeDeepRight.js' + +export function partialObject(fn, input){ + return nextInput => fn(mergeDeepRight(nextInput, input)) +} diff --git a/src/lib/node_modules/rambda/src/partition.js b/src/lib/node_modules/rambda/src/partition.js new file mode 100644 index 0000000..f47e57d --- /dev/null +++ b/src/lib/node_modules/rambda/src/partition.js @@ -0,0 +1,44 @@ +import { isArray } from './_internals/isArray.js' + +export function partitionObject(predicate, iterable){ + const yes = {} + const no = {} + Object.entries(iterable).forEach(([ prop, value ]) => { + if (predicate(value, prop)){ + yes[ prop ] = value + } else { + no[ prop ] = value + } + }) + + return [ yes, no ] +} + +export function partitionArray( + predicate, list, indexed = false +){ + const yes = [] + const no = [] + let counter = -1 + + while (counter++ < list.length - 1){ + if ( + indexed ? predicate(list[ counter ], counter) : predicate(list[ counter ]) + ){ + yes.push(list[ counter ]) + } else { + no.push(list[ counter ]) + } + } + + return [ yes, no ] +} + +export function partition(predicate, iterable){ + if (arguments.length === 1){ + return listHolder => partition(predicate, listHolder) + } + if (!isArray(iterable)) return partitionObject(predicate, iterable) + + return partitionArray(predicate, iterable) +} diff --git a/src/lib/node_modules/rambda/src/path.js b/src/lib/node_modules/rambda/src/path.js new file mode 100644 index 0000000..b25a71a --- /dev/null +++ b/src/lib/node_modules/rambda/src/path.js @@ -0,0 +1,25 @@ +import { createPath } from './_internals/createPath.js' + +export function path(pathInput, obj){ + if (arguments.length === 1) return _obj => path(pathInput, _obj) + + if (obj === null || obj === undefined){ + return undefined + } + let willReturn = obj + let counter = 0 + + const pathArrValue = createPath(pathInput) + + while (counter < pathArrValue.length){ + if (willReturn === null || willReturn === undefined){ + return undefined + } + if (willReturn[ pathArrValue[ counter ] ] === null) return undefined + + willReturn = willReturn[ pathArrValue[ counter ] ] + counter++ + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/pathEq.js b/src/lib/node_modules/rambda/src/pathEq.js new file mode 100644 index 0000000..6e92949 --- /dev/null +++ b/src/lib/node_modules/rambda/src/pathEq.js @@ -0,0 +1,11 @@ +import { curry } from './curry.js' +import { equals } from './equals.js' +import { path } from './path.js' + +function pathEqFn( + pathToSearch, target, input +){ + return equals(path(pathToSearch, input), target) +} + +export const pathEq = curry(pathEqFn) diff --git a/src/lib/node_modules/rambda/src/pathOr.js b/src/lib/node_modules/rambda/src/pathOr.js new file mode 100644 index 0000000..a5f630b --- /dev/null +++ b/src/lib/node_modules/rambda/src/pathOr.js @@ -0,0 +1,11 @@ +import { curry } from './curry.js' +import { defaultTo } from './defaultTo.js' +import { path } from './path.js' + +function pathOrFn( + defaultValue, pathInput, obj +){ + return defaultTo(defaultValue, path(pathInput, obj)) +} + +export const pathOr = curry(pathOrFn) diff --git a/src/lib/node_modules/rambda/src/paths.js b/src/lib/node_modules/rambda/src/paths.js new file mode 100644 index 0000000..a11a591 --- /dev/null +++ b/src/lib/node_modules/rambda/src/paths.js @@ -0,0 +1,9 @@ +import { path } from './path.js' + +export function paths(pathsToSearch, obj){ + if (arguments.length === 1){ + return _obj => paths(pathsToSearch, _obj) + } + + return pathsToSearch.map(singlePath => path(singlePath, obj)) +} diff --git a/src/lib/node_modules/rambda/src/pick.js b/src/lib/node_modules/rambda/src/pick.js new file mode 100644 index 0000000..dc23abc --- /dev/null +++ b/src/lib/node_modules/rambda/src/pick.js @@ -0,0 +1,21 @@ +import { createPath } from './_internals/createPath.js' + +export function pick(propsToPick, input){ + if (arguments.length === 1) return _input => pick(propsToPick, _input) + + if (input === null || input === undefined){ + return undefined + } + const keys = createPath(propsToPick, ',') + const willReturn = {} + let counter = 0 + + while (counter < keys.length){ + if (keys[ counter ] in input){ + willReturn[ keys[ counter ] ] = input[ keys[ counter ] ] + } + counter++ + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/pickAll.js b/src/lib/node_modules/rambda/src/pickAll.js new file mode 100644 index 0000000..a951cc7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/pickAll.js @@ -0,0 +1,23 @@ +import { createPath } from './_internals/createPath.js' + +export function pickAll(propsToPick, obj){ + if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj) + + if (obj === null || obj === undefined){ + return undefined + } + const keysValue = createPath(propsToPick, ',') + const willReturn = {} + let counter = 0 + + while (counter < keysValue.length){ + if (keysValue[ counter ] in obj){ + willReturn[ keysValue[ counter ] ] = obj[ keysValue[ counter ] ] + } else { + willReturn[ keysValue[ counter ] ] = undefined + } + counter++ + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/pipe.js b/src/lib/node_modules/rambda/src/pipe.js new file mode 100644 index 0000000..9ab95f1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/pipe.js @@ -0,0 +1,89 @@ +import { reduceFn } from './reduce.js' + +export function _arity(n, fn){ + switch (n){ + case 0: + return function (){ + return fn.apply(this, arguments) + } + case 1: + return function (a0){ + return fn.apply(this, arguments) + } + case 2: + return function (a0, a1){ + return fn.apply(this, arguments) + } + case 3: + return function ( + a0, a1, a2 + ){ + return fn.apply(this, arguments) + } + case 4: + return function ( + a0, a1, a2, a3 + ){ + return fn.apply(this, arguments) + } + case 5: + return function ( + a0, a1, a2, a3, a4 + ){ + return fn.apply(this, arguments) + } + case 6: + return function ( + a0, a1, a2, a3, a4, a5 + ){ + return fn.apply(this, arguments) + } + case 7: + return function ( + a0, a1, a2, a3, a4, a5, a6 + ){ + return fn.apply(this, arguments) + } + case 8: + return function ( + a0, a1, a2, a3, a4, a5, a6, a7 + ){ + return fn.apply(this, arguments) + } + case 9: + return function ( + a0, a1, a2, a3, a4, a5, a6, a7, a8 + ){ + return fn.apply(this, arguments) + } + case 10: + return function ( + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 + ){ + return fn.apply(this, arguments) + } + default: + throw new Error('First argument to _arity must be a non-negative integer no greater than ten') + } +} + +export function _pipe(f, g){ + return function (){ + return g.call(this, f.apply(this, arguments)) + } +} + +export function pipe(){ + if (arguments.length === 0){ + throw new Error('pipe requires at least one argument') + } + + return _arity(arguments[ 0 ].length, + reduceFn( + _pipe, + arguments[ 0 ], + Array.prototype.slice.call( + arguments, 1, Infinity + ) + )) +} diff --git a/src/lib/node_modules/rambda/src/pluck.js b/src/lib/node_modules/rambda/src/pluck.js new file mode 100644 index 0000000..7781eb3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/pluck.js @@ -0,0 +1,15 @@ +import { map } from './map.js' + +export function pluck(property, list){ + if (arguments.length === 1) return _list => pluck(property, _list) + + const willReturn = [] + + map(x => { + if (x[ property ] !== undefined){ + willReturn.push(x[ property ]) + } + }, list) + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/prepend.js b/src/lib/node_modules/rambda/src/prepend.js new file mode 100644 index 0000000..22ed2c9 --- /dev/null +++ b/src/lib/node_modules/rambda/src/prepend.js @@ -0,0 +1,7 @@ +export function prepend(x, input){ + if (arguments.length === 1) return _input => prepend(x, _input) + + if (typeof input === 'string') return [ x ].concat(input.split('')) + + return [ x ].concat(input) +} diff --git a/src/lib/node_modules/rambda/src/product.js b/src/lib/node_modules/rambda/src/product.js new file mode 100644 index 0000000..237c939 --- /dev/null +++ b/src/lib/node_modules/rambda/src/product.js @@ -0,0 +1,4 @@ +import { multiply } from './multiply.js' +import { reduce } from './reduce.js' + +export const product = reduce(multiply, 1) diff --git a/src/lib/node_modules/rambda/src/prop.js b/src/lib/node_modules/rambda/src/prop.js new file mode 100644 index 0000000..37fae1e --- /dev/null +++ b/src/lib/node_modules/rambda/src/prop.js @@ -0,0 +1,7 @@ +export function prop(propToFind, obj){ + if (arguments.length === 1) return _obj => prop(propToFind, _obj) + + if (!obj) return undefined + + return obj[ propToFind ] +} diff --git a/src/lib/node_modules/rambda/src/propEq.js b/src/lib/node_modules/rambda/src/propEq.js new file mode 100644 index 0000000..68af3c5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/propEq.js @@ -0,0 +1,13 @@ +import { curry } from './curry.js' +import { equals } from './equals.js' +import { prop } from './prop.js' + +function propEqFn( + propToFind, valueToMatch, obj +){ + if (!obj) return false + + return equals(valueToMatch, prop(propToFind, obj)) +} + +export const propEq = curry(propEqFn) diff --git a/src/lib/node_modules/rambda/src/propIs.js b/src/lib/node_modules/rambda/src/propIs.js new file mode 100644 index 0000000..ca467c1 --- /dev/null +++ b/src/lib/node_modules/rambda/src/propIs.js @@ -0,0 +1,10 @@ +import { curry } from './curry.js' +import { is } from './is.js' + +function propIsFn( + targetPrototype, property, obj +){ + return is(targetPrototype, obj[ property ]) +} + +export const propIs = curry(propIsFn) diff --git a/src/lib/node_modules/rambda/src/propOr.js b/src/lib/node_modules/rambda/src/propOr.js new file mode 100644 index 0000000..07e40ef --- /dev/null +++ b/src/lib/node_modules/rambda/src/propOr.js @@ -0,0 +1,12 @@ +import { curry } from './curry.js' +import { defaultTo } from './defaultTo.js' + +function propOrFn( + defaultValue, property, obj +){ + if (!obj) return defaultValue + + return defaultTo(defaultValue, obj[ property ]) +} + +export const propOr = curry(propOrFn) diff --git a/src/lib/node_modules/rambda/src/propSatisfies.js b/src/lib/node_modules/rambda/src/propSatisfies.js new file mode 100644 index 0000000..926455c --- /dev/null +++ b/src/lib/node_modules/rambda/src/propSatisfies.js @@ -0,0 +1,10 @@ +import { curry } from './curry.js' +import { prop } from './prop.js' + +function propSatisfiesFn( + predicate, property, obj +){ + return predicate(prop(property, obj)) +} + +export const propSatisfies = curry(propSatisfiesFn) diff --git a/src/lib/node_modules/rambda/src/props.js b/src/lib/node_modules/rambda/src/props.js new file mode 100644 index 0000000..360602a --- /dev/null +++ b/src/lib/node_modules/rambda/src/props.js @@ -0,0 +1,13 @@ +import { isArray } from './_internals/isArray.js' +import { mapArray } from './map.js' + +export function props(propsToPick, obj){ + if (arguments.length === 1){ + return _obj => props(propsToPick, _obj) + } + if (!isArray(propsToPick)){ + throw new Error('propsToPick is not a list') + } + + return mapArray(prop => obj[ prop ], propsToPick) +} diff --git a/src/lib/node_modules/rambda/src/range.js b/src/lib/node_modules/rambda/src/range.js new file mode 100644 index 0000000..986a654 --- /dev/null +++ b/src/lib/node_modules/rambda/src/range.js @@ -0,0 +1,18 @@ +export function range(start, end){ + if (arguments.length === 1) return _end => range(start, _end) + + if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))){ + throw new TypeError('Both arguments to range must be numbers') + } + + if (end < start) return [] + + const len = end - start + const willReturn = Array(len) + + for (let i = 0; i < len; i++){ + willReturn[ i ] = start + i + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/reduce.js b/src/lib/node_modules/rambda/src/reduce.js new file mode 100644 index 0000000..faf20e8 --- /dev/null +++ b/src/lib/node_modules/rambda/src/reduce.js @@ -0,0 +1,33 @@ +import { isArray } from './_internals/isArray.js' +import { curry } from './curry.js' + +class ReduceStopper{ + constructor(value){ + this.value = value + } +} + +export function reduceFn( + reducer, acc, list +){ + if (!isArray(list)){ + throw new TypeError('reduce: list must be array or iterable') + } + let index = 0 + const len = list.length + + while (index < len){ + acc = reducer( + acc, list[ index ], index, list + ) + if (acc instanceof ReduceStopper){ + return acc.value + } + index++ + } + + return acc +} + +export const reduce = curry(reduceFn) +export const reduceStopper = value => new ReduceStopper(value) diff --git a/src/lib/node_modules/rambda/src/reject.js b/src/lib/node_modules/rambda/src/reject.js new file mode 100644 index 0000000..6f8c0b5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/reject.js @@ -0,0 +1,7 @@ +import { filter } from './filter.js' + +export function reject(predicate, list){ + if (arguments.length === 1) return _list => reject(predicate, _list) + + return filter(x => !predicate(x), list) +} diff --git a/src/lib/node_modules/rambda/src/repeat.js b/src/lib/node_modules/rambda/src/repeat.js new file mode 100644 index 0000000..e63037c --- /dev/null +++ b/src/lib/node_modules/rambda/src/repeat.js @@ -0,0 +1,7 @@ +export function repeat(x, timesToRepeat){ + if (arguments.length === 1){ + return _timesToRepeat => repeat(x, _timesToRepeat) + } + + return Array(timesToRepeat).fill(x) +} diff --git a/src/lib/node_modules/rambda/src/replace.js b/src/lib/node_modules/rambda/src/replace.js new file mode 100644 index 0000000..64cfb45 --- /dev/null +++ b/src/lib/node_modules/rambda/src/replace.js @@ -0,0 +1,9 @@ +import { curry } from './curry.js' + +function replaceFn( + pattern, replacer, str +){ + return str.replace(pattern, replacer) +} + +export const replace = curry(replaceFn) diff --git a/src/lib/node_modules/rambda/src/reverse.js b/src/lib/node_modules/rambda/src/reverse.js new file mode 100644 index 0000000..294714e --- /dev/null +++ b/src/lib/node_modules/rambda/src/reverse.js @@ -0,0 +1,10 @@ +export function reverse(listOrString){ + if (typeof listOrString === 'string'){ + return listOrString.split('').reverse() + .join('') + } + + const clone = listOrString.slice() + + return clone.reverse() +} diff --git a/src/lib/node_modules/rambda/src/set.js b/src/lib/node_modules/rambda/src/set.js new file mode 100644 index 0000000..003caa0 --- /dev/null +++ b/src/lib/node_modules/rambda/src/set.js @@ -0,0 +1,13 @@ +import { always } from './always.js' +import { curry } from './curry.js' +import { over } from './over.js' + +function setFn( + lens, replacer, x +){ + return over( + lens, always(replacer), x + ) +} + +export const set = curry(setFn) diff --git a/src/lib/node_modules/rambda/src/slice.js b/src/lib/node_modules/rambda/src/slice.js new file mode 100644 index 0000000..9bbd092 --- /dev/null +++ b/src/lib/node_modules/rambda/src/slice.js @@ -0,0 +1,9 @@ +import { curry } from './curry.js' + +function sliceFn( + from, to, list +){ + return list.slice(from, to) +} + +export const slice = curry(sliceFn) diff --git a/src/lib/node_modules/rambda/src/sort.js b/src/lib/node_modules/rambda/src/sort.js new file mode 100644 index 0000000..1c1a70e --- /dev/null +++ b/src/lib/node_modules/rambda/src/sort.js @@ -0,0 +1,7 @@ +import { cloneList } from './_internals/cloneList.js' + +export function sort(sortFn, list){ + if (arguments.length === 1) return _list => sort(sortFn, _list) + + return cloneList(list).sort(sortFn) +} diff --git a/src/lib/node_modules/rambda/src/sortBy.js b/src/lib/node_modules/rambda/src/sortBy.js new file mode 100644 index 0000000..6c707a4 --- /dev/null +++ b/src/lib/node_modules/rambda/src/sortBy.js @@ -0,0 +1,16 @@ +import { cloneList } from './_internals/cloneList.js' + +export function sortBy(sortFn, list){ + if (arguments.length === 1) return _list => sortBy(sortFn, _list) + + const clone = cloneList(list) + + return clone.sort((a, b) => { + const aSortResult = sortFn(a) + const bSortResult = sortFn(b) + + if (aSortResult === bSortResult) return 0 + + return aSortResult < bSortResult ? -1 : 1 + }) +} diff --git a/src/lib/node_modules/rambda/src/split.js b/src/lib/node_modules/rambda/src/split.js new file mode 100644 index 0000000..58796aa --- /dev/null +++ b/src/lib/node_modules/rambda/src/split.js @@ -0,0 +1,5 @@ +export function split(separator, str){ + if (arguments.length === 1) return _str => split(separator, _str) + + return str.split(separator) +} diff --git a/src/lib/node_modules/rambda/src/splitAt.js b/src/lib/node_modules/rambda/src/splitAt.js new file mode 100644 index 0000000..553d7a3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/splitAt.js @@ -0,0 +1,21 @@ +import { isArray } from './_internals/isArray.js' +import { drop } from './drop.js' +import { maybe } from './maybe.js' +import { take } from './take.js' + +export function splitAt(index, input){ + if (arguments.length === 1){ + return _list => splitAt(index, _list) + } + if (!input) throw new TypeError(`Cannot read property 'slice' of ${ input }`) + + if (!isArray(input) && typeof input !== 'string') return [ [], [] ] + + const correctIndex = maybe( + index < 0, + input.length + index < 0 ? 0 : input.length + index, + index + ) + + return [ take(correctIndex, input), drop(correctIndex, input) ] +} diff --git a/src/lib/node_modules/rambda/src/splitEvery.js b/src/lib/node_modules/rambda/src/splitEvery.js new file mode 100644 index 0000000..b574f96 --- /dev/null +++ b/src/lib/node_modules/rambda/src/splitEvery.js @@ -0,0 +1,18 @@ +export function splitEvery(sliceLength, listOrString){ + if (arguments.length === 1){ + return _listOrString => splitEvery(sliceLength, _listOrString) + } + + if (sliceLength < 1){ + throw new Error('First argument to splitEvery must be a positive integer') + } + + const willReturn = [] + let counter = 0 + + while (counter < listOrString.length){ + willReturn.push(listOrString.slice(counter, counter += sliceLength)) + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/splitWhen.js b/src/lib/node_modules/rambda/src/splitWhen.js new file mode 100644 index 0000000..90146ef --- /dev/null +++ b/src/lib/node_modules/rambda/src/splitWhen.js @@ -0,0 +1,25 @@ +export function splitWhen(predicate, input){ + if (arguments.length === 1){ + return _input => splitWhen(predicate, _input) + } + if (!input) + throw new TypeError(`Cannot read property 'length' of ${ input }`) + + const preFound = [] + const postFound = [] + let found = false + let counter = -1 + + while (counter++ < input.length - 1){ + if (found){ + postFound.push(input[ counter ]) + } else if (predicate(input[ counter ])){ + postFound.push(input[ counter ]) + found = true + } else { + preFound.push(input[ counter ]) + } + } + + return [ preFound, postFound ] +} diff --git a/src/lib/node_modules/rambda/src/startsWith.js b/src/lib/node_modules/rambda/src/startsWith.js new file mode 100644 index 0000000..0b26108 --- /dev/null +++ b/src/lib/node_modules/rambda/src/startsWith.js @@ -0,0 +1,23 @@ +import { isArray } from './_internals/isArray.js' +import { equals } from './equals.js' + +export function startsWith(target, iterable){ + if (arguments.length === 1) + return _iterable => startsWith(target, _iterable) + + if (typeof iterable === 'string'){ + return iterable.startsWith(target) + } + if (!isArray(target)) return false + + let correct = true + const filtered = target.filter((x, index) => { + if (!correct) return false + const result = equals(x, iterable[ index ]) + if (!result) correct = false + + return result + }) + + return filtered.length === target.length +} diff --git a/src/lib/node_modules/rambda/src/subtract.js b/src/lib/node_modules/rambda/src/subtract.js new file mode 100644 index 0000000..3eb1d26 --- /dev/null +++ b/src/lib/node_modules/rambda/src/subtract.js @@ -0,0 +1,5 @@ +export function subtract(a, b){ + if (arguments.length === 1) return _b => subtract(a, _b) + + return a - b +} diff --git a/src/lib/node_modules/rambda/src/sum.js b/src/lib/node_modules/rambda/src/sum.js new file mode 100644 index 0000000..b7c9797 --- /dev/null +++ b/src/lib/node_modules/rambda/src/sum.js @@ -0,0 +1,3 @@ +export function sum(list){ + return list.reduce((prev, current) => prev + current, 0) +} diff --git a/src/lib/node_modules/rambda/src/symmetricDifference.js b/src/lib/node_modules/rambda/src/symmetricDifference.js new file mode 100644 index 0000000..f05b7ea --- /dev/null +++ b/src/lib/node_modules/rambda/src/symmetricDifference.js @@ -0,0 +1,12 @@ +import { concat } from './concat.js' +import { filter } from './filter.js' +import { includes } from './includes.js' + +export function symmetricDifference(x, y){ + if (arguments.length === 1){ + return _y => symmetricDifference(x, _y) + } + + return concat(filter(value => !includes(value, y), x), + filter(value => !includes(value, x), y)) +} diff --git a/src/lib/node_modules/rambda/src/tail.js b/src/lib/node_modules/rambda/src/tail.js new file mode 100644 index 0000000..4abee12 --- /dev/null +++ b/src/lib/node_modules/rambda/src/tail.js @@ -0,0 +1,5 @@ +import { drop } from './drop.js' + +export function tail(listOrString){ + return drop(1, listOrString) +} diff --git a/src/lib/node_modules/rambda/src/take.js b/src/lib/node_modules/rambda/src/take.js new file mode 100644 index 0000000..2280692 --- /dev/null +++ b/src/lib/node_modules/rambda/src/take.js @@ -0,0 +1,12 @@ +import baseSlice from './_internals/baseSlice.js' + +export function take(howMany, listOrString){ + if (arguments.length === 1) + return _listOrString => take(howMany, _listOrString) + if (howMany < 0) return listOrString.slice() + if (typeof listOrString === 'string') return listOrString.slice(0, howMany) + + return baseSlice( + listOrString, 0, howMany + ) +} diff --git a/src/lib/node_modules/rambda/src/takeLast.js b/src/lib/node_modules/rambda/src/takeLast.js new file mode 100644 index 0000000..37b0cbb --- /dev/null +++ b/src/lib/node_modules/rambda/src/takeLast.js @@ -0,0 +1,19 @@ +import baseSlice from './_internals/baseSlice.js' + +export function takeLast(howMany, listOrString){ + if (arguments.length === 1) + return _listOrString => takeLast(howMany, _listOrString) + + const len = listOrString.length + if (howMany < 0) return listOrString.slice() + let numValue = howMany > len ? len : howMany + + if (typeof listOrString === 'string') + return listOrString.slice(len - numValue) + + numValue = len - numValue + + return baseSlice( + listOrString, numValue, len + ) +} diff --git a/src/lib/node_modules/rambda/src/takeLastWhile.js b/src/lib/node_modules/rambda/src/takeLastWhile.js new file mode 100644 index 0000000..acd33ae --- /dev/null +++ b/src/lib/node_modules/rambda/src/takeLastWhile.js @@ -0,0 +1,22 @@ +import { isArray } from './_internals/isArray.js' + +export function takeLastWhile(predicate, input){ + if (arguments.length === 1){ + return _input => takeLastWhile(predicate, _input) + } + if (input.length === 0) return input + let found = false + const toReturn = [] + let counter = input.length + + while (!found || counter === 0){ + counter-- + if (predicate(input[ counter ]) === false){ + found = true + } else if (!found){ + toReturn.push(input[ counter ]) + } + } + + return isArray(input) ? toReturn.reverse() : toReturn.reverse().join('') +} diff --git a/src/lib/node_modules/rambda/src/takeWhile.js b/src/lib/node_modules/rambda/src/takeWhile.js new file mode 100644 index 0000000..83bf008 --- /dev/null +++ b/src/lib/node_modules/rambda/src/takeWhile.js @@ -0,0 +1,25 @@ +import { isArray as isArrayModule } from './_internals/isArray.js' + +export function takeWhile(predicate, iterable){ + if (arguments.length === 1){ + return _iterable => takeWhile(predicate, _iterable) + } + const isArray = isArrayModule(iterable) + if (!isArray && typeof iterable !== 'string'){ + throw new Error('`iterable` is neither list nor a string') + } + let flag = true + const holder = [] + let counter = -1 + + while (counter++ < iterable.length - 1){ + if (!predicate(iterable[ counter ])){ + if (flag) flag = false + } else if (flag){ + holder.push(iterable[ counter ]) + } + } + holder + + return isArray ? holder : holder.join('') +} diff --git a/src/lib/node_modules/rambda/src/tap.js b/src/lib/node_modules/rambda/src/tap.js new file mode 100644 index 0000000..71233f6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/tap.js @@ -0,0 +1,7 @@ +export function tap(fn, x){ + if (arguments.length === 1) return _x => tap(fn, _x) + + fn(x) + + return x +} diff --git a/src/lib/node_modules/rambda/src/test.js b/src/lib/node_modules/rambda/src/test.js new file mode 100644 index 0000000..3f658a5 --- /dev/null +++ b/src/lib/node_modules/rambda/src/test.js @@ -0,0 +1,9 @@ +export function test(pattern, str){ + if (arguments.length === 1) return _str => test(pattern, _str) + + if (typeof pattern === 'string'){ + throw new TypeError(`‘test’ requires a value of type RegExp as its first argument; received "${ pattern }"`) + } + + return str.search(pattern) !== -1 +} diff --git a/src/lib/node_modules/rambda/src/times.js b/src/lib/node_modules/rambda/src/times.js new file mode 100644 index 0000000..da27c98 --- /dev/null +++ b/src/lib/node_modules/rambda/src/times.js @@ -0,0 +1,12 @@ +import { isInteger } from './_internals/isInteger.js' +import { map } from './map.js' +import { range } from './range.js' + +export function times(fn, howMany){ + if (arguments.length === 1) return _howMany => times(fn, _howMany) + if (!isInteger(howMany) || howMany < 0){ + throw new RangeError('n must be an integer') + } + + return map(fn, range(0, howMany)) +} diff --git a/src/lib/node_modules/rambda/src/toLower.js b/src/lib/node_modules/rambda/src/toLower.js new file mode 100644 index 0000000..f838d92 --- /dev/null +++ b/src/lib/node_modules/rambda/src/toLower.js @@ -0,0 +1,3 @@ +export function toLower(str){ + return str.toLowerCase() +} diff --git a/src/lib/node_modules/rambda/src/toPairs.js b/src/lib/node_modules/rambda/src/toPairs.js new file mode 100644 index 0000000..515a305 --- /dev/null +++ b/src/lib/node_modules/rambda/src/toPairs.js @@ -0,0 +1,3 @@ +export function toPairs(obj){ + return Object.entries(obj) +} diff --git a/src/lib/node_modules/rambda/src/toString.js b/src/lib/node_modules/rambda/src/toString.js new file mode 100644 index 0000000..9d23623 --- /dev/null +++ b/src/lib/node_modules/rambda/src/toString.js @@ -0,0 +1,3 @@ +export function toString(x){ + return x.toString() +} diff --git a/src/lib/node_modules/rambda/src/toUpper.js b/src/lib/node_modules/rambda/src/toUpper.js new file mode 100644 index 0000000..ffa1ea6 --- /dev/null +++ b/src/lib/node_modules/rambda/src/toUpper.js @@ -0,0 +1,3 @@ +export function toUpper(str){ + return str.toUpperCase() +} diff --git a/src/lib/node_modules/rambda/src/transpose.js b/src/lib/node_modules/rambda/src/transpose.js new file mode 100644 index 0000000..3957c79 --- /dev/null +++ b/src/lib/node_modules/rambda/src/transpose.js @@ -0,0 +1,10 @@ +import { isArray } from './_internals/isArray.js' + +export function transpose(array){ + return array.reduce((acc, el) => { + el.forEach((nestedEl, i) => + isArray(acc[ i ]) ? acc[ i ].push(nestedEl) : acc.push([ nestedEl ])) + + return acc + }, []) +} diff --git a/src/lib/node_modules/rambda/src/trim.js b/src/lib/node_modules/rambda/src/trim.js new file mode 100644 index 0000000..41cf70f --- /dev/null +++ b/src/lib/node_modules/rambda/src/trim.js @@ -0,0 +1,3 @@ +export function trim(str){ + return str.trim() +} diff --git a/src/lib/node_modules/rambda/src/tryCatch.js b/src/lib/node_modules/rambda/src/tryCatch.js new file mode 100644 index 0000000..0902e65 --- /dev/null +++ b/src/lib/node_modules/rambda/src/tryCatch.js @@ -0,0 +1,18 @@ +import { type } from './type.js' + +const isFunction = x => [ 'Promise', 'Function' ].includes(type(x)) + +export function tryCatch(fn, fallback){ + if (!isFunction(fn)){ + throw new Error(`R.tryCatch | fn '${ fn }'`) + } + const passFallback = isFunction(fallback) + + return (...inputs) => { + try { + return fn(...inputs) + } catch (e){ + return passFallback ? fallback(e, ...inputs) : fallback + } + } +} diff --git a/src/lib/node_modules/rambda/src/type.js b/src/lib/node_modules/rambda/src/type.js new file mode 100644 index 0000000..1db34ba --- /dev/null +++ b/src/lib/node_modules/rambda/src/type.js @@ -0,0 +1,12 @@ +export function type(input){ + if (input === null){ + return 'Null' + } else if (input === undefined){ + return 'Undefined' + } else if (Number.isNaN(input)){ + return 'NaN' + } + const typeResult = Object.prototype.toString.call(input).slice(8, -1) + + return typeResult === 'AsyncFunction' ? 'Promise' : typeResult +} diff --git a/src/lib/node_modules/rambda/src/unapply.js b/src/lib/node_modules/rambda/src/unapply.js new file mode 100644 index 0000000..a1d462f --- /dev/null +++ b/src/lib/node_modules/rambda/src/unapply.js @@ -0,0 +1,5 @@ +export function unapply(fn){ + return function (...args){ + return fn.call(this, args) + } +} diff --git a/src/lib/node_modules/rambda/src/union.js b/src/lib/node_modules/rambda/src/union.js new file mode 100644 index 0000000..141c446 --- /dev/null +++ b/src/lib/node_modules/rambda/src/union.js @@ -0,0 +1,14 @@ +import { cloneList } from './_internals/cloneList.js' +import { includes } from './includes.js' + +export function union(x, y){ + if (arguments.length === 1) return _y => union(x, _y) + + const toReturn = cloneList(x) + + y.forEach(yInstance => { + if (!includes(yInstance, x)) toReturn.push(yInstance) + }) + + return toReturn +} diff --git a/src/lib/node_modules/rambda/src/uniq.js b/src/lib/node_modules/rambda/src/uniq.js new file mode 100644 index 0000000..33615b3 --- /dev/null +++ b/src/lib/node_modules/rambda/src/uniq.js @@ -0,0 +1,13 @@ +import { _Set } from './_internals/set.js' + +export function uniq(list){ + const set = new _Set() + const willReturn = [] + list.forEach(item => { + if (set.checkUniqueness(item)){ + willReturn.push(item) + } + }) + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/uniqBy.js b/src/lib/node_modules/rambda/src/uniqBy.js new file mode 100644 index 0000000..c284fee --- /dev/null +++ b/src/lib/node_modules/rambda/src/uniqBy.js @@ -0,0 +1,13 @@ +export function uniqBy(fn, list){ + if (arguments.length === 1){ + return _list => uniqBy(fn, _list) + } + const set = new Set() + + return list.filter(item => { + if (set.has(fn(item))) return false + set.add(fn(item)) + + return true + }) +} diff --git a/src/lib/node_modules/rambda/src/uniqWith.js b/src/lib/node_modules/rambda/src/uniqWith.js new file mode 100644 index 0000000..b6c07c7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/uniqWith.js @@ -0,0 +1,35 @@ +function includesWith( + predicate, target, list +){ + let willReturn = false + let index = -1 + + while (++index < list.length && !willReturn){ + const value = list[ index ] + + if (predicate(target, value)){ + willReturn = true + } + } + + return willReturn +} + +export function uniqWith(predicate, list){ + if (arguments.length === 1) return _list => uniqWith(predicate, _list) + + let index = -1 + const willReturn = [] + + while (++index < list.length){ + const value = list[ index ] + + if (!includesWith( + predicate, value, willReturn + )){ + willReturn.push(value) + } + } + + return willReturn +} diff --git a/src/lib/node_modules/rambda/src/unless.js b/src/lib/node_modules/rambda/src/unless.js new file mode 100644 index 0000000..22cc648 --- /dev/null +++ b/src/lib/node_modules/rambda/src/unless.js @@ -0,0 +1,7 @@ +export function unless(predicate, whenFalse){ + if (arguments.length === 1){ + return _whenFalse => unless(predicate, _whenFalse) + } + + return input => predicate(input) ? input : whenFalse(input) +} diff --git a/src/lib/node_modules/rambda/src/unwind.js b/src/lib/node_modules/rambda/src/unwind.js new file mode 100644 index 0000000..a714f69 --- /dev/null +++ b/src/lib/node_modules/rambda/src/unwind.js @@ -0,0 +1,16 @@ +import { isArray } from './_internals/isArray.js' +import { mapArray } from './map.js' + +export function unwind(property, obj){ + if (arguments.length === 1){ + return _obj => unwind(property, _obj) + } + + if (!isArray(obj[ property ])) return [ obj ] + + return mapArray(x => ({ + ...obj, + [ property ] : x, + }), + obj[ property ]) +} diff --git a/src/lib/node_modules/rambda/src/update.js b/src/lib/node_modules/rambda/src/update.js new file mode 100644 index 0000000..8b04ef7 --- /dev/null +++ b/src/lib/node_modules/rambda/src/update.js @@ -0,0 +1,15 @@ +import { cloneList } from './_internals/cloneList.js' +import { curry } from './curry.js' + +export function updateFn( + index, newValue, list +){ + const clone = cloneList(list) + if (index === -1) return clone.fill(newValue, index) + + return clone.fill( + newValue, index, index + 1 + ) +} + +export const update = curry(updateFn) diff --git a/src/lib/node_modules/rambda/src/values.js b/src/lib/node_modules/rambda/src/values.js new file mode 100644 index 0000000..fa6cd84 --- /dev/null +++ b/src/lib/node_modules/rambda/src/values.js @@ -0,0 +1,7 @@ +import { type } from './type.js' + +export function values(obj){ + if (type(obj) !== 'Object') return [] + + return Object.values(obj) +} diff --git a/src/lib/node_modules/rambda/src/view.js b/src/lib/node_modules/rambda/src/view.js new file mode 100644 index 0000000..97a3f52 --- /dev/null +++ b/src/lib/node_modules/rambda/src/view.js @@ -0,0 +1,10 @@ +const Const = x => ({ + x, + map : fn => Const(x), +}) + +export function view(lens, target){ + if (arguments.length === 1) return _target => view(lens, _target) + + return lens(Const)(target).x +} diff --git a/src/lib/node_modules/rambda/src/when.js b/src/lib/node_modules/rambda/src/when.js new file mode 100644 index 0000000..fd4cfd0 --- /dev/null +++ b/src/lib/node_modules/rambda/src/when.js @@ -0,0 +1,11 @@ +import { curry } from './curry.js' + +function whenFn( + predicate, whenTrueFn, input +){ + if (!predicate(input)) return input + + return whenTrueFn(input) +} + +export const when = curry(whenFn) diff --git a/src/lib/node_modules/rambda/src/where.js b/src/lib/node_modules/rambda/src/where.js new file mode 100644 index 0000000..cc2b000 --- /dev/null +++ b/src/lib/node_modules/rambda/src/where.js @@ -0,0 +1,15 @@ +export function where(conditions, input){ + if (input === undefined){ + return _input => where(conditions, _input) + } + let flag = true + for (const prop in conditions){ + if (!flag) continue + const result = conditions[ prop ](input[ prop ]) + if (flag && result === false){ + flag = false + } + } + + return flag +} diff --git a/src/lib/node_modules/rambda/src/whereAny.js b/src/lib/node_modules/rambda/src/whereAny.js new file mode 100644 index 0000000..f6f1287 --- /dev/null +++ b/src/lib/node_modules/rambda/src/whereAny.js @@ -0,0 +1,12 @@ +export function whereAny(conditions, input){ + if (input === undefined){ + return _input => whereAny(conditions, _input) + } + for (const prop in conditions){ + if (conditions[ prop ](input[ prop ])){ + return true + } + } + + return false +} diff --git a/src/lib/node_modules/rambda/src/whereEq.js b/src/lib/node_modules/rambda/src/whereEq.js new file mode 100644 index 0000000..ce0a6be --- /dev/null +++ b/src/lib/node_modules/rambda/src/whereEq.js @@ -0,0 +1,14 @@ +import { equals } from './equals.js' +import { filter } from './filter.js' + +export function whereEq(condition, input){ + if (arguments.length === 1){ + return _input => whereEq(condition, _input) + } + + const result = filter((conditionValue, conditionProp) => + equals(conditionValue, input[ conditionProp ]), + condition) + + return Object.keys(result).length === Object.keys(condition).length +} diff --git a/src/lib/node_modules/rambda/src/without.js b/src/lib/node_modules/rambda/src/without.js new file mode 100644 index 0000000..3b51185 --- /dev/null +++ b/src/lib/node_modules/rambda/src/without.js @@ -0,0 +1,15 @@ +import { _indexOf } from './equals.js' +import { reduce } from './reduce.js' + +export function without(matchAgainst, source){ + if (source === undefined){ + return _source => without(matchAgainst, _source) + } + + return reduce( + (prev, current) => + _indexOf(current, matchAgainst) > -1 ? prev : prev.concat(current), + [], + source + ) +} diff --git a/src/lib/node_modules/rambda/src/xor.js b/src/lib/node_modules/rambda/src/xor.js new file mode 100644 index 0000000..ccdabf8 --- /dev/null +++ b/src/lib/node_modules/rambda/src/xor.js @@ -0,0 +1,5 @@ +export function xor(a, b){ + if (arguments.length === 1) return _b => xor(a, _b) + + return Boolean(a) && !b || Boolean(b) && !a +} diff --git a/src/lib/node_modules/rambda/src/zip.js b/src/lib/node_modules/rambda/src/zip.js new file mode 100644 index 0000000..fe5006f --- /dev/null +++ b/src/lib/node_modules/rambda/src/zip.js @@ -0,0 +1,12 @@ +export function zip(left, right){ + if (arguments.length === 1) return _right => zip(left, _right) + + const result = [] + const length = Math.min(left.length, right.length) + + for (let i = 0; i < length; i++){ + result[ i ] = [ left[ i ], right[ i ] ] + } + + return result +} diff --git a/src/lib/node_modules/rambda/src/zipObj.js b/src/lib/node_modules/rambda/src/zipObj.js new file mode 100644 index 0000000..d976944 --- /dev/null +++ b/src/lib/node_modules/rambda/src/zipObj.js @@ -0,0 +1,13 @@ +import { take } from './take.js' + +export function zipObj(keys, values){ + if (arguments.length === 1) return yHolder => zipObj(keys, yHolder) + + return take(values.length, keys).reduce(( + prev, xInstance, i + ) => { + prev[ xInstance ] = values[ i ] + + return prev + }, {}) +} diff --git a/src/lib/node_modules/rambda/src/zipWith.js b/src/lib/node_modules/rambda/src/zipWith.js new file mode 100644 index 0000000..4f64157 --- /dev/null +++ b/src/lib/node_modules/rambda/src/zipWith.js @@ -0,0 +1,10 @@ +import { curry } from './curry.js' +import { take } from './take.js' + +function zipWithFn( + fn, x, y +){ + return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[ i ])) +} + +export const zipWith = curry(zipWithFn) diff --git a/src/lib/package.json b/src/lib/package.json new file mode 100644 index 0000000..6c4f03f --- /dev/null +++ b/src/lib/package.json @@ -0,0 +1,26 @@ +{ + "name": "@lingdocs/inflect", + "version": "0.0.7", + "description": "Pashto inflector library", + "main": "dist/index.js", + "types": "dist/lib/library.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/lingdocs/pashto-inflector.git" + }, + "publishConfig": { + "registry": "https://npm.lingdocs.com" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "echo \"build from repo root\"" + }, + "author": "lingdocs.com", + "license": "MIT", + "dependencies": { + "rambda": "^7.3.0", + "pbf": "^3.2.1" + } +} diff --git a/src/lib/accent-and-ps-utils.test.ts b/src/lib/src/accent-and-ps-utils.test.ts similarity index 100% rename from src/lib/accent-and-ps-utils.test.ts rename to src/lib/src/accent-and-ps-utils.test.ts diff --git a/src/lib/accent-and-ps-utils.ts b/src/lib/src/accent-and-ps-utils.ts similarity index 96% rename from src/lib/accent-and-ps-utils.ts rename to src/lib/src/accent-and-ps-utils.ts index 7c01ad7..ac4f2d2 100644 --- a/src/lib/accent-and-ps-utils.ts +++ b/src/lib/src/accent-and-ps-utils.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; /** * Creates a Pashto string structure diff --git a/src/lib/accent-helpers.test.ts b/src/lib/src/accent-helpers.test.ts similarity index 100% rename from src/lib/accent-helpers.test.ts rename to src/lib/src/accent-helpers.test.ts diff --git a/src/lib/accent-helpers.ts b/src/lib/src/accent-helpers.ts similarity index 99% rename from src/lib/accent-helpers.ts rename to src/lib/src/accent-helpers.ts index df3de22..127f51b 100644 --- a/src/lib/accent-helpers.ts +++ b/src/lib/src/accent-helpers.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; import { makePsString, removeFVarients } from "./accent-and-ps-utils"; /** diff --git a/src/lib/convert-spelling.test.ts b/src/lib/src/convert-spelling.test.ts similarity index 100% rename from src/lib/convert-spelling.test.ts rename to src/lib/src/convert-spelling.test.ts diff --git a/src/lib/convert-spelling.ts b/src/lib/src/convert-spelling.ts similarity index 98% rename from src/lib/convert-spelling.ts rename to src/lib/src/convert-spelling.ts index e54a4fa..f9bb4ab 100644 --- a/src/lib/convert-spelling.ts +++ b/src/lib/src/convert-spelling.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; /** * takes a string of standard Afghan Pashto text and puts it into the same or a different spelling system diff --git a/src/lib/default-text-options.ts b/src/lib/src/default-text-options.ts similarity index 81% rename from src/lib/default-text-options.ts rename to src/lib/src/default-text-options.ts index bb60220..ea76817 100644 --- a/src/lib/default-text-options.ts +++ b/src/lib/src/default-text-options.ts @@ -6,7 +6,7 @@ * */ -import { TextOptions } from "../types"; +import { TextOptions } from "../../types"; const defualtTextOptions: TextOptions = { pTextSize: "normal", diff --git a/src/lib/diacritics-helpers.test.ts b/src/lib/src/diacritics-helpers.test.ts similarity index 100% rename from src/lib/diacritics-helpers.test.ts rename to src/lib/src/diacritics-helpers.test.ts diff --git a/src/lib/diacritics-helpers.ts b/src/lib/src/diacritics-helpers.ts similarity index 100% rename from src/lib/diacritics-helpers.ts rename to src/lib/src/diacritics-helpers.ts diff --git a/src/lib/diacritics.test.ts b/src/lib/src/diacritics.test.ts similarity index 99% rename from src/lib/diacritics.test.ts rename to src/lib/src/diacritics.test.ts index 315c535..aca78da 100644 --- a/src/lib/diacritics.test.ts +++ b/src/lib/src/diacritics.test.ts @@ -15,7 +15,7 @@ import { sukun, tashdeed, } from "./diacritics-helpers"; -import * as T from "../types"; +import * as T from "../../types"; const diacriticsSections: { describe: string, diff --git a/src/lib/diacritics.ts b/src/lib/src/diacritics.ts similarity index 99% rename from src/lib/diacritics.ts rename to src/lib/src/diacritics.ts index 42707b5..c3c1f1f 100644 --- a/src/lib/diacritics.ts +++ b/src/lib/src/diacritics.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; import { splitFIntoPhonemes, Phoneme, diff --git a/src/lib/dictionary-models.js b/src/lib/src/dictionary-models.js similarity index 100% rename from src/lib/dictionary-models.js rename to src/lib/src/dictionary-models.js diff --git a/src/lib/dictionary.proto b/src/lib/src/dictionary.proto similarity index 100% rename from src/lib/dictionary.proto rename to src/lib/src/dictionary.proto diff --git a/src/lib/dyn-comp-aux-verbs.ts b/src/lib/src/dyn-comp-aux-verbs.ts similarity index 99% rename from src/lib/dyn-comp-aux-verbs.ts rename to src/lib/src/dyn-comp-aux-verbs.ts index cd42637..e1614bd 100644 --- a/src/lib/dyn-comp-aux-verbs.ts +++ b/src/lib/src/dyn-comp-aux-verbs.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; // TODO: Automatice syncing of aux verbs from dictionary diff --git a/src/lib/fields.ts b/src/lib/src/fields.ts similarity index 94% rename from src/lib/fields.ts rename to src/lib/src/fields.ts index 14e6d8c..a98fe31 100644 --- a/src/lib/fields.ts +++ b/src/lib/src/fields.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; export const dictionaryEntryTextFields: T.DictionaryEntryTextField[] = [ "p", diff --git a/src/lib/get-english-word.test.ts b/src/lib/src/get-english-word.test.ts similarity index 100% rename from src/lib/get-english-word.test.ts rename to src/lib/src/get-english-word.test.ts diff --git a/src/lib/get-english-word.ts b/src/lib/src/get-english-word.ts similarity index 97% rename from src/lib/get-english-word.ts rename to src/lib/src/get-english-word.ts index 5d177c4..05c067a 100644 --- a/src/lib/get-english-word.ts +++ b/src/lib/src/get-english-word.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; /** * returns the singular and plural english word for a Pashto entry if possible diff --git a/src/lib/grammar-units.ts b/src/lib/src/grammar-units.ts similarity index 99% rename from src/lib/grammar-units.ts rename to src/lib/src/grammar-units.ts index cfb63d1..585ade8 100644 --- a/src/lib/grammar-units.ts +++ b/src/lib/src/grammar-units.ts @@ -7,7 +7,7 @@ */ import { kawulStat } from "./irregular-conjugations"; -import * as T from "../types"; +import * as T from "../../types"; export const negativeParticle: { imperative: T.PsString, diff --git a/src/lib/human-readable.ts b/src/lib/src/human-readable.ts similarity index 98% rename from src/lib/human-readable.ts rename to src/lib/src/human-readable.ts index 9eff205..1e43368 100644 --- a/src/lib/human-readable.ts +++ b/src/lib/src/human-readable.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; import { isModalTense, isPerfectTense, diff --git a/src/lib/inflection-pattern.tsx b/src/lib/src/inflection-pattern.ts similarity index 51% rename from src/lib/inflection-pattern.tsx rename to src/lib/src/inflection-pattern.ts index beb834b..63cb8e8 100644 --- a/src/lib/inflection-pattern.tsx +++ b/src/lib/src/inflection-pattern.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; import { isFemNounEntry, isNounEntry, @@ -9,7 +9,6 @@ import { isPattern5Entry, isPattern6FemEntry, } from "./type-predicates"; -import InlinePs from "../components/InlinePs"; export function getInflectionPattern(e: T.NounEntry | T.AdjectiveEntry): T.InflectionPattern { return isPattern1Entry(e) @@ -25,20 +24,4 @@ export function getInflectionPattern(e: T.NounEntry | T.AdjectiveEntry): T.Infle : isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e) ? T.InflectionPattern.FemInanEe : T.InflectionPattern.None; -} - -export function humanReadableInflectionPattern(p: T.InflectionPattern, textOptions: T.TextOptions): JSX.Element | null { - return p === 1 - ? #1 Basic - : p === 2 - ? #2 Unstressed {{ p: "ی", f: "ey", e: "" }} - : p === 3 - ? #3 Stressed {{ p: "ی", f: "éy", e: "" }} - : p === 4 - ? #4 "Pashtoon" - : p === 5 - ? #5 Short Squish - : p === 6 - ? #6 Fem. inan. {{ p: "ي", f: "ee", e: "" }} - : null; } \ No newline at end of file diff --git a/src/lib/irregular-conjugations.ts b/src/lib/src/irregular-conjugations.ts similarity index 99% rename from src/lib/irregular-conjugations.ts rename to src/lib/src/irregular-conjugations.ts index 7968cf3..8d779be 100644 --- a/src/lib/irregular-conjugations.ts +++ b/src/lib/src/irregular-conjugations.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; // shared bits const kedulStatModal: T.ModalContent = { diff --git a/src/lib/is-pashto.test.ts b/src/lib/src/is-pashto.test.ts similarity index 100% rename from src/lib/is-pashto.test.ts rename to src/lib/src/is-pashto.test.ts diff --git a/src/lib/is-pashto.ts b/src/lib/src/is-pashto.ts similarity index 100% rename from src/lib/is-pashto.ts rename to src/lib/src/is-pashto.ts diff --git a/src/lib/misc-helpers.test.ts b/src/lib/src/misc-helpers.test.ts similarity index 98% rename from src/lib/misc-helpers.test.ts rename to src/lib/src/misc-helpers.test.ts index 0223917..4fc2009 100644 --- a/src/lib/misc-helpers.test.ts +++ b/src/lib/src/misc-helpers.test.ts @@ -10,7 +10,7 @@ parseEc, personFromVerbBlockPos, } from "./misc-helpers"; -import * as T from "../types"; +import * as T from "../../types"; test("personFromVerbBlockPos should work", () => { expect(personFromVerbBlockPos([0, 0])).toEqual(T.Person.FirstSingMale); diff --git a/src/lib/misc-helpers.ts b/src/lib/src/misc-helpers.ts similarity index 99% rename from src/lib/misc-helpers.ts rename to src/lib/src/misc-helpers.ts index c2dba07..983671e 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/src/misc-helpers.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; export const blank: T.PsString = { p: "_____", diff --git a/src/lib/np-tools.ts b/src/lib/src/np-tools.ts similarity index 93% rename from src/lib/np-tools.ts rename to src/lib/src/np-tools.ts index d1ad359..9c0f442 100644 --- a/src/lib/np-tools.ts +++ b/src/lib/src/np-tools.ts @@ -1,6 +1,5 @@ -import * as T from "../types"; -import { isFirstPerson, parseEc } from "../lib/misc-helpers"; -import { isSecondPerson } from "./phrase-building/vp-tools"; +import * as T from "../../types"; +import { isFirstPerson, parseEc, isSecondPerson } from "./misc-helpers"; function getRandPers(): T.Person { return Math.floor(Math.random() * 12); diff --git a/src/lib/p-text-helpers.test.ts b/src/lib/src/p-text-helpers.test.ts similarity index 99% rename from src/lib/p-text-helpers.test.ts rename to src/lib/src/p-text-helpers.test.ts index 99db59a..fe26e40 100644 --- a/src/lib/p-text-helpers.test.ts +++ b/src/lib/src/p-text-helpers.test.ts @@ -25,7 +25,7 @@ import { splitPsByVarients, endsWith, } from "./p-text-helpers"; -import * as T from "../types"; +import * as T from "../../types"; import { pastEndings } from "./grammar-units"; diff --git a/src/lib/p-text-helpers.ts b/src/lib/src/p-text-helpers.ts similarity index 99% rename from src/lib/p-text-helpers.ts rename to src/lib/src/p-text-helpers.ts index b4678da..b5c68a6 100644 --- a/src/lib/p-text-helpers.ts +++ b/src/lib/src/p-text-helpers.ts @@ -11,7 +11,7 @@ import { getVerbBlockPosFromPerson, getPersonInflectionsKey, } from "./misc-helpers"; -import * as T from "../types"; +import * as T from "../../types"; import { hasAccents, removeAccents, diff --git a/src/lib/pashto-consonants.ts b/src/lib/src/pashto-consonants.ts similarity index 100% rename from src/lib/pashto-consonants.ts rename to src/lib/src/pashto-consonants.ts diff --git a/src/lib/pashto-inflector.test.ts b/src/lib/src/pashto-inflector.test.ts similarity index 99% rename from src/lib/pashto-inflector.test.ts rename to src/lib/src/pashto-inflector.test.ts index 2623aa8..582fe99 100644 --- a/src/lib/pashto-inflector.test.ts +++ b/src/lib/src/pashto-inflector.test.ts @@ -12,7 +12,7 @@ import { inflectRegularYeyUnisex, inflectWord, } from "./pashto-inflector"; -import * as T from "../types"; +import * as T from "../../types"; const adjectives: Array<{ in: T.DictionaryEntry, diff --git a/src/lib/pashto-inflector.ts b/src/lib/src/pashto-inflector.ts similarity index 99% rename from src/lib/pashto-inflector.ts rename to src/lib/src/pashto-inflector.ts index f90d7e2..25720f4 100644 --- a/src/lib/pashto-inflector.ts +++ b/src/lib/src/pashto-inflector.ts @@ -27,7 +27,7 @@ import { removeAccents, splitUpSyllables, } from "./accent-helpers"; -import * as T from "../types"; +import * as T from "../../types"; import { splitFIntoPhonemes } from "./phonetics-to-diacritics"; const endingInSingleARegex = /[^a]'?’?[aá]'?’?$/; diff --git a/src/lib/phonetics-to-diacritics.test.ts b/src/lib/src/phonetics-to-diacritics.test.ts similarity index 100% rename from src/lib/phonetics-to-diacritics.test.ts rename to src/lib/src/phonetics-to-diacritics.test.ts diff --git a/src/lib/phonetics-to-diacritics.ts b/src/lib/src/phonetics-to-diacritics.ts similarity index 100% rename from src/lib/phonetics-to-diacritics.ts rename to src/lib/src/phonetics-to-diacritics.ts diff --git a/src/lib/phrase-building/blocks-utils.ts b/src/lib/src/phrase-building/blocks-utils.ts similarity index 99% rename from src/lib/phrase-building/blocks-utils.ts rename to src/lib/src/phrase-building/blocks-utils.ts index 7433cef..f3d3ac8 100644 --- a/src/lib/phrase-building/blocks-utils.ts +++ b/src/lib/src/phrase-building/blocks-utils.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { getLength } from "../p-text-helpers"; export function isRenderedVerbB(block: T.Block["block"]): block is T.RenderedVerbB { diff --git a/src/lib/phrase-building/compile.ts b/src/lib/src/phrase-building/compile.ts similarity index 99% rename from src/lib/phrase-building/compile.ts rename to src/lib/src/phrase-building/compile.ts index 5e5685a..552e458 100644 --- a/src/lib/phrase-building/compile.ts +++ b/src/lib/src/phrase-building/compile.ts @@ -1,9 +1,9 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { capitalizeFirstLetter, concatPsString, getLong, getShort, } from "../p-text-helpers"; -import { negativeParticle } from "../../lib/grammar-units"; +import { negativeParticle } from "../grammar-units"; import * as grammarUnits from "../grammar-units"; import { removeDuplicates, @@ -28,7 +28,7 @@ import { import { blank, kidsBlank, -} from "../../lib/misc-helpers"; +} from "../misc-helpers"; type BlankoutOptions = { diff --git a/src/lib/phrase-building/english-vp-rendering.ts b/src/lib/src/phrase-building/english-vp-rendering.ts similarity index 99% rename from src/lib/phrase-building/english-vp-rendering.ts rename to src/lib/src/phrase-building/english-vp-rendering.ts index 940cb44..f9664ec 100644 --- a/src/lib/phrase-building/english-vp-rendering.ts +++ b/src/lib/src/phrase-building/english-vp-rendering.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { getVerbBlockPosFromPerson, parseEc } from "../misc-helpers"; import * as grammarUnits from "../grammar-units"; import { diff --git a/src/components/ep-explorer/eps-reducer.ts b/src/lib/src/phrase-building/eps-reducer.ts similarity index 95% rename from src/components/ep-explorer/eps-reducer.ts rename to src/lib/src/phrase-building/eps-reducer.ts index 3b75442..c865cea 100644 --- a/src/components/ep-explorer/eps-reducer.ts +++ b/src/lib/src/phrase-building/eps-reducer.ts @@ -1,11 +1,11 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { personGender, personNumber, -} from "../../lib/misc-helpers"; -import { isUnisexNounEntry } from "../../lib/type-predicates"; -import { checkForMiniPronounsError } from "../../lib/phrase-building/compile"; -import { adjustSubjectSelection, getSubjectSelection, insertNewAP, removeAP, setAP, shiftBlock } from "../../lib/phrase-building/blocks-utils"; +} from "../misc-helpers"; +import { isUnisexNounEntry } from "../type-predicates"; +import { checkForMiniPronounsError } from "./compile"; +import { adjustSubjectSelection, getSubjectSelection, insertNewAP, removeAP, setAP, shiftBlock } from "./blocks-utils"; export type EpsReducerAction = { type: "set predicate type", diff --git a/src/lib/src/phrase-building/make-selections.ts b/src/lib/src/phrase-building/make-selections.ts new file mode 100644 index 0000000..dc3bb9a --- /dev/null +++ b/src/lib/src/phrase-building/make-selections.ts @@ -0,0 +1,52 @@ +import { + isPluralNounEntry, + isMascNounEntry, + isUnisexNounEntry, +} from "../type-predicates"; +import * as T from "../../../types"; + +export function makeAdverbSelection(entry: T.AdverbEntry): T.AdverbSelection { + return { + type: "adverb", + entry: entry, + }; +} + +export function makeLocativeAdverbSelection(entry: T.LocativeAdverbEntry): T.LocativeAdverbSelection { + return { + type: "loc. adv.", + entry: entry, + }; +} + +export function makeAdjectiveSelection(entry: T.AdjectiveEntry): T.AdjectiveSelection { + return { + type: "adjective", + entry: entry, + sandwich: undefined, + }; +} + +export function makeParticipleSelection(verb: T.VerbEntry): T.ParticipleSelection { + return { + type: "participle", + verb, + possesor: undefined, + }; +} + +export function makeNounSelection(entry: T.NounEntry, old: T.NounSelection | undefined, dynamicComplement?: true): T.NounSelection { + const number = isPluralNounEntry(entry) ? "plural" : "singular"; + return { + type: "noun", + entry, + gender: isMascNounEntry(entry) ? "masc" : "fem", + genderCanChange: isUnisexNounEntry(entry), + number, + numberCanChange: number === "singular", + adjectives: (!dynamicComplement && old) ? old.adjectives : [], + possesor: !dynamicComplement ? old?.possesor : undefined, + dynamicComplement, + demonstrative: undefined, + }; +} \ No newline at end of file diff --git a/src/lib/phrase-building/np-tools.ts b/src/lib/src/phrase-building/np-tools.ts similarity index 99% rename from src/lib/phrase-building/np-tools.ts rename to src/lib/src/phrase-building/np-tools.ts index e4bc4dc..d59130b 100644 --- a/src/lib/phrase-building/np-tools.ts +++ b/src/lib/src/phrase-building/np-tools.ts @@ -1,8 +1,8 @@ import { isFirstPerson, isSecondPerson, -} from "../../lib/misc-helpers"; -import * as T from "../../types"; +} from "../misc-helpers"; +import * as T from "../../../types"; import { concatPsString } from "../p-text-helpers"; function getBaseAndAdjectives({ selection }: T.Rendered): T.PsString[] { diff --git a/src/lib/phrase-building/render-adj.ts b/src/lib/src/phrase-building/render-adj.ts similarity index 91% rename from src/lib/phrase-building/render-adj.ts rename to src/lib/src/phrase-building/render-adj.ts index ef79c69..f602cba 100644 --- a/src/lib/phrase-building/render-adj.ts +++ b/src/lib/src/phrase-building/render-adj.ts @@ -1,14 +1,14 @@ -import * as T from "../../types"; -import { inflectWord } from "../../lib/pashto-inflector"; +import * as T from "../../../types"; +import { inflectWord } from "../pashto-inflector"; import { psStringFromEntry, isUnisexSet, -} from "../../lib/p-text-helpers"; +} from "../p-text-helpers"; import { getEnglishWord } from "../get-english-word"; import { personGender, personIsPlural, -} from "../../lib/misc-helpers"; +} from "../misc-helpers"; import { renderSandwich } from "./render-sandwich"; import { isPattern1Entry } from "../type-predicates"; diff --git a/src/lib/phrase-building/render-ap.ts b/src/lib/src/phrase-building/render-ap.ts similarity index 96% rename from src/lib/phrase-building/render-ap.ts rename to src/lib/src/phrase-building/render-ap.ts index 192cd83..7c01703 100644 --- a/src/lib/phrase-building/render-ap.ts +++ b/src/lib/src/phrase-building/render-ap.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { getEnglishWord } from "../get-english-word"; import { psStringFromEntry } from "../p-text-helpers"; import { renderAdverbSelection } from "./render-ep"; diff --git a/src/lib/phrase-building/render-common.ts b/src/lib/src/phrase-building/render-common.ts similarity index 97% rename from src/lib/phrase-building/render-common.ts rename to src/lib/src/phrase-building/render-common.ts index a68b4dd..b789ae2 100644 --- a/src/lib/phrase-building/render-common.ts +++ b/src/lib/src/phrase-building/render-common.ts @@ -1,10 +1,10 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { getPersonFromNP, } from "./vp-tools"; import { pronouns } from "../grammar-units"; import { getVerbBlockPosFromPerson } from "../misc-helpers"; -import { getFirstSecThird } from "../../lib/misc-helpers"; +import { getFirstSecThird } from "../misc-helpers"; export function findPossesivesToShrink( blocks: (T.EPSBlockComplete | T.VPSBlockComplete | T.SubjectSelectionComplete | T.PredicateSelectionComplete | T.APSelection)[], diff --git a/src/lib/phrase-building/render-complement.ts b/src/lib/src/phrase-building/render-complement.ts similarity index 97% rename from src/lib/phrase-building/render-complement.ts rename to src/lib/src/phrase-building/render-complement.ts index 43caaae..f57412b 100644 --- a/src/lib/phrase-building/render-complement.ts +++ b/src/lib/src/phrase-building/render-complement.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { renderNounSelection } from "./render-np"; import { renderAdjectiveSelection } from "./render-adj"; import { renderSandwich } from "./render-sandwich"; diff --git a/src/lib/phrase-building/render-ep.ts b/src/lib/src/phrase-building/render-ep.ts similarity index 98% rename from src/lib/phrase-building/render-ep.ts rename to src/lib/src/phrase-building/render-ep.ts index 6b9ffac..1c89920 100644 --- a/src/lib/phrase-building/render-ep.ts +++ b/src/lib/src/phrase-building/render-ep.ts @@ -1,10 +1,10 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import * as g from "../grammar-units"; import { getPersonFromNP, } from "./vp-tools"; import { renderNPSelection } from "./render-np"; -import { getPersonFromVerbForm } from "../../lib/misc-helpers"; +import { getPersonFromVerbForm } from "../misc-helpers"; import { getVerbBlockPosFromPerson } from "../misc-helpers"; import { getEnglishWord } from "../get-english-word"; import { psStringFromEntry } from "../p-text-helpers"; diff --git a/src/lib/phrase-building/render-np.ts b/src/lib/src/phrase-building/render-np.ts similarity index 99% rename from src/lib/phrase-building/render-np.ts rename to src/lib/src/phrase-building/render-np.ts index cb181d6..8229fc9 100644 --- a/src/lib/phrase-building/render-np.ts +++ b/src/lib/src/phrase-building/render-np.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { inflectWord } from "../pashto-inflector"; import * as grammarUnits from "../grammar-units"; import { @@ -11,7 +11,7 @@ import { } from "../p-text-helpers"; import { getEnglishParticiple, -} from "../../lib/np-tools"; +} from "../np-tools"; import { getEnglishWord } from "../get-english-word"; import { renderAdjectiveSelection } from "./render-adj"; import { isPattern5Entry, isAnimNounEntry, isPattern1Entry } from "../type-predicates"; diff --git a/src/lib/phrase-building/render-sandwich.ts b/src/lib/src/phrase-building/render-sandwich.ts similarity index 95% rename from src/lib/phrase-building/render-sandwich.ts rename to src/lib/src/phrase-building/render-sandwich.ts index 6ff09a6..8faeff5 100644 --- a/src/lib/phrase-building/render-sandwich.ts +++ b/src/lib/src/phrase-building/render-sandwich.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { isPattern5Entry, isAnimNounEntry } from "../type-predicates"; import { renderNPSelection } from "./render-np"; diff --git a/src/lib/phrase-building/render-vp.ts b/src/lib/src/phrase-building/render-vp.ts similarity index 99% rename from src/lib/phrase-building/render-vp.ts rename to src/lib/src/phrase-building/render-vp.ts index dc2d55b..2009b8a 100644 --- a/src/lib/phrase-building/render-vp.ts +++ b/src/lib/src/phrase-building/render-vp.ts @@ -1,4 +1,4 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { getVerbBlockPosFromPerson, } from "../misc-helpers"; @@ -28,13 +28,13 @@ import { isTlulVerb, } from "../type-predicates"; import { renderEnglishVPBase } from "./english-vp-rendering"; -import { personGender } from "../../lib/misc-helpers"; +import { personGender } from "../misc-helpers"; import { renderNPSelection } from "./render-np"; import { findPerfectiveHead, getObjectSelection, getSubjectSelection, makeBlock, makeKid } from "./blocks-utils"; import { renderAPSelection } from "./render-ap"; import { findPossesivesToShrink, orderKids, getMiniPronounPs } from "./render-common"; import { renderComplementSelection } from "./render-complement"; -import { makeNounSelection } from "../../components/np-picker/picker-tools"; +import { makeNounSelection } from "./make-selections"; export function renderVP(VP: T.VPSelectionComplete): T.VPRendered { const subject = getSubjectSelection(VP.blocks).selection; diff --git a/src/components/vp-explorer/verb-selection.ts b/src/lib/src/phrase-building/verb-selection.ts similarity index 94% rename from src/components/vp-explorer/verb-selection.ts rename to src/lib/src/phrase-building/verb-selection.ts index 7fcb4ae..a0a0293 100644 --- a/src/components/vp-explorer/verb-selection.ts +++ b/src/lib/src/phrase-building/verb-selection.ts @@ -1,9 +1,15 @@ import { makeNounSelection, -} from "../np-picker/picker-tools"; -import * as T from "../../types"; -import { getVerbInfo } from "../../lib/verb-info"; -import { adjustObjectSelection, getObjectSelection, getSubjectSelection, makeObjectSelection, makeSubjectSelection } from "../../lib/phrase-building/blocks-utils"; +} from "./make-selections"; +import * as T from "../../../types"; +import { getVerbInfo } from "../verb-info"; +import { + adjustObjectSelection, + getObjectSelection, + getSubjectSelection, + makeObjectSelection, + makeSubjectSelection, +} from "./blocks-utils"; export function makeVPSelectionState( verb: T.VerbEntry, diff --git a/src/lib/phrase-building/vp-tools.ts b/src/lib/src/phrase-building/vp-tools.ts similarity index 96% rename from src/lib/phrase-building/vp-tools.ts rename to src/lib/src/phrase-building/vp-tools.ts index 36525b8..911030c 100644 --- a/src/lib/phrase-building/vp-tools.ts +++ b/src/lib/src/phrase-building/vp-tools.ts @@ -1,12 +1,12 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { concatPsString, psRemove, psStringEquals, -} from "../../lib/p-text-helpers"; +} from "../p-text-helpers"; import { isImperativeTense, isPerfectTense } from "../type-predicates"; -import * as grammarUnits from "../../lib/grammar-units"; -import { randomNumber } from "../../lib/misc-helpers"; +import * as grammarUnits from "../grammar-units"; +import { isSecondPerson, randomNumber } from "../misc-helpers"; import { adjustObjectSelection, adjustSubjectSelection, getObjectSelection, getSubjectSelection, VPSBlocksAreComplete } from "./blocks-utils"; export function isInvalidSubjObjCombo(subj: T.Person, obj: T.Person): boolean { @@ -240,15 +240,6 @@ export function completeVPSelection(vps: T.VPSelectionState): T.VPSelectionCompl }; } -export function isSecondPerson(p: T.Person): boolean { - return ( - p === T.Person.SecondSingMale || - p === T.Person.SecondSingFemale || - p === T.Person.SecondPlurMale || - p === T.Person.SecondPlurFemale - ); -} - export function isThirdPerson(p: T.Person): boolean { return ( p === T.Person.ThirdSingMale || diff --git a/src/components/vp-explorer/vps-reducer.ts b/src/lib/src/phrase-building/vps-reducer.ts similarity index 94% rename from src/components/vp-explorer/vps-reducer.ts rename to src/lib/src/phrase-building/vps-reducer.ts index cf4681d..e4a543e 100644 --- a/src/components/vp-explorer/vps-reducer.ts +++ b/src/lib/src/phrase-building/vps-reducer.ts @@ -1,19 +1,25 @@ -import * as T from "../../types"; +import * as T from "../../../types"; import { isInvalidSubjObjCombo, -} from "../../lib/phrase-building/vp-tools"; -import { switchSubjObj } from "../../lib/phrase-building/vp-tools"; -import { changeStatDyn, changeTransitivity } from "./verb-selection"; -import { ensure2ndPersSubjPronounAndNoConflict } from "../../lib/phrase-building/vp-tools"; +} from "./vp-tools"; +import { switchSubjObj } from "./vp-tools"; +import { ensure2ndPersSubjPronounAndNoConflict } from "./vp-tools"; import { isPerfectTense, isImperativeTense, -} from "../../lib/type-predicates"; -import { checkForMiniPronounsError } from "../../lib/phrase-building/compile"; +} from "../type-predicates"; +import { checkForMiniPronounsError } from "./compile"; import { - makeVPSelectionState, -} from "./verb-selection"; -import { adjustObjectSelection, adjustSubjectSelection, getObjectSelection, getSubjectSelection, insertNewAP, removeAP, setAP, shiftBlock } from "../../lib/phrase-building/blocks-utils"; + adjustObjectSelection, + adjustSubjectSelection, + getObjectSelection, + getSubjectSelection, + insertNewAP, + removeAP, + setAP, + shiftBlock, +} from "./blocks-utils"; +import { changeStatDyn, changeTransitivity, makeVPSelectionState } from "./verb-selection"; export type VpsReducerAction = { type: "load vps", @@ -324,4 +330,5 @@ function hasPronounConflict(subject: T.NPSelection | undefined, object: undefine const objPronoun = (object && typeof object === "object" && object.selection.type === "pronoun") ? object.selection : undefined; if (!subjPronoun || !objPronoun) return false; return isInvalidSubjObjCombo(subjPronoun.person, objPronoun.person); -} \ No newline at end of file +} + diff --git a/src/lib/protobuf.test.ts b/src/lib/src/protobuf.test.ts similarity index 95% rename from src/lib/protobuf.test.ts rename to src/lib/src/protobuf.test.ts index e8f7d21..eb0eacd 100644 --- a/src/lib/protobuf.test.ts +++ b/src/lib/src/protobuf.test.ts @@ -4,7 +4,7 @@ import { writeDictionary, readDictionary, } from "./protobuf"; -import * as T from "../types"; +import * as T from "../../types"; const sampleDictionaryInfo: T.DictionaryInfo = { title: "Sample Dictionary", diff --git a/src/lib/protobuf.ts b/src/lib/src/protobuf.ts similarity index 96% rename from src/lib/protobuf.ts rename to src/lib/src/protobuf.ts index c36372b..478d2b8 100644 --- a/src/lib/protobuf.ts +++ b/src/lib/src/protobuf.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; // @ts-ignore import { Dictionary, DictionaryInfo } from "./dictionary-models"; import Pbf from "pbf"; diff --git a/src/lib/sandwiches.ts b/src/lib/src/sandwiches.ts similarity index 98% rename from src/lib/sandwiches.ts rename to src/lib/src/sandwiches.ts index 4406cc0..e3db367 100644 --- a/src/lib/sandwiches.ts +++ b/src/lib/src/sandwiches.ts @@ -1,4 +1,4 @@ -import * as T from "../types"; +import * as T from "../../types"; export const sandwiches: T.Sandwich[] = [ { diff --git a/src/lib/shuffle-array.ts b/src/lib/src/shuffle-array.ts similarity index 100% rename from src/lib/shuffle-array.ts rename to src/lib/src/shuffle-array.ts diff --git a/src/lib/simplify-phonetics.test.ts b/src/lib/src/simplify-phonetics.test.ts similarity index 100% rename from src/lib/simplify-phonetics.test.ts rename to src/lib/src/simplify-phonetics.test.ts diff --git a/src/lib/simplify-phonetics.ts b/src/lib/src/simplify-phonetics.ts similarity index 100% rename from src/lib/simplify-phonetics.ts rename to src/lib/src/simplify-phonetics.ts diff --git a/src/lib/standardize-pashto.test.ts b/src/lib/src/standardize-pashto.test.ts similarity index 100% rename from src/lib/standardize-pashto.test.ts rename to src/lib/src/standardize-pashto.test.ts diff --git a/src/lib/standardize-pashto.ts b/src/lib/src/standardize-pashto.ts similarity index 100% rename from src/lib/standardize-pashto.ts rename to src/lib/src/standardize-pashto.ts diff --git a/src/lib/translate-phonetics-replacer.ts b/src/lib/src/translate-phonetics-replacer.ts similarity index 100% rename from src/lib/translate-phonetics-replacer.ts rename to src/lib/src/translate-phonetics-replacer.ts diff --git a/src/lib/translate-phonetics.test.ts b/src/lib/src/translate-phonetics.test.ts similarity index 100% rename from src/lib/translate-phonetics.test.ts rename to src/lib/src/translate-phonetics.test.ts diff --git a/src/lib/translate-phonetics.ts b/src/lib/src/translate-phonetics.ts similarity index 100% rename from src/lib/translate-phonetics.ts rename to src/lib/src/translate-phonetics.ts diff --git a/src/lib/type-predicates.ts b/src/lib/src/type-predicates.ts similarity index 97% rename from src/lib/type-predicates.ts rename to src/lib/src/type-predicates.ts index c2e1a79..7ce6e8b 100644 --- a/src/lib/type-predicates.ts +++ b/src/lib/src/type-predicates.ts @@ -1,7 +1,7 @@ -import * as T from "../types"; +import * as T from "../../types"; import { pashtoConsonants } from "./pashto-consonants"; -import { endsWith } from "../lib/p-text-helpers"; -import { countSyllables } from "../lib/accent-helpers"; +import { endsWith } from "./p-text-helpers"; +import { countSyllables } from "./accent-helpers"; export function isTlulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean { const entry = "entry" in e ? e.entry : e; diff --git a/src/lib/validate-entry.test.ts b/src/lib/src/validate-entry.test.ts similarity index 99% rename from src/lib/validate-entry.test.ts rename to src/lib/src/validate-entry.test.ts index 949d5a3..d31c1c3 100644 --- a/src/lib/validate-entry.test.ts +++ b/src/lib/src/validate-entry.test.ts @@ -7,7 +7,7 @@ */ import { standardizeEntry, validateEntry } from "./validate-entry"; -import * as T from "../types"; +import * as T from "../../types"; import { standardizePhonetics } from "./standardize-pashto"; const toTest: { diff --git a/src/lib/validate-entry.ts b/src/lib/src/validate-entry.ts similarity index 99% rename from src/lib/validate-entry.ts rename to src/lib/src/validate-entry.ts index 55202a6..08084ea 100644 --- a/src/lib/validate-entry.ts +++ b/src/lib/src/validate-entry.ts @@ -6,7 +6,7 @@ * */ -import * as T from "../types"; +import * as T from "../../types"; import { phoneticsToDiacritics, } from "./phonetics-to-diacritics"; diff --git a/src/lib/verb-conjugation.ts b/src/lib/src/verb-conjugation.ts similarity index 99% rename from src/lib/verb-conjugation.ts rename to src/lib/src/verb-conjugation.ts index bc8cbdf..8d9559e 100644 --- a/src/lib/verb-conjugation.ts +++ b/src/lib/src/verb-conjugation.ts @@ -44,7 +44,7 @@ import { spaceInForm, noPersInfs, } from "./misc-helpers"; -import * as T from "../types"; +import * as T from "../../types"; const dummyEntry: T.DictionaryEntry = { i: 0, p: "", f: "", g: "", e: "", c: "", ts: 0 }; diff --git a/src/lib/verb-info.test.ts b/src/lib/src/verb-info.test.ts similarity index 100% rename from src/lib/verb-info.test.ts rename to src/lib/src/verb-info.test.ts diff --git a/src/lib/verb-info.ts b/src/lib/src/verb-info.ts similarity index 99% rename from src/lib/verb-info.ts rename to src/lib/src/verb-info.ts index dc424c7..dd3512d 100644 --- a/src/lib/verb-info.ts +++ b/src/lib/src/verb-info.ts @@ -57,7 +57,7 @@ import { chooseParticipleInflection, noPersInfs, } from "./misc-helpers"; -import * as T from "../types"; +import * as T from "../../types"; import { isTlulVerb } from "./type-predicates"; const eyEndingUnaccented: T.PsString = { p: "ی", f: "ey" }; diff --git a/src/lib/yarn.lock b/src/lib/yarn.lock new file mode 100644 index 0000000..e7e2c27 --- /dev/null +++ b/src/lib/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +rambda@^7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/rambda/-/rambda-7.3.0.tgz#90e440ead53030a216093865d8d97997a80868ca" + integrity sha512-RFVofZYaG2TaVcxjnM0ejdVWf/59rFq1f57OGnjP3GT/bthzFw0GVr5rkP9PKbVlEuF/Y7bOVPLfiiYfxq/EWQ== diff --git a/src/library.ts b/src/library.ts deleted file mode 100644 index 5bc51cc..0000000 --- a/src/library.ts +++ /dev/null @@ -1,316 +0,0 @@ - - -/** - * Copyright (c) 2021 lingdocs.com - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -import { - conjugateVerb, -} from "./lib/verb-conjugation"; -import { - inflectWord, -} from "./lib/pashto-inflector"; -import { - getVerbInfo, - getPassiveRootsAndStems, - getAbilityRootsAndStems, -} from "./lib/verb-info"; -import InflectionsTable from "./components/InflectionsTable"; -import Pashto from "./components/Pashto"; -import Phonetics from "./components/Phonetics"; -import InlinePs from "./components/InlinePs"; -import ButtonSelect from "./components/ButtonSelect"; -import VerbFormDisplay from "./components/VerbFormDisplay"; -import VerbTable from "./components/VerbTable"; -import EPDisplay from "./components/ep-explorer/EPDisplay"; -import Examples from "./components/Examples"; -import Hider from "./components/Hider"; -import EntrySelect from "./components/EntrySelect"; -import VerbInfo, { RootsAndStems } from "./components/verb-info/VerbInfo"; -import VPExplorer from "./components/vp-explorer/VPExplorer"; -import { makeVPSelectionState } from "./components/vp-explorer/verb-selection"; -import { vpsReducer } from "./components/vp-explorer/vps-reducer"; -import type { VpsReducerAction as VpsA } from "./components/vp-explorer/vps-reducer"; -import useStickyState from "./lib/useStickyState"; -import { isPastTense } from "./lib/phrase-building/vp-tools"; -import Block, { NPBlock, APBlock } from "./components/blocks/Block"; -import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal"; -import CompiledPTextDisplay from "./components/CompiledPTextDisplay"; -import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay"; -import { - getInflectionPattern, - humanReadableInflectionPattern, -} from "./lib/inflection-pattern"; -import { - makePsString, - removeFVarients, -} from "./lib/accent-and-ps-utils"; -import { - addToForm, - concatPsString, - isVerbBlock, - isImperativeBlock, - isPluralInflectionSet, - isUnisexSet, - isInflectionSet, - addEnglish, - endsWith, - hasBaParticle, - psRemove, - firstVariation, - psStringFromEntry, - getLong, - capitalizeFirstLetter, -} from "./lib/p-text-helpers"; -import { - getEnglishWord, -} from "./lib/get-english-word"; -import { - standardizePashto, - standardizePhonetics, -} from "./lib/standardize-pashto"; -import { phoneticsToDiacritics } from "./lib/phonetics-to-diacritics"; -import { - randomPerson, - isInvalidSubjObjCombo, - randomSubjObj, - getEnglishVerb, -} from "./lib/np-tools"; -import { - getEnglishFromRendered, - getPashtoFromRendered, -} from "./lib/phrase-building/np-tools"; // TODO should be one np-tools file? -import { - convertSpelling, - revertSpelling, -} from "./lib/convert-spelling"; -import { - dictionaryEntryBooleanFields, - dictionaryEntryNumberFields, - dictionaryEntryTextFields, -} from "./lib/fields"; -import { - validateEntry, - standardizeEntry, -} from "./lib/validate-entry"; -import { - psJSXMap, -} from "./lib/jsx-map"; -import { - readDictionary, - writeDictionary, - readDictionaryInfo, - writeDictionaryInfo, -} from "./lib/protobuf"; -import { - pashtoConsonants, -} from "./lib/pashto-consonants"; -import { - isNounAdjOrVerb, - getEnglishPersonInfo, - getPersonFromVerbForm, - getPersonNumber, - personFromVerbBlockPos, - getVerbBlockPosFromPerson, - personIsPlural, - personGender, - parseEc, - personNumber, - randFromArray, - chooseLength, - isFirstPerson, - isSecondPerson, - isThirdPerson, - blank, - kidsBlank, - ensureNonComboVerbInfo, -} from "./lib/misc-helpers"; -import { - simplifyPhonetics, -} from "./lib/simplify-phonetics"; -import { - translatePhonetics, -} from "./lib/translate-phonetics"; -import { - addDiacritics, -} from "./lib/diacritics"; -import { - removeAccents, - hasAccents, - splitUpSyllables, - countSyllables, -} from "./lib/accent-helpers"; -import { - makeNounSelection, -} from "./components/np-picker/picker-tools"; -import { - renderEP, -} from "./lib/phrase-building/render-ep"; -import { - renderVP, -} from "./lib/phrase-building/render-vp"; -import { - renderNPSelection, -} from "./lib/phrase-building/render-np"; -import { - compileEP, - compileVP, - flattenLengths, -} from "./lib/phrase-building/compile"; -import { - isPashtoScript, -} from "./lib/is-pashto"; -import { - renderAPSelection, -} from "./lib/phrase-building/render-ap"; -import { - humanReadableVerbForm, - humanReadableEquativeTense, -} from "./lib/human-readable"; -import NPPicker from "./components/np-picker/NPPicker"; -import EPPicker from "./components/ep-explorer/EPPicker"; -import EPExplorer from "./components/ep-explorer/EPExplorer"; -import shuffleArray from "./lib/shuffle-array"; -import defaultTextOptions from "./lib/default-text-options"; -import * as grammarUnits from "./lib/grammar-units"; -import genderColors from "./lib/gender-colors"; -import * as Types from "./types"; -import * as typePredicates from "./lib/type-predicates"; -import APPicker from "./components/ap-picker/APPicker"; -import VPDisplay from "./components/vp-explorer/VPDisplay"; -import VPPicker from "./components/vp-explorer/VPPicker"; -import * as blockUtils from "./lib/phrase-building/blocks-utils"; - -export { - // FUNCTIONS - conjugateVerb, - getVerbInfo, - getPassiveRootsAndStems, - getAbilityRootsAndStems, - inflectWord, - addToForm, - concatPsString, - makePsString, - removeFVarients, - standardizePashto, - standardizePhonetics, - convertSpelling, - revertSpelling, - validateEntry, - standardizeEntry, - isNounAdjOrVerb, - simplifyPhonetics, - phoneticsToDiacritics, - addDiacritics, - translatePhonetics, - getEnglishPersonInfo, - getPersonFromVerbForm, - getPersonNumber, - isVerbBlock, - isImperativeBlock, - isInflectionSet, - isPluralInflectionSet, - isUnisexSet, - personFromVerbBlockPos, - removeAccents, - hasAccents, - getEnglishWord, - getVerbBlockPosFromPerson, - personIsPlural, - personGender, - addEnglish, - parseEc, - endsWith, - splitUpSyllables, - countSyllables, - hasBaParticle, - psRemove, - firstVariation, - capitalizeFirstLetter, - psStringFromEntry, - getLong, - useStickyState, - randomPerson, - isInvalidSubjObjCombo, - randomSubjObj, - shuffleArray, - personNumber, - makeNounSelection, - randFromArray, - renderEP, - renderVP, - compileEP, - compileVP, - chooseLength, - flattenLengths, - isFirstPerson, - isSecondPerson, - isThirdPerson, - isPastTense, - psJSXMap, - renderNPSelection, - getEnglishFromRendered, - getPashtoFromRendered, - renderAPSelection, - getEnglishVerb, - humanReadableVerbForm, - humanReadableEquativeTense, - humanReadableInflectionPattern, - ensureNonComboVerbInfo, - roleIcon, - vpsReducer, - makeVPSelectionState, - blockUtils, - blank, - kidsBlank, - isPashtoScript, - getInflectionPattern, - // protobuf helpers - readDictionary, - writeDictionary, - readDictionaryInfo, - writeDictionaryInfo, - // COMPONENTS - EPExplorer, - VPExplorer, - Examples, - VerbFormDisplay, - VerbTable, - VerbInfo, - RootsAndStems, - InflectionsTable, - Pashto, - Phonetics, - InlinePs, - ButtonSelect, - Hider, - EntrySelect, - NPPicker, - APPicker, - NPBlock, - APBlock, - Block, - EPDisplay, - VPDisplay, - EPPicker, - VPPicker, - CompiledPTextDisplay, - RenderedBlocksDisplay, - // OTHER - typePredicates, - grammarUnits, - pashtoConsonants, - defaultTextOptions, - dictionaryEntryTextFields, - dictionaryEntryNumberFields, - dictionaryEntryBooleanFields, - genderColors, - // TYPES - Types, -} - -export type VpsReducerAction = VpsA; \ No newline at end of file diff --git a/src/rollup.config.js b/src/rollup.config.js index 1b13ec1..ff998b5 100644 --- a/src/rollup.config.js +++ b/src/rollup.config.js @@ -1,8 +1,6 @@ -import image from '@rollup/plugin-image'; import { nodeResolve } from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; -import pkg from './package.json'; -import multiInput from 'rollup-plugin-multi-input'; +import pkg from './lib/package.json'; const banner = ` /** @@ -15,22 +13,18 @@ const banner = ` `; export default { - input: ['dist/functions.js', 'dist/components.js'], - external: ["react", "react-dom", "react-bootstrap"], + input: 'lib/dist/lib/library.js', output: [{ - dir: "dist-cjs", + file: "lib/dist/index.js", format: 'cjs', sourcemap: true, banner, }], plugins: [ // peerDepsExternal(), - multiInput(), commonjs(), nodeResolve({ resolveOnly: Object.keys(pkg.dependencies), }), - // use base64 image inlining for the cjs version so that the .svg s can get cosumed by node 12 etc. - image(), ] } \ No newline at end of file diff --git a/nouns-adjs/a-fem.js b/vocab/nouns-adjs/a-fem.js similarity index 100% rename from nouns-adjs/a-fem.js rename to vocab/nouns-adjs/a-fem.js diff --git a/nouns-adjs/aa-fem.js b/vocab/nouns-adjs/aa-fem.js similarity index 100% rename from nouns-adjs/aa-fem.js rename to vocab/nouns-adjs/aa-fem.js diff --git a/nouns-adjs/aanu-unisex.js b/vocab/nouns-adjs/aanu-unisex.js similarity index 100% rename from nouns-adjs/aanu-unisex.js rename to vocab/nouns-adjs/aanu-unisex.js diff --git a/nouns-adjs/adverbs.js b/vocab/nouns-adjs/adverbs.js similarity index 100% rename from nouns-adjs/adverbs.js rename to vocab/nouns-adjs/adverbs.js diff --git a/nouns-adjs/basic-fem.js b/vocab/nouns-adjs/basic-fem.js similarity index 100% rename from nouns-adjs/basic-fem.js rename to vocab/nouns-adjs/basic-fem.js diff --git a/nouns-adjs/basic-masc.js b/vocab/nouns-adjs/basic-masc.js similarity index 100% rename from nouns-adjs/basic-masc.js rename to vocab/nouns-adjs/basic-masc.js diff --git a/nouns-adjs/basic-unisex.js b/vocab/nouns-adjs/basic-unisex.js similarity index 100% rename from nouns-adjs/basic-unisex.js rename to vocab/nouns-adjs/basic-unisex.js diff --git a/nouns-adjs/e-fem.js b/vocab/nouns-adjs/e-fem.js similarity index 100% rename from nouns-adjs/e-fem.js rename to vocab/nouns-adjs/e-fem.js diff --git a/nouns-adjs/ee-fem.js b/vocab/nouns-adjs/ee-fem.js similarity index 100% rename from nouns-adjs/ee-fem.js rename to vocab/nouns-adjs/ee-fem.js diff --git a/nouns-adjs/exception-people-fem.js b/vocab/nouns-adjs/exception-people-fem.js similarity index 100% rename from nouns-adjs/exception-people-fem.js rename to vocab/nouns-adjs/exception-people-fem.js diff --git a/nouns-adjs/exception-people-masc.js b/vocab/nouns-adjs/exception-people-masc.js similarity index 100% rename from nouns-adjs/exception-people-masc.js rename to vocab/nouns-adjs/exception-people-masc.js diff --git a/nouns-adjs/ey-masc.js b/vocab/nouns-adjs/ey-masc.js similarity index 100% rename from nouns-adjs/ey-masc.js rename to vocab/nouns-adjs/ey-masc.js diff --git a/nouns-adjs/ey-stressed-unisex.js b/vocab/nouns-adjs/ey-stressed-unisex.js similarity index 100% rename from nouns-adjs/ey-stressed-unisex.js rename to vocab/nouns-adjs/ey-stressed-unisex.js diff --git a/nouns-adjs/ey-unstressed-unisex.js b/vocab/nouns-adjs/ey-unstressed-unisex.js similarity index 100% rename from nouns-adjs/ey-unstressed-unisex.js rename to vocab/nouns-adjs/ey-unstressed-unisex.js diff --git a/nouns-adjs/loc-adverbs.js b/vocab/nouns-adjs/loc-adverbs.js similarity index 100% rename from nouns-adjs/loc-adverbs.js rename to vocab/nouns-adjs/loc-adverbs.js diff --git a/nouns-adjs/non-inflecting.js b/vocab/nouns-adjs/non-inflecting.js similarity index 100% rename from nouns-adjs/non-inflecting.js rename to vocab/nouns-adjs/non-inflecting.js diff --git a/nouns-adjs/nouns-unisex.js b/vocab/nouns-adjs/nouns-unisex.js similarity index 100% rename from nouns-adjs/nouns-unisex.js rename to vocab/nouns-adjs/nouns-unisex.js diff --git a/nouns-adjs/o-fem.js b/vocab/nouns-adjs/o-fem.js similarity index 100% rename from nouns-adjs/o-fem.js rename to vocab/nouns-adjs/o-fem.js diff --git a/nouns-adjs/short-irreg-unisex.js b/vocab/nouns-adjs/short-irreg-unisex.js similarity index 100% rename from nouns-adjs/short-irreg-unisex.js rename to vocab/nouns-adjs/short-irreg-unisex.js diff --git a/nouns-adjs/u-masc.js b/vocab/nouns-adjs/u-masc.js similarity index 100% rename from nouns-adjs/u-masc.js rename to vocab/nouns-adjs/u-masc.js diff --git a/nouns-adjs/uy-fem.js b/vocab/nouns-adjs/uy-fem.js similarity index 100% rename from nouns-adjs/uy-fem.js rename to vocab/nouns-adjs/uy-fem.js diff --git a/nouns-adjs/y-masc.js b/vocab/nouns-adjs/y-masc.js similarity index 100% rename from nouns-adjs/y-masc.js rename to vocab/nouns-adjs/y-masc.js diff --git a/verbs/dyn-comp-trans.js b/vocab/verbs/dyn-comp-trans.js similarity index 100% rename from verbs/dyn-comp-trans.js rename to vocab/verbs/dyn-comp-trans.js diff --git a/verbs/simple-gramm-trans.js b/vocab/verbs/simple-gramm-trans.js similarity index 100% rename from verbs/simple-gramm-trans.js rename to vocab/verbs/simple-gramm-trans.js diff --git a/verbs/simple-intrans.js b/vocab/verbs/simple-intrans.js similarity index 100% rename from verbs/simple-intrans.js rename to vocab/verbs/simple-intrans.js diff --git a/verbs/simple-trans.js b/vocab/verbs/simple-trans.js similarity index 100% rename from verbs/simple-trans.js rename to vocab/verbs/simple-trans.js diff --git a/verbs/stative-comp-intrans.js b/vocab/verbs/stative-comp-intrans.js similarity index 100% rename from verbs/stative-comp-intrans.js rename to vocab/verbs/stative-comp-intrans.js diff --git a/verbs/stative-comp-trans.js b/vocab/verbs/stative-comp-trans.js similarity index 100% rename from verbs/stative-comp-trans.js rename to vocab/verbs/stative-comp-trans.js