8889841cREADME.md000066600000000633150544633740006044 0ustar00# @babel/plugin-transform-arrow-functions > Compile ES2015 arrow functions to ES5 See our website [@babel/plugin-transform-arrow-functions](https://babeljs.io/docs/en/babel-plugin-transform-arrow-functions) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/plugin-transform-arrow-functions ``` or using yarn: ```sh yarn add @babel/plugin-transform-arrow-functions --dev ``` lib/index.js000066600000001430150544633740006774 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _helperPluginUtils = require("@babel/helper-plugin-utils"); var _default = (0, _helperPluginUtils.declare)((api, options) => { var _api$assumption; api.assertVersion(7); const noNewArrows = (_api$assumption = api.assumption("noNewArrows")) != null ? _api$assumption : !options.spec; return { name: "transform-arrow-functions", visitor: { ArrowFunctionExpression(path) { if (!path.isArrowFunctionExpression()) return; path.arrowFunctionToExpression({ allowInsertArrow: false, noNewArrows, specCompliant: !noNewArrows }); } } }; }); exports.default = _default; //# sourceMappingURL=index.js.map lib/index.js.map000066600000003421150544633740007552 0ustar00{"version":3,"names":["declare","api","options","assertVersion","noNewArrows","assumption","spec","name","visitor","ArrowFunctionExpression","path","isArrowFunctionExpression","arrowFunctionToExpression","allowInsertArrow","specCompliant"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\n\nexport interface Options {\n spec?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const noNewArrows = api.assumption(\"noNewArrows\") ?? !options.spec;\n\n return {\n name: \"transform-arrow-functions\",\n\n visitor: {\n ArrowFunctionExpression(path) {\n // In some conversion cases, it may have already been converted to a function while this callback\n // was queued up.\n if (!path.isArrowFunctionExpression()) return;\n\n path.arrowFunctionToExpression({\n // While other utils may be fine inserting other arrows to make more transforms possible,\n // the arrow transform itself absolutely cannot insert new arrow functions.\n allowInsertArrow: false,\n noNewArrows,\n\n // TODO(Babel 8): This is only needed for backward compat with @babel/traverse <7.13.0\n specCompliant: !noNewArrows,\n });\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA;AAAqD,eAMtC,IAAAA,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAAA;EAChDD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC;EAEpB,MAAMC,WAAW,sBAAGH,GAAG,CAACI,UAAU,CAAC,aAAa,CAAC,8BAAI,CAACH,OAAO,CAACI,IAAI;EAElE,OAAO;IACLC,IAAI,EAAE,2BAA2B;IAEjCC,OAAO,EAAE;MACPC,uBAAuB,CAACC,IAAI,EAAE;QAG5B,IAAI,CAACA,IAAI,CAACC,yBAAyB,EAAE,EAAE;QAEvCD,IAAI,CAACE,yBAAyB,CAAC;UAG7BC,gBAAgB,EAAE,KAAK;UACvBT,WAAW;UAGXU,aAAa,EAAE,CAACV;QAClB,CAAC,CAAC;MACJ;IACF;EACF,CAAC;AACH,CAAC,CAAC;AAAA"}LICENSE000066600000002122150544633740005565 0ustar00MIT License Copyright (c) 2014-present Sebastian McKenzie and other contributors 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. package.json000066600000001652150544633740007055 0ustar00{ "name": "@babel/plugin-transform-arrow-functions", "version": "7.20.7", "description": "Compile ES2015 arrow functions to ES5", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-plugin-transform-arrow-functions" }, "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-arrow-functions", "license": "MIT", "publishConfig": { "access": "public" }, "main": "./lib/index.js", "keywords": [ "babel-plugin" ], "dependencies": { "@babel/helper-plugin-utils": "^7.20.2" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { "@babel/core": "^7.20.7", "@babel/helper-plugin-test-runner": "^7.18.6", "@babel/traverse": "^7.20.7", "@babel/types": "^7.20.7" }, "engines": { "node": ">=6.9.0" }, "author": "The Babel Team (https://babel.dev/team)", "type": "commonjs" }