babel / babel

Compare 1f752a6 ... +0 ... 0261c3b

Coverage Reach
packages/babel-parser/src/plugins/flow/index.js packages/babel-parser/src/plugins/flow/scope.js packages/babel-parser/src/plugins/typescript/index.js packages/babel-parser/src/plugins/typescript/scope.js packages/babel-parser/src/plugins/jsx/index.js packages/babel-parser/src/plugins/jsx/xhtml.js packages/babel-parser/src/plugins/estree.js packages/babel-parser/src/plugins/placeholders.js packages/babel-parser/src/plugins/v8intrinsic.js packages/babel-parser/src/parser/expression.js packages/babel-parser/src/parser/statement.js packages/babel-parser/src/parser/lval.js packages/babel-parser/src/parser/util.js packages/babel-parser/src/parser/comments.js packages/babel-parser/src/parser/node.js packages/babel-parser/src/parser/error.js packages/babel-parser/src/parser/index.js packages/babel-parser/src/parser/base.js packages/babel-parser/src/parser/error-message.js packages/babel-parser/src/parser/error-codes.js packages/babel-parser/src/tokenizer/index.js packages/babel-parser/src/tokenizer/state.js packages/babel-parser/src/tokenizer/types.js packages/babel-parser/src/tokenizer/context.js packages/babel-parser/src/util/scope.js packages/babel-parser/src/util/expression-scope.js packages/babel-parser/src/util/scopeflags.js packages/babel-parser/src/util/class-scope.js packages/babel-parser/src/util/whitespace.js packages/babel-parser/src/util/production-parameter.js packages/babel-parser/src/util/location.js packages/babel-parser/src/util/identifier.js packages/babel-parser/src/plugin-utils.js packages/babel-parser/src/index.js packages/babel-parser/src/options.js packages/babel-traverse/src/path/inference/inferers.ts packages/babel-traverse/src/path/inference/inferer-reference.ts packages/babel-traverse/src/path/inference/index.ts packages/babel-traverse/src/path/conversion.ts packages/babel-traverse/src/path/evaluation.ts packages/babel-traverse/src/path/introspection.ts packages/babel-traverse/src/path/lib/hoister.ts packages/babel-traverse/src/path/lib/virtual-types.ts packages/babel-traverse/src/path/lib/removal-hooks.ts packages/babel-traverse/src/path/family.ts packages/babel-traverse/src/path/context.ts packages/babel-traverse/src/path/modification.ts packages/babel-traverse/src/path/replacement.ts packages/babel-traverse/src/path/index.ts packages/babel-traverse/src/path/ancestry.ts packages/babel-traverse/src/path/removal.ts packages/babel-traverse/src/path/comments.ts packages/babel-traverse/src/scope/index.ts packages/babel-traverse/src/scope/lib/renamer.ts packages/babel-traverse/src/scope/binding.ts packages/babel-traverse/src/visitors.ts packages/babel-traverse/src/context.ts packages/babel-traverse/src/index.ts packages/babel-traverse/src/cache.ts packages/babel-traverse/src/hub.ts packages/babel-generator/src/generators/flow.ts packages/babel-generator/src/generators/typescript.ts packages/babel-generator/src/generators/statements.ts packages/babel-generator/src/generators/expressions.ts packages/babel-generator/src/generators/modules.ts packages/babel-generator/src/generators/types.ts packages/babel-generator/src/generators/classes.ts packages/babel-generator/src/generators/methods.ts packages/babel-generator/src/generators/jsx.ts packages/babel-generator/src/generators/base.ts packages/babel-generator/src/generators/template-literals.ts packages/babel-generator/src/node/parentheses.ts packages/babel-generator/src/node/whitespace.ts packages/babel-generator/src/node/index.ts packages/babel-generator/src/printer.ts packages/babel-generator/src/buffer.ts packages/babel-generator/src/index.ts packages/babel-generator/src/source-map.ts packages/babel-core/src/config/validation/option-assertions.ts packages/babel-core/src/config/validation/options.ts packages/babel-core/src/config/validation/plugins.ts packages/babel-core/src/config/config-chain.ts packages/babel-core/src/config/files/configuration.ts packages/babel-core/src/config/files/plugins.ts packages/babel-core/src/config/files/module-types.ts packages/babel-core/src/config/files/package.ts packages/babel-core/src/config/files/index-browser.ts packages/babel-core/src/config/files/utils.ts packages/babel-core/src/config/files/import.ts packages/babel-core/src/config/files/index.ts packages/babel-core/src/config/caching.ts packages/babel-core/src/config/full.ts packages/babel-core/src/config/config-descriptors.ts packages/babel-core/src/config/partial.ts packages/babel-core/src/config/printer.ts packages/babel-core/src/config/helpers/config-api.ts packages/babel-core/src/config/helpers/environment.ts packages/babel-core/src/config/item.ts packages/babel-core/src/config/index.ts packages/babel-core/src/config/pattern-to-regex.ts packages/babel-core/src/config/util.ts packages/babel-core/src/config/resolve-targets.ts packages/babel-core/src/config/plugin.ts packages/babel-core/src/config/resolve-targets-browser.ts packages/babel-core/src/transformation/file/merge-map.ts packages/babel-core/src/transformation/file/file.ts packages/babel-core/src/transformation/file/generate.ts packages/babel-core/src/transformation/index.ts packages/babel-core/src/transformation/normalize-file.ts packages/babel-core/src/transformation/block-hoist-plugin.ts packages/babel-core/src/transformation/plugin-pass.ts packages/babel-core/src/transformation/normalize-opts.ts packages/babel-core/src/transformation/util/clone-deep-browser.ts packages/babel-core/src/transformation/util/clone-deep.ts packages/babel-core/src/tools/build-external-helpers.ts packages/babel-core/src/parser/index.ts packages/babel-core/src/parser/util/missing-plugin-helper.ts packages/babel-core/src/gensync-utils/async.ts packages/babel-core/src/gensync-utils/fs.ts packages/babel-core/src/transform-ast.ts packages/babel-core/src/parse.ts packages/babel-core/src/transform.ts packages/babel-core/src/transform-file.ts packages/babel-core/src/transform-file-browser.ts packages/babel-core/src/index.ts packages/babel-types/src/definitions/core.ts packages/babel-types/src/definitions/utils.ts packages/babel-types/src/definitions/flow.ts packages/babel-types/src/definitions/typescript.ts packages/babel-types/src/definitions/experimental.ts packages/babel-types/src/definitions/jsx.ts packages/babel-types/src/definitions/placeholders.ts packages/babel-types/src/definitions/index.ts packages/babel-types/src/definitions/misc.ts packages/babel-types/src/validators/isReferenced.ts packages/babel-types/src/validators/isNodesEquivalent.ts packages/babel-types/src/validators/matchesPattern.ts packages/babel-types/src/validators/validate.ts packages/babel-types/src/validators/isBinding.ts packages/babel-types/src/validators/is.ts packages/babel-types/src/validators/isType.ts packages/babel-types/src/validators/isImmutable.ts packages/babel-types/src/validators/isValidIdentifier.ts packages/babel-types/src/validators/isPlaceholderType.ts packages/babel-types/src/validators/isScope.ts packages/babel-types/src/validators/isSpecifierDefault.ts packages/babel-types/src/validators/isLet.ts packages/babel-types/src/validators/isVar.ts packages/babel-types/src/validators/isValidES3Identifier.ts packages/babel-types/src/validators/react/isCompatTag.ts packages/babel-types/src/validators/react/isReactComponent.ts packages/babel-types/src/validators/buildMatchMemberExpression.ts packages/babel-types/src/validators/isNode.ts packages/babel-types/src/validators/isBlockScoped.ts packages/babel-types/src/converters/valueToNode.ts packages/babel-types/src/converters/gatherSequenceExpressions.ts packages/babel-types/src/converters/toStatement.ts packages/babel-types/src/converters/toKeyAlias.ts packages/babel-types/src/converters/toExpression.ts packages/babel-types/src/converters/toBlock.ts packages/babel-types/src/converters/toIdentifier.ts packages/babel-types/src/converters/toSequenceExpression.ts packages/babel-types/src/converters/toComputedKey.ts packages/babel-types/src/converters/toBindingIdentifierName.ts packages/babel-types/src/converters/ensureBlock.ts packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts packages/babel-types/src/modifications/removeProperties.ts packages/babel-types/src/modifications/inherits.ts packages/babel-types/src/modifications/appendToMemberExpression.ts packages/babel-types/src/modifications/prependToMemberExpression.ts packages/babel-types/src/modifications/removePropertiesDeep.ts packages/babel-types/src/clone/cloneNode.ts packages/babel-types/src/clone/clone.ts packages/babel-types/src/clone/cloneDeepWithoutLoc.ts packages/babel-types/src/clone/cloneDeep.ts packages/babel-types/src/clone/cloneWithoutLoc.ts packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts packages/babel-types/src/builders/flow/createFlowUnionType.ts packages/babel-types/src/builders/builder.ts packages/babel-types/src/builders/react/buildChildren.ts packages/babel-types/src/builders/typescript/createTSUnionType.ts packages/babel-types/src/traverse/traverse.ts packages/babel-types/src/traverse/traverseFast.ts packages/babel-types/src/retrievers/getBindingIdentifiers.ts packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts packages/babel-types/src/utils/shallowEqual.ts packages/babel-types/src/utils/inherit.ts packages/babel-types/src/comments/addComments.ts packages/babel-types/src/comments/inheritsComments.ts packages/babel-types/src/comments/removeComments.ts packages/babel-types/src/comments/addComment.ts packages/babel-types/src/comments/inheritLeadingComments.ts packages/babel-types/src/comments/inheritTrailingComments.ts packages/babel-types/src/comments/inheritInnerComments.ts packages/babel-types/src/constants/index.ts packages/babel-types/src/asserts/assertNode.ts packages/babel-types/src/index.ts packages/babel-helper-create-class-features-plugin/src/fields.ts packages/babel-helper-create-class-features-plugin/src/index.ts packages/babel-helper-create-class-features-plugin/src/decorators.ts packages/babel-helper-create-class-features-plugin/src/features.ts packages/babel-helper-create-class-features-plugin/src/misc.ts packages/babel-helper-create-class-features-plugin/src/typescript.ts packages/babel-plugin-proposal-class-elements/src/utils/private.js packages/babel-plugin-proposal-class-elements/src/utils/context.js packages/babel-plugin-proposal-class-elements/src/utils/misc.js packages/babel-plugin-proposal-class-elements/src/utils/public.js packages/babel-plugin-proposal-class-elements/src/transforms/target-private-fields.js packages/babel-plugin-proposal-class-elements/src/transforms/target-public-fields.js packages/babel-plugin-proposal-class-elements/src/transforms/target-es6-classes.js packages/babel-plugin-proposal-class-elements/src/transforms/private-optional-chain.js packages/babel-plugin-proposal-class-elements/src/index.js packages/babel-helper-module-transforms/src/normalize-and-load-metadata.ts packages/babel-helper-module-transforms/src/rewrite-live-references.ts packages/babel-helper-module-transforms/src/index.ts packages/babel-helper-module-transforms/src/get-module-name.ts packages/babel-helper-module-transforms/src/rewrite-this.ts packages/babel-plugin-transform-typescript/src/index.ts packages/babel-plugin-transform-typescript/src/enum.ts packages/babel-plugin-transform-typescript/src/namespace.ts packages/babel-plugin-transform-block-scoping/src/index.js packages/babel-plugin-transform-block-scoping/src/tdz.js packages/babel-preset-env/src/index.js packages/babel-preset-env/src/normalize-options.js packages/babel-preset-env/src/available-plugins.js packages/babel-preset-env/src/polyfills/babel-polyfill.js packages/babel-preset-env/src/polyfills/regenerator.js packages/babel-preset-env/src/polyfills/utils.js packages/babel-preset-env/src/debug.js packages/babel-preset-env/src/plugins-compat-data.js packages/babel-preset-env/src/filter-items.js packages/babel-preset-env/src/get-option-specific-excludes.js packages/babel-preset-env/src/options.js packages/babel-cli/src/babel/options.ts packages/babel-cli/src/babel/dir.ts packages/babel-cli/src/babel/file.ts packages/babel-cli/src/babel/util.ts packages/babel-cli/src/babel/index.ts packages/babel-cli/src/babel-external-helpers.ts packages/babel-helpers/src/index.js packages/babel-helpers/src/helpers.js packages/babel-helpers/src/helpers/wrapRegExp.js packages/babel-helpers/src/helpers/jsx.js packages/babel-helpers/src/helpers/objectSpread2.js packages/babel-helpers/src/helpers/typeof.js packages/babel-helpers/src/helpers-generated.js packages/babel-plugin-transform-react-jsx/src/create-plugin.ts packages/babel-plugin-transform-classes/src/transformClass.ts packages/babel-plugin-transform-classes/src/index.ts packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.ts packages/babel-template/src/parse.ts packages/babel-template/src/populate.ts packages/babel-template/src/builder.ts packages/babel-template/src/options.ts packages/babel-template/src/literal.ts packages/babel-template/src/formatters.ts packages/babel-template/src/string.ts packages/babel-template/src/index.ts packages/babel-plugin-transform-destructuring/src/index.js packages/babel-plugin-proposal-object-rest-spread/src/index.js packages/babel-plugin-transform-parameters/src/rest.js packages/babel-plugin-transform-parameters/src/params.js packages/babel-plugin-transform-parameters/src/index.js packages/babel-plugin-transform-modules-systemjs/src/index.js packages/babel-helper-module-imports/src/import-injector.ts packages/babel-helper-module-imports/src/import-builder.ts packages/babel-helper-module-imports/src/index.ts packages/babel-helper-module-imports/src/is-module.ts packages/babel-helper-compilation-targets/src/index.ts packages/babel-helper-compilation-targets/src/filter-items.ts packages/babel-helper-compilation-targets/src/utils.ts packages/babel-helper-compilation-targets/src/pretty.ts packages/babel-helper-compilation-targets/src/debug.ts packages/babel-helper-compilation-targets/src/targets.ts packages/babel-helper-compilation-targets/src/options.ts packages/babel-helper-member-expression-to-functions/src/index.ts packages/babel-helper-member-expression-to-functions/src/util.ts packages/babel-standalone/src/transformScriptTags.ts packages/babel-standalone/src/index.ts packages/babel-standalone/src/preset-es2015.ts packages/babel-standalone/src/preset-stage-1.ts packages/babel-standalone/src/preset-stage-0.ts packages/babel-standalone/src/preset-stage-2.ts packages/babel-standalone/src/preset-stage-3.ts packages/babel-standalone/src/babel-package-shim.ts packages/babel-standalone/src/generated/plugins.ts packages/babel-helper-transform-fixture-test-runner/src/index.ts packages/babel-helper-transform-fixture-test-runner/src/helpers.ts packages/babel-helper-fixtures/src/index.ts packages/babel-node/src/_babel-node.js packages/babel-node/src/babel-node.js packages/babel-plugin-transform-for-of/src/index.js packages/babel-plugin-transform-for-of/src/no-helper-implementation.js packages/babel-register/src/node.js packages/babel-register/src/cache.js packages/babel-register/src/nodeWrapper.js packages/babel-register/src/index.js packages/babel-register/src/browser.js packages/babel-plugin-transform-flow-comments/src/index.js packages/babel-plugin-proposal-optional-chaining/src/transform.js packages/babel-plugin-proposal-optional-chaining/src/util.js packages/babel-plugin-proposal-optional-chaining/src/index.js packages/babel-helper-replace-supers/src/index.ts packages/babel-plugin-proposal-decorators/src/transformer-legacy.js packages/babel-plugin-proposal-decorators/src/index.js packages/babel-helper-builder-react-jsx/src/index.js packages/babel-plugin-transform-runtime/src/index.ts packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.ts packages/babel-plugin-transform-runtime/src/helpers.ts packages/babel-highlight/src/index.ts packages/babel-plugin-transform-react-constant-elements/src/index.js packages/babel-plugin-transform-modules-commonjs/src/index.js packages/babel-helper-create-regexp-features-plugin/src/index.ts packages/babel-helper-create-regexp-features-plugin/src/util.ts packages/babel-helper-create-regexp-features-plugin/src/features.ts packages/babel-code-frame/src/index.ts packages/babel-plugin-transform-spread/src/index.js packages/babel-plugin-transform-flow-strip-types/src/index.js packages/babel-helper-define-map/src/index.js packages/babel-helper-function-name/src/index.ts packages/babel-plugin-transform-computed-properties/src/index.js packages/babel-plugin-transform-modules-umd/src/index.js packages/babel-plugin-proposal-pipeline-operator/src/buildOptimizedSequenceExpression.js packages/babel-plugin-proposal-pipeline-operator/src/smartVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.js packages/babel-plugin-proposal-pipeline-operator/src/index.js packages/babel-helper-validator-identifier/src/identifier.ts packages/babel-helper-validator-identifier/src/keyword.ts packages/babel-plugin-transform-modules-amd/src/index.js packages/babel-plugin-transform-template-literals/src/index.js packages/babel-plugin-proposal-private-property-in-object/src/index.js packages/babel-plugin-transform-unicode-escapes/src/index.js packages/babel-plugin-proposal-async-generator-functions/src/index.js packages/babel-plugin-proposal-async-generator-functions/src/for-await.js packages/babel-plugin-transform-react-display-name/src/index.js packages/babel-helper-wrap-function/src/index.js packages/babel-plugin-proposal-partial-application/src/index.js packages/babel-helper-validator-option/src/validator.ts packages/babel-helper-validator-option/src/find-suggestion.ts packages/babel-helper-plugin-utils/src/index.js packages/babel-plugin-transform-proto-to-assign/src/index.js packages/babel-preset-react/src/normalize-options.js packages/babel-preset-react/src/index.js packages/babel-helper-split-export-declaration/src/index.ts packages/babel-plugin-transform-react-inline-elements/src/index.js packages/babel-plugin-transform-typeof-symbol/src/index.js packages/babel-plugin-transform-duplicate-keys/src/index.js packages/babel-helper-remap-async-to-generator/src/index.js packages/babel-helper-simple-access/src/index.ts packages/babel-helper-explode-assignable-expression/src/index.ts packages/babel-plugin-transform-react-jsx-source/src/index.js packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/util.ts packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts packages/babel-plugin-proposal-record-and-tuple/src/index.js packages/babel-plugin-proposal-function-bind/src/index.js packages/babel-plugin-transform-new-target/src/index.js packages/babel-plugin-proposal-function-sent/src/index.js packages/babel-plugin-proposal-class-static-block/src/index.js packages/babel-plugin-transform-react-pure-annotations/src/index.js packages/babel-plugin-proposal-logical-assignment-operators/src/index.js packages/babel-preset-typescript/src/normalize-options.js packages/babel-preset-typescript/src/index.js packages/babel-helper-hoist-variables/src/index.ts packages/babel-plugin-transform-block-scoped-functions/src/index.js packages/babel-plugin-syntax-typescript/src/index.js packages/babel-plugin-proposal-export-namespace-from/src/index.js packages/babel-plugin-transform-shorthand-properties/src/index.js packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js packages/babel-plugin-transform-property-mutators/src/index.js packages/babel-plugin-syntax-decorators/src/index.js packages/babel-plugin-transform-async-to-generator/src/index.js packages/babel-plugin-external-helpers/src/index.js packages/babel-plugin-proposal-async-do-expressions/src/index.ts packages/babel-plugin-transform-instanceof/src/index.js packages/babel-plugin-proposal-export-default-from/src/index.js packages/babel-plugin-transform-object-super/src/index.js packages/babel-preset-flow/src/normalize-options.js packages/babel-preset-flow/src/index.js packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js packages/babel-plugin-syntax-flow/src/index.js packages/babel-plugin-transform-function-name/src/index.js packages/babel-plugin-proposal-json-strings/src/index.js packages/babel-helper-skip-transparent-expression-wrappers/src/index.js packages/babel-plugin-proposal-dynamic-import/src/index.js packages/babel-helper-plugin-test-runner/src/index.js packages/babel-plugin-proposal-do-expressions/src/index.js packages/babel-plugin-transform-react-jsx-self/src/index.js packages/babel-plugin-transform-member-expression-literals/src/index.js packages/babel-helper-optimise-call-expression/src/index.ts packages/babel-plugin-transform-react-jsx-compat/src/index.js packages/babel-plugin-transform-property-literals/src/index.js packages/babel-plugin-transform-literals/src/index.js packages/babel-helper-annotate-as-pure/src/index.ts packages/babel-plugin-proposal-throw-expressions/src/index.js packages/babel-plugin-syntax-jsx/src/index.js packages/babel-plugin-transform-strict-mode/src/index.js packages/babel-plugin-proposal-optional-catch-binding/src/index.js packages/babel-plugin-syntax-pipeline-operator/src/index.js packages/babel-plugin-transform-sticky-regex/src/index.js packages/babel-helper-get-function-arity/src/index.ts packages/babel-plugin-proposal-numeric-separator/src/index.js packages/babel-plugin-transform-jscript/src/index.js packages/babel-plugin-transform-arrow-functions/src/index.js packages/babel-plugin-syntax-record-and-tuple/src/index.js packages/babel-plugin-transform-reserved-words/src/index.js packages/babel-plugin-proposal-unicode-property-regex/src/index.js packages/babel-plugin-transform-object-assign/src/index.js packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js packages/babel-plugin-syntax-partial-application/src/index.js packages/babel-plugin-syntax-class-static-block/src/index.js packages/babel-plugin-syntax-module-blocks/src/index.js packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js packages/babel-plugin-syntax-private-property-in-object/src/index.js packages/babel-plugin-syntax-async-do-expressions/src/index.ts packages/babel-plugin-syntax-function-sent/src/index.js packages/babel-plugin-transform-exponentiation-operator/src/index.js packages/babel-plugin-syntax-decimal/src/index.js packages/babel-plugin-proposal-class-properties/src/index.js packages/babel-plugin-syntax-import-assertions/src/index.js packages/babel-plugin-syntax-throw-expressions/src/index.js packages/babel-plugin-syntax-do-expressions/src/index.js packages/babel-plugin-syntax-export-default-from/src/index.js packages/babel-plugin-syntax-function-bind/src/index.js packages/babel-plugin-syntax-top-level-await/src/index.js packages/babel-plugin-proposal-private-methods/src/index.js packages/babel-plugin-transform-unicode-regex/src/index.js packages/babel-plugin-transform-dotall-regex/src/index.js eslint/babel-eslint-parser/src/convert/convertTokens.cjs eslint/babel-eslint-parser/src/convert/convertAST.cjs eslint/babel-eslint-parser/src/convert/index.cjs eslint/babel-eslint-parser/src/convert/convertComments.cjs eslint/babel-eslint-parser/src/analyze-scope.cjs eslint/babel-eslint-parser/src/worker/index.cjs eslint/babel-eslint-parser/src/worker/configuration.cjs eslint/babel-eslint-parser/src/worker/maybeParse.cjs eslint/babel-eslint-parser/src/worker/ast-info.cjs eslint/babel-eslint-parser/src/worker/babel-core.cjs eslint/babel-eslint-parser/src/worker/extract-parser-options-plugin.cjs eslint/babel-eslint-parser/src/index.cjs eslint/babel-eslint-parser/src/client.cjs eslint/babel-eslint-parser/src/configuration.cjs eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js eslint/babel-eslint-plugin-development/src/utils/get-export-name.js eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js eslint/babel-eslint-plugin-development/src/rules/plugin-name.js eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js eslint/babel-eslint-plugin-development/src/index.js eslint/babel-eslint-plugin/src/rules/semi.js eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js eslint/babel-eslint-plugin/src/rules/no-invalid-this.js eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js eslint/babel-eslint-plugin/src/rules/new-cap.js eslint/babel-eslint-plugin/src/index.js eslint/babel-eslint-plugin-development-internal/src/rules/dry-error-messages.js eslint/babel-eslint-plugin-development-internal/src/rules/report-error-message-format.js eslint/babel-eslint-plugin-development-internal/src/index.js codemods/babel-plugin-codemod-object-assign-to-object-spread/src/index.js codemods/babel-plugin-codemod-optional-catch-binding/src/index.js

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 4 of 34 files from the diff.
Other files ignored by Codecov

@@ -1,15 +1,23 @@
Loading
1 1
import { types as t } from "@babel/core";
2 2
import {
3 3
  pushPrivateName,
4 -
  buildPrivateNamesNodes,
5 4
  buildPrivateInstanceFieldInitSpec,
6 5
  buildPrivateStaticFieldInitSpec,
7 6
  buildPrivateInstanceMethodInitSpec,
8 -
  buildPrivateMethodDeclaration,
9 7
  transformPrivateNamesUsage,
10 8
} from "../utils/private";
11 -
import { injectInitialization } from "../utils/misc";
12 -
import { replaceSupers, replaceThisContext } from "../utils/context";
9 +
import {
10 +
  injectInitialization,
11 +
  injectPureStatics,
12 +
  injectStaticInitialization,
13 +
} from "../utils/misc";
14 +
import {
15 +
  ensureClassRef,
16 +
  ensureExternalClassRef,
17 +
  replaceInnerBindingReferences,
18 +
  replaceSupers,
19 +
  replaceThisContextInExtractedNodes,
20 +
} from "../utils/context";
13 21
14 22
function unshiftFieldInit(fieldPath, exprs) {
15 23
  if (exprs.length === 0) return;
@@ -82,6 +90,16 @@
Loading
82 90
      const eltsToRemove = [];
83 91
      let constructorPath;
84 92
93 +
      const { classRef, originalClassRef } = ensureClassRef(path);
94 +
      let needsClassRef = false;
95 +
      let externalClassRef;
96 +
      const getExternalClassRef = () =>
97 +
        (externalClassRef ||= ensureExternalClassRef(
98 +
          path,
99 +
          classRef,
100 +
          originalClassRef,
101 +
        ));
102 +
85 103
      for (const el of path.get("body.body")) {
86 104
        if (el.isPrivate()) {
87 105
          pushPrivateName(privateNamesMap, el);
@@ -97,7 +115,15 @@
Loading
97 115
98 116
        if (el.isClassPrivateMethod()) {
99 117
          meta.privMethods.push(el.node);
118 +
100 119
          replaceSupers(path, el, state, constantSuper);
120 +
          needsClassRef =
121 +
            replaceInnerBindingReferences(
122 +
              el,
123 +
              getExternalClassRef(),
124 +
              classRef,
125 +
            ) || needsClassRef;
126 +
101 127
          eltsToRemove.push(el);
102 128
          continue;
103 129
        }
@@ -119,11 +145,6 @@
Loading
119 145
        }
120 146
      }
121 147
122 -
      let classRef = path.node.id;
123 -
      if (!classRef) {
124 -
        path.set("id", (classRef = path.scope.generateUidIdentifier("class")));
125 -
      }
126 -
127 148
      transformPrivateNamesUsage(
128 149
        classRef,
129 150
        path,
@@ -162,45 +183,32 @@
Loading
162 183
        );
163 184
      }
164 185
165 -
      const staticNodesBefore = buildPrivateNamesNodes(
186 +
      injectPureStatics({
187 +
        state,
188 +
        path,
166 189
        privateNamesMap,
190 +
        instancePrivMethods: instanceMeta.privMethods,
191 +
        staticPrivMethods: staticMeta.privMethods,
167 192
        privateFieldsAsProperties,
168 -
        state,
169 -
      );
170 -
      if (staticNodesBefore) path.insertBefore(staticNodesBefore);
171 -
172 -
      for (let i = 0, j = 0; i < staticMeta.privFields.length; i++) {
173 -
        while (staticMeta.privFields[i] !== eltsToRemove[j].node) {
174 -
          j++;
175 -
          if (j > eltsToRemove.length) throw new Error("Internal Babel error");
176 -
        }
193 +
      });
177 194
178 -
        replaceThisContext(
195 +
      needsClassRef =
196 +
        replaceThisContextInExtractedNodes(
197 +
          staticMeta.privFields,
198 +
          eltsToRemove,
179 199
          path,
180 -
          eltsToRemove[j],
181 -
          classRef,
200 +
          getExternalClassRef(),
201 +
          originalClassRef,
182 202
          state,
183 203
          constantSuper,
184 -
        );
185 -
      }
204 +
        ) || needsClassRef;
186 205
187 -
      const staticNodesAfter = [
188 -
        ...initStaticPrivFields(staticMeta.privFields),
189 -
        ...instanceMeta.privMethods
190 -
          .concat(staticMeta.privMethods)
191 -
          .map(method =>
192 -
            buildPrivateMethodDeclaration(
193 -
              method,
194 -
              privateNamesMap,
195 -
              privateFieldsAsProperties,
196 -
            ),
197 -
          ),
198 -
      ];
199 -
      if (staticNodesAfter.length > 0) {
200 -
        path
201 -
          .find(parent => parent.isStatement() || parent.isDeclaration())
202 -
          .insertAfter(staticNodesAfter);
203 -
      }
206 +
      injectStaticInitialization(
207 +
        path,
208 +
        initStaticPrivFields(staticMeta.privFields),
209 +
        getExternalClassRef(),
210 +
        needsClassRef,
211 +
      );
204 212
205 213
      eltsToRemove.forEach(el => el.remove());
206 214
    },

@@ -3,18 +3,89 @@
Loading
3 3
  environmentVisitor,
4 4
} from "@babel/helper-replace-supers";
5 5
6 +
export function ensureClassRef(path) {
7 +
  const originalClassRef = path.node.id;
8 +
  let classRef = originalClassRef;
9 +
  if (!classRef) {
10 +
    path.set("id", (classRef = path.scope.generateUidIdentifier("class")));
11 +
  }
12 +
13 +
  return { classRef, originalClassRef };
14 +
}
15 +
16 +
export function ensureExternalClassRef(path, classRef, originalClassRef) {
17 +
  if (path.isClassDeclaration()) {
18 +
    return classRef;
19 +
  } else {
20 +
    return originalClassRef === classRef
21 +
      ? path.scope.generateUidIdentifier(classRef.name)
22 +
      : // If the classRef has been generated by us, it's already an UUID and we
23 +
        // don't need a new id.
24 +
        classRef;
25 +
  }
26 +
}
27 +
28 +
export function replaceThisContextInExtractedNodes(
29 +
  nodes,
30 +
  extractedPaths,
31 +
  path,
32 +
  externalClassRef,
33 +
  originalClassRef,
34 +
  state,
35 +
  constantSuper,
36 +
) {
37 +
  let needsClassRef = false;
38 +
39 +
  for (let i = 0, j = 0; i < nodes.length; i++) {
40 +
    while (nodes[i] !== extractedPaths[j].node) {
41 +
      j++;
42 +
      if (j > extractedPaths.length) {
43 +
        throw new Error("Internal Babel error");
44 +
      }
45 +
    }
46 +
47 +
    needsClassRef =
48 +
      replaceThisContext(
49 +
        path,
50 +
        extractedPaths[j],
51 +
        externalClassRef,
52 +
        state,
53 +
        constantSuper,
54 +
        originalClassRef,
55 +
      ) || needsClassRef;
56 +
  }
57 +
58 +
  return needsClassRef;
59 +
}
60 +
6 61
export function replaceThisContext(
7 62
  classPath,
8 63
  fieldPath,
9 64
  ref,
10 65
  file,
11 66
  constantSuper,
67 +
  innerBindingRef,
12 68
) {
13 69
  replaceSupers(classPath, fieldPath, file, constantSuper);
14 70
15 71
  const state = { classRef: ref, needsClassRef: false };
16 72
  fieldPath.traverse(thisContextVisitor, state);
17 73
74 +
  return (
75 +
    replaceInnerBindingReferences(fieldPath, ref, innerBindingRef) ||
76 +
    state.needsClassRef
77 +
  );
78 +
}
79 +
80 +
export function replaceInnerBindingReferences(
81 +
  elemPath,
82 +
  outerBindingRef,
83 +
  innerBindingRef,
84 +
) {
85 +
  const state = { needsClassRef: false, outerBindingRef, innerBindingRef };
86 +
  if (outerBindingRef.name !== innerBindingRef?.name) {
87 +
    elemPath.traverse(innerReferencesVisitor, state);
88 +
  }
18 89
  return state.needsClassRef;
19 90
}
20 91
@@ -51,6 +122,17 @@
Loading
51 122
  environmentVisitor,
52 123
]);
53 124
125 +
const innerReferencesVisitor = {
126 +
  ReferencedIdentifier(path, state) {
127 +
    if (
128 +
      path.scope.bindingIdentifierEquals(path.node.name, state.innerBindingRef)
129 +
    ) {
130 +
      state.needsClassRef = true;
131 +
      path.node.name = state.outerBindingRef.name;
132 +
    }
133 +
  },
134 +
};
135 +
54 136
export const findBareSupers = traverse.visitors.merge([
55 137
  {
56 138
    Super(path) {

@@ -1,5 +1,9 @@
Loading
1 1
import { template, types as t } from "@babel/core";
2 2
import { findBareSupers } from "./context";
3 +
import {
4 +
  buildPrivateMethodDeclaration,
5 +
  buildPrivateNamesNodes,
6 +
} from "./private";
3 7
4 8
const referenceVisitor = {
5 9
  "TSTypeAnnotation|TypeAnnotation"(path) {
@@ -55,3 +59,69 @@
Loading
55 59
    constructor.get("body").unshiftContainer("body", nodes);
56 60
  }
57 61
}
62 +
63 +
export function injectStaticInitialization(
64 +
  path,
65 +
  nodes,
66 +
  externalClassRef,
67 +
  needsClassRef,
68 +
) {
69 +
  if (path.isClassDeclaration()) {
70 +
    path.insertAfter(nodes);
71 +
  } else {
72 +
    const assignment = t.assignmentExpression(
73 +
      "=",
74 +
      t.cloneNode(externalClassRef),
75 +
      path.node,
76 +
    );
77 +
    if (nodes.length > 0) {
78 +
      path.replaceWithMultiple([
79 +
        assignment,
80 +
        ...nodes,
81 +
        t.cloneNode(externalClassRef),
82 +
      ]);
83 +
      path.scope.push({ id: externalClassRef });
84 +
    } else if (needsClassRef) {
85 +
      path.replaceWith(assignment);
86 +
      path.scope.push({ id: externalClassRef });
87 +
    }
88 +
  }
89 +
}
90 +
91 +
export function injectPureStatics({
92 +
  state,
93 +
  path,
94 +
  privateNamesMap,
95 +
  instancePrivMethods,
96 +
  staticPrivMethods,
97 +
  privateFieldsAsProperties,
98 +
}) {
99 +
  const stmtParent = path.find(
100 +
    parent =>
101 +
      parent.isStatement() ||
102 +
      parent.isDeclaration() ||
103 +
      parent.parentPath.isArrowFunctionExpression({
104 +
        body: parent.node,
105 +
      }),
106 +
  );
107 +
108 +
  const pureStaticNodesBefore = buildPrivateNamesNodes(
109 +
    privateNamesMap,
110 +
    privateFieldsAsProperties,
111 +
    state,
112 +
  );
113 +
  if (pureStaticNodesBefore) stmtParent.insertBefore(pureStaticNodesBefore);
114 +
115 +
  const pureStaticNodesAfter = instancePrivMethods
116 +
    .concat(staticPrivMethods)
117 +
    .map(method =>
118 +
      buildPrivateMethodDeclaration(
119 +
        method,
120 +
        privateNamesMap,
121 +
        privateFieldsAsProperties,
122 +
      ),
123 +
    );
124 +
  if (pureStaticNodesAfter.length > 0) {
125 +
    stmtParent.insertAfter(pureStaticNodesAfter);
126 +
  }
127 +
}

@@ -1,16 +1,24 @@
Loading
1 1
import { types as t } from "@babel/core";
2 2
import {
3 3
  pushPrivateName,
4 -
  buildPrivateNamesNodes,
5 4
  buildPrivateInstanceFieldInitSpec,
6 5
  buildPrivateStaticFieldInitSpec,
7 6
  buildPrivateInstanceMethodInitSpec,
8 -
  buildPrivateMethodDeclaration,
9 7
  transformPrivateNamesUsage,
10 8
} from "../utils/private";
11 9
import { buildPublicFieldInitSpec } from "../utils/public";
12 -
import { injectInitialization } from "../utils/misc";
13 -
import { replaceSupers, replaceThisContext } from "../utils/context";
10 +
import {
11 +
  injectInitialization,
12 +
  injectPureStatics,
13 +
  injectStaticInitialization,
14 +
} from "../utils/misc";
15 +
import {
16 +
  ensureClassRef,
17 +
  ensureExternalClassRef,
18 +
  replaceInnerBindingReferences,
19 +
  replaceSupers,
20 +
  replaceThisContextInExtractedNodes,
21 +
} from "../utils/context";
14 22
15 23
export default function classElementsToES6(api) {
16 24
  const constantSuper = api.assumption("constantSuper");
@@ -21,53 +29,23 @@
Loading
21 29
    Class(path, state) {
22 30
      const privateNamesMap = new Map();
23 31
24 -
      const initInstanceFields = nodes =>
25 -
        nodes.map(node => {
26 -
          if (t.isPrivate(node)) {
27 -
            return buildPrivateInstanceFieldInitSpec(
28 -
              t.thisExpression(),
29 -
              node,
30 -
              path.scope,
31 -
              privateNamesMap,
32 -
            );
33 -
          } else {
34 -
            return buildPublicFieldInitSpec(t.thisExpression(), node, state);
35 -
          }
36 -
        });
37 -
      const initStaticFields = nodes =>
38 -
        nodes
39 -
          .map(node => {
40 -
            if (t.isPrivate(node)) {
41 -
              return buildPrivateStaticFieldInitSpec(
42 -
                node,
43 -
                path.scope,
44 -
                privateNamesMap,
45 -
              );
46 -
            } else {
47 -
              return buildPublicFieldInitSpec(classRef, node, state);
48 -
            }
49 -
          })
50 -
          .filter(Boolean);
51 -
      const initPrivMethods = nodes =>
52 -
        nodes
53 -
          .map(node =>
54 -
            buildPrivateInstanceMethodInitSpec(
55 -
              t.thisExpression(),
56 -
              node,
57 -
              path.scope,
58 -
              privateNamesMap,
59 -
              state,
60 -
            ),
61 -
          )
62 -
          .filter(Boolean);
63 -
64 32
      const eltsToRemove = [];
65 33
      const instanceFields = [];
66 34
      const staticFields = [];
67 35
      const instancePrivMethods = [];
68 36
      const staticPrivMethods = [];
69 37
      let constructorPath;
70 38
39 +
      const { classRef, originalClassRef } = ensureClassRef(path);
40 +
      let needsClassRef = false;
41 +
      let externalClassRef;
42 +
      const getExternalClassRef = () =>
43 +
        (externalClassRef ||= ensureExternalClassRef(
44 +
          path,
45 +
          classRef,
46 +
          originalClassRef,
47 +
        ));
48 +
71 49
      for (const el of path.get("body.body")) {
72 50
        const isStatic = el.node.static;
73 51
        if (el.isPrivate()) {
@@ -82,7 +60,15 @@
Loading
82 60
83 61
        if (el.isClassPrivateMethod()) {
84 62
          (isStatic ? staticPrivMethods : instancePrivMethods).push(el.node);
63 +
85 64
          replaceSupers(path, el, state, constantSuper);
65 +
          needsClassRef =
66 +
            replaceInnerBindingReferences(
67 +
              el,
68 +
              getExternalClassRef(),
69 +
              classRef,
70 +
            ) || needsClassRef;
71 +
86 72
          eltsToRemove.push(el);
87 73
          continue;
88 74
        }
@@ -92,20 +78,6 @@
Loading
92 78
        }
93 79
      }
94 80
95 -
      let classRef = path.node.id;
96 -
      if (!classRef) {
97 -
        path.set("id", (classRef = path.scope.generateUidIdentifier("class")));
98 -
      }
99 -
100 -
      const stmtParent = path.find(
101 -
        parent =>
102 -
          parent.isStatement() ||
103 -
          parent.isDeclaration() ||
104 -
          parent.parentPath.isArrowFunctionExpression({
105 -
            body: parent.node,
106 -
          }),
107 -
      );
108 -
109 81
      transformPrivateNamesUsage(
110 82
        classRef,
111 83
        path,
@@ -114,20 +86,61 @@
Loading
114 86
        state,
115 87
      );
116 88
117 -
      for (let i = 0, j = 0; i < staticFields.length; i++) {
118 -
        while (staticFields[i] !== eltsToRemove[j].node) {
119 -
          j++;
120 -
          if (j > eltsToRemove.length) throw new Error("Internal Babel error");
121 -
        }
122 -
123 -
        replaceThisContext(
89 +
      needsClassRef =
90 +
        replaceThisContextInExtractedNodes(
91 +
          staticFields,
92 +
          eltsToRemove,
124 93
          path,
125 -
          eltsToRemove[j],
126 -
          classRef,
94 +
          getExternalClassRef(),
95 +
          originalClassRef,
127 96
          state,
128 97
          constantSuper,
129 -
        );
130 -
      }
98 +
        ) || needsClassRef;
99 +
100 +
      const initInstanceFields = nodes =>
101 +
        nodes.map(node => {
102 +
          if (t.isPrivate(node)) {
103 +
            return buildPrivateInstanceFieldInitSpec(
104 +
              t.thisExpression(),
105 +
              node,
106 +
              path.scope,
107 +
              privateNamesMap,
108 +
            );
109 +
          } else {
110 +
            return buildPublicFieldInitSpec(t.thisExpression(), node, state);
111 +
          }
112 +
        });
113 +
      const initStaticFields = nodes =>
114 +
        nodes
115 +
          .map(node => {
116 +
            if (t.isPrivate(node)) {
117 +
              return buildPrivateStaticFieldInitSpec(
118 +
                node,
119 +
                path.scope,
120 +
                privateNamesMap,
121 +
              );
122 +
            } else {
123 +
              needsClassRef = true;
124 +
              return buildPublicFieldInitSpec(
125 +
                getExternalClassRef(),
126 +
                node,
127 +
                state,
128 +
              );
129 +
            }
130 +
          })
131 +
          .filter(Boolean);
132 +
      const initPrivMethods = nodes =>
133 +
        nodes
134 +
          .map(node =>
135 +
            buildPrivateInstanceMethodInitSpec(
136 +
              t.thisExpression(),
137 +
              node,
138 +
              path.scope,
139 +
              privateNamesMap,
140 +
              state,
141 +
            ),
142 +
          )
143 +
          .filter(Boolean);
131 144
132 145
      const instanceInit = [
133 146
        ...initPrivMethods(instancePrivMethods),
@@ -141,30 +154,21 @@
Loading
141 154
        );
142 155
      }
143 156
144 -
      const pureStaticNodesBefore = buildPrivateNamesNodes(
157 +
      injectPureStatics({
158 +
        state,
159 +
        path,
145 160
        privateNamesMap,
161 +
        instancePrivMethods,
162 +
        staticPrivMethods,
146 163
        privateFieldsAsProperties,
147 -
        state,
148 -
      );
149 -
      if (pureStaticNodesBefore) stmtParent.insertBefore(pureStaticNodesBefore);
150 -
151 -
      const pureStaticNodesAfter = instancePrivMethods
152 -
        .concat(staticPrivMethods)
153 -
        .map(method =>
154 -
          buildPrivateMethodDeclaration(
155 -
            method,
156 -
            privateNamesMap,
157 -
            privateFieldsAsProperties,
158 -
          ),
159 -
        );
160 -
      if (pureStaticNodesAfter.length > 0) {
161 -
        stmtParent.insertAfter(pureStaticNodesAfter);
162 -
      }
164 +
      });
163 165
164 -
      const staticNodesAfter = initStaticFields(staticFields).map(n =>
165 -
        t.expressionStatement(n),
166 +
      injectStaticInitialization(
167 +
        path,
168 +
        initStaticFields(staticFields).map(n => t.expressionStatement(n)),
169 +
        getExternalClassRef(),
170 +
        needsClassRef,
166 171
      );
167 -
      if (staticNodesAfter.length > 0) path.insertAfter(staticNodesAfter);
168 172
169 173
      eltsToRemove.forEach(el => el.remove());
170 174
    },

Learn more Showing 1 files with coverage changes found.

Changes in packages/babel-plugin-proposal-class-elements/src/utils/context.js
-3
+3
Loading file...
Files Coverage
codemods 100.00%
eslint 93.14%
packages 0.03% 91.99%
Project Totals (464 files) 92.04%
Loading