Skip to content

Commit 135ed1d

Browse files
Inline @babel/helper-get-function-arity package (#14389)
1 parent efe0188 commit 135ed1d

File tree

8 files changed

+9
-85
lines changed

8 files changed

+9
-85
lines changed

packages/babel-helper-function-name/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
},
1515
"main": "./lib/index.js",
1616
"dependencies": {
17-
"@babel/helper-get-function-arity": "workspace:^",
1817
"@babel/template": "workspace:^",
1918
"@babel/types": "workspace:^"
2019
},

packages/babel-helper-function-name/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1-
import getFunctionArity from "@babel/helper-get-function-arity";
21
import template from "@babel/template";
32
import {
43
NOT_LOCAL_BINDING,
54
cloneNode,
65
identifier,
76
isAssignmentExpression,
7+
isAssignmentPattern,
88
isFunction,
99
isIdentifier,
1010
isLiteral,
1111
isNullLiteral,
1212
isObjectMethod,
1313
isObjectProperty,
1414
isRegExpLiteral,
15+
isRestElement,
1516
isTemplateLiteral,
1617
isVariableDeclarator,
1718
toBindingIdentifierName,
1819
} from "@babel/types";
1920
import type * as t from "@babel/types";
2021

22+
function getFunctionArity(node: t.Function): number {
23+
const count = node.params.findIndex(
24+
param => isAssignmentPattern(param) || isRestElement(param),
25+
);
26+
return count === -1 ? node.params.length : count;
27+
}
28+
2129
const buildPropertyMethodAssignmentWrapper = template(`
2230
(function (FUNCTION_KEY) {
2331
function FUNCTION_ID() {

packages/babel-helper-get-function-arity/.npmignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/babel-helper-get-function-arity/README.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/babel-helper-get-function-arity/package.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/babel-helper-get-function-arity/src/index.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"./packages/babel-helper-explode-assignable-expression/src/**/*.ts",
1717
"./packages/babel-helper-fixtures/src/**/*.ts",
1818
"./packages/babel-helper-function-name/src/**/*.ts",
19-
"./packages/babel-helper-get-function-arity/src/**/*.ts",
2019
"./packages/babel-helper-hoist-variables/src/**/*.ts",
2120
"./packages/babel-helper-member-expression-to-functions/src/**/*.ts",
2221
"./packages/babel-helper-module-imports/src/**/*.ts",
@@ -190,9 +189,6 @@
190189
"@babel/helper-function-name": [
191190
"./packages/babel-helper-function-name/src"
192191
],
193-
"@babel/helper-get-function-arity": [
194-
"./packages/babel-helper-get-function-arity/src"
195-
],
196192
"@babel/helper-hoist-variables": [
197193
"./packages/babel-helper-hoist-variables/src"
198194
],

yarn.lock

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ __metadata:
691691
version: 0.0.0-use.local
692692
resolution: "@babel/helper-function-name@workspace:packages/babel-helper-function-name"
693693
dependencies:
694-
"@babel/helper-get-function-arity": "workspace:^"
695694
"@babel/template": "workspace:^"
696695
"@babel/types": "workspace:^"
697696
languageName: unknown
@@ -706,14 +705,6 @@ __metadata:
706705
languageName: node
707706
linkType: hard
708707

709-
"@babel/helper-get-function-arity@workspace:^, @babel/helper-get-function-arity@workspace:packages/babel-helper-get-function-arity":
710-
version: 0.0.0-use.local
711-
resolution: "@babel/helper-get-function-arity@workspace:packages/babel-helper-get-function-arity"
712-
dependencies:
713-
"@babel/types": "workspace:^"
714-
languageName: unknown
715-
linkType: soft
716-
717708
"@babel/helper-hoist-variables@npm:^7.15.4, @babel/helper-hoist-variables@npm:^7.16.7":
718709
version: 7.16.7
719710
resolution: "@babel/helper-hoist-variables@npm:7.16.7"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy