feat: initial commit
This commit is contained in:
22
node_modules/@babel/plugin-transform-react-display-name/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/plugin-transform-react-display-name/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT 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.
|
19
node_modules/@babel/plugin-transform-react-display-name/README.md
generated
vendored
Normal file
19
node_modules/@babel/plugin-transform-react-display-name/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/plugin-transform-react-display-name
|
||||
|
||||
> Add displayName to React.createClass calls
|
||||
|
||||
See our website [@babel/plugin-transform-react-display-name](https://babeljs.io/docs/babel-plugin-transform-react-display-name) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-react-display-name
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/plugin-transform-react-display-name --dev
|
||||
```
|
92
node_modules/@babel/plugin-transform-react-display-name/lib/index.js
generated
vendored
Normal file
92
node_modules/@babel/plugin-transform-react-display-name/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
||||
var _path = require("path");
|
||||
var _core = require("@babel/core");
|
||||
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
|
||||
api.assertVersion(7);
|
||||
function addDisplayName(id, call) {
|
||||
const props = call.arguments[0].properties;
|
||||
let safe = true;
|
||||
for (let i = 0; i < props.length; i++) {
|
||||
const prop = props[i];
|
||||
if (_core.types.isSpreadElement(prop)) {
|
||||
continue;
|
||||
}
|
||||
const key = _core.types.toComputedKey(prop);
|
||||
if (_core.types.isStringLiteral(key, {
|
||||
value: "displayName"
|
||||
})) {
|
||||
safe = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (safe) {
|
||||
props.unshift(_core.types.objectProperty(_core.types.identifier("displayName"), _core.types.stringLiteral(id)));
|
||||
}
|
||||
}
|
||||
const isCreateClassCallExpression = _core.types.buildMatchMemberExpression("React.createClass");
|
||||
const isCreateClassAddon = callee => _core.types.isIdentifier(callee, {
|
||||
name: "createReactClass"
|
||||
});
|
||||
function isCreateClass(node) {
|
||||
if (!node || !_core.types.isCallExpression(node)) return false;
|
||||
if (!isCreateClassCallExpression(node.callee) && !isCreateClassAddon(node.callee)) {
|
||||
return false;
|
||||
}
|
||||
const args = node.arguments;
|
||||
if (args.length !== 1) return false;
|
||||
const first = args[0];
|
||||
if (!_core.types.isObjectExpression(first)) return false;
|
||||
return true;
|
||||
}
|
||||
return {
|
||||
name: "transform-react-display-name",
|
||||
visitor: {
|
||||
ExportDefaultDeclaration({
|
||||
node
|
||||
}, state) {
|
||||
if (isCreateClass(node.declaration)) {
|
||||
const filename = state.filename || "unknown";
|
||||
let displayName = _path.basename(filename, _path.extname(filename));
|
||||
if (displayName === "index") {
|
||||
displayName = _path.basename(_path.dirname(filename));
|
||||
}
|
||||
addDisplayName(displayName, node.declaration);
|
||||
}
|
||||
},
|
||||
CallExpression(path) {
|
||||
const {
|
||||
node
|
||||
} = path;
|
||||
if (!isCreateClass(node)) return;
|
||||
let id;
|
||||
path.find(function (path) {
|
||||
if (path.isAssignmentExpression()) {
|
||||
id = path.node.left;
|
||||
} else if (path.isObjectProperty()) {
|
||||
id = path.node.key;
|
||||
} else if (path.isVariableDeclarator()) {
|
||||
id = path.node.id;
|
||||
} else if (path.isStatement()) {
|
||||
return true;
|
||||
}
|
||||
if (id) return true;
|
||||
});
|
||||
if (!id) return;
|
||||
if (_core.types.isMemberExpression(id)) {
|
||||
id = id.property;
|
||||
}
|
||||
if (_core.types.isIdentifier(id)) {
|
||||
addDisplayName(id.name, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@babel/plugin-transform-react-display-name/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/plugin-transform-react-display-name/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
node_modules/@babel/plugin-transform-react-display-name/package.json
generated
vendored
Normal file
34
node_modules/@babel/plugin-transform-react-display-name/package.json
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@babel/plugin-transform-react-display-name",
|
||||
"version": "7.24.7",
|
||||
"description": "Add displayName to React.createClass calls",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-plugin-transform-react-display-name"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-react-display-name",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.24.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.7",
|
||||
"@babel/helper-plugin-test-runner": "^7.24.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"type": "commonjs"
|
||||
}
|
17
node_modules/@babel/plugin-transform-react-display-name/tsconfig.json
generated
vendored
Normal file
17
node_modules/@babel/plugin-transform-react-display-name/tsconfig.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/* This file is automatically generated by scripts/generators/tsconfig.js */
|
||||
{
|
||||
"extends": [
|
||||
"../../tsconfig.base.json",
|
||||
"../../tsconfig.paths.json"
|
||||
],
|
||||
"include": [
|
||||
"../../packages/babel-plugin-transform-react-display-name/src/**/*.ts",
|
||||
"../../lib/globals.d.ts",
|
||||
"../../scripts/repo-utils/*.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/babel-helper-plugin-utils"
|
||||
}
|
||||
]
|
||||
}
|
1
node_modules/@babel/plugin-transform-react-display-name/tsconfig.tsbuildinfo
generated
vendored
Normal file
1
node_modules/@babel/plugin-transform-react-display-name/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user