Skip to content

Commit

Permalink
Inline @babel/helper-get-function-arity package (#14389)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 24, 2022
1 parent efe0188 commit 135ed1d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 85 deletions.
1 change: 0 additions & 1 deletion packages/babel-helper-function-name/package.json
Expand Up @@ -14,7 +14,6 @@
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-get-function-arity": "workspace:^",
"@babel/template": "workspace:^",
"@babel/types": "workspace:^"
},
Expand Down
10 changes: 9 additions & 1 deletion packages/babel-helper-function-name/src/index.ts
@@ -1,23 +1,31 @@
import getFunctionArity from "@babel/helper-get-function-arity";
import template from "@babel/template";
import {
NOT_LOCAL_BINDING,
cloneNode,
identifier,
isAssignmentExpression,
isAssignmentPattern,
isFunction,
isIdentifier,
isLiteral,
isNullLiteral,
isObjectMethod,
isObjectProperty,
isRegExpLiteral,
isRestElement,
isTemplateLiteral,
isVariableDeclarator,
toBindingIdentifierName,
} from "@babel/types";
import type * as t from "@babel/types";

function getFunctionArity(node: t.Function): number {
const count = node.params.findIndex(
param => isAssignmentPattern(param) || isRestElement(param),
);
return count === -1 ? node.params.length : count;
}

const buildPropertyMethodAssignmentWrapper = template(`
(function (FUNCTION_KEY) {
function FUNCTION_ID() {
Expand Down
3 changes: 0 additions & 3 deletions packages/babel-helper-get-function-arity/.npmignore

This file was deleted.

19 changes: 0 additions & 19 deletions packages/babel-helper-get-function-arity/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions packages/babel-helper-get-function-arity/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions packages/babel-helper-get-function-arity/src/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions tsconfig.json
Expand Up @@ -16,7 +16,6 @@
"./packages/babel-helper-explode-assignable-expression/src/**/*.ts",
"./packages/babel-helper-fixtures/src/**/*.ts",
"./packages/babel-helper-function-name/src/**/*.ts",
"./packages/babel-helper-get-function-arity/src/**/*.ts",
"./packages/babel-helper-hoist-variables/src/**/*.ts",
"./packages/babel-helper-member-expression-to-functions/src/**/*.ts",
"./packages/babel-helper-module-imports/src/**/*.ts",
Expand Down Expand Up @@ -190,9 +189,6 @@
"@babel/helper-function-name": [
"./packages/babel-helper-function-name/src"
],
"@babel/helper-get-function-arity": [
"./packages/babel-helper-get-function-arity/src"
],
"@babel/helper-hoist-variables": [
"./packages/babel-helper-hoist-variables/src"
],
Expand Down
9 changes: 0 additions & 9 deletions yarn.lock
Expand Up @@ -691,7 +691,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@babel/helper-function-name@workspace:packages/babel-helper-function-name"
dependencies:
"@babel/helper-get-function-arity": "workspace:^"
"@babel/template": "workspace:^"
"@babel/types": "workspace:^"
languageName: unknown
Expand All @@ -706,14 +705,6 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-get-function-arity@workspace:^, @babel/helper-get-function-arity@workspace:packages/babel-helper-get-function-arity":
version: 0.0.0-use.local
resolution: "@babel/helper-get-function-arity@workspace:packages/babel-helper-get-function-arity"
dependencies:
"@babel/types": "workspace:^"
languageName: unknown
linkType: soft

"@babel/helper-hoist-variables@npm:^7.15.4, @babel/helper-hoist-variables@npm:^7.16.7":
version: 7.16.7
resolution: "@babel/helper-hoist-variables@npm:7.16.7"
Expand Down

0 comments on commit 135ed1d

Please sign in to comment.