mirror of https://github.com/jkjoy/sunpeiwen.git
1 line
3.3 KiB
Plaintext
1 line
3.3 KiB
Plaintext
{"version":3,"names":["_helperPluginUtils","require","_params","_rest","_default","declare","api","options","_api$assumption","_api$assumption2","assertVersion","ignoreFunctionLength","assumption","loose","noNewArrows","name","visitor","Function","path","isArrowFunctionExpression","get","some","param","isRestElement","isAssignmentPattern","arrowFunctionToExpression","allowInsertArrowWithRest","isFunctionExpression","convertedRest","convertFunctionRest","convertedParams","convertFunctionParams","scope","crawl","exports","default"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport convertFunctionParams from \"./params\";\nimport convertFunctionRest from \"./rest\";\nexport { convertFunctionParams };\n\nexport interface Options {\n loose?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const ignoreFunctionLength =\n api.assumption(\"ignoreFunctionLength\") ?? options.loose;\n // Todo(BABEL 8): Consider default it to false\n const noNewArrows = api.assumption(\"noNewArrows\") ?? true;\n\n return {\n name: \"transform-parameters\",\n\n visitor: {\n Function(path) {\n if (\n path.isArrowFunctionExpression() &&\n path\n .get(\"params\")\n .some(param => param.isRestElement() || param.isAssignmentPattern())\n ) {\n // default/rest visitors require access to `arguments`, so it cannot be an arrow\n path.arrowFunctionToExpression({\n allowInsertArrowWithRest: false,\n noNewArrows,\n });\n\n // In some cases arrowFunctionToExpression replaces the function with a wrapper.\n // Return early; the wrapped function will be visited later in the AST traversal.\n if (!path.isFunctionExpression()) return;\n }\n\n const convertedRest = convertFunctionRest(path);\n const convertedParams = convertFunctionParams(\n path,\n ignoreFunctionLength,\n );\n\n if (convertedRest || convertedParams) {\n // Manually reprocess this scope to ensure that the moved params are updated.\n path.scope.crawl();\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAyC,IAAAG,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