mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
react app
This commit is contained in:
4
react-app/node_modules/babel-plugin-transform-react-display-name/.npmignore
generated
vendored
Normal file
4
react-app/node_modules/babel-plugin-transform-react-display-name/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
35
react-app/node_modules/babel-plugin-transform-react-display-name/README.md
generated
vendored
Normal file
35
react-app/node_modules/babel-plugin-transform-react-display-name/README.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# babel-plugin-transform-react-display-name
|
||||
|
||||
Add displayName to React.createClass calls
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-react-display-name
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-display-name"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-react-display-name script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-react-display-name"]
|
||||
});
|
||||
```
|
109
react-app/node_modules/babel-plugin-transform-react-display-name/lib/index.js
generated
vendored
Normal file
109
react-app/node_modules/babel-plugin-transform-react-display-name/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
exports["default"] = function (_ref) {
|
||||
var t = _ref.types;
|
||||
|
||||
function addDisplayName(id, call) {
|
||||
var props = call.arguments[0].properties;
|
||||
var safe = true;
|
||||
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
var key = t.toComputedKey(prop);
|
||||
if (t.isLiteral(key, { value: "displayName" })) {
|
||||
safe = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (safe) {
|
||||
props.unshift(t.objectProperty(t.identifier("displayName"), t.stringLiteral(id)));
|
||||
}
|
||||
}
|
||||
|
||||
var isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass");
|
||||
|
||||
function isCreateClass(node) {
|
||||
if (!node || !t.isCallExpression(node)) return false;
|
||||
|
||||
// not React.createClass call member object
|
||||
if (!isCreateClassCallExpression(node.callee)) return false;
|
||||
|
||||
// no call arguments
|
||||
var args = node.arguments;
|
||||
if (args.length !== 1) return false;
|
||||
|
||||
// first node arg is not an object
|
||||
var first = args[0];
|
||||
if (!t.isObjectExpression(first)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
ExportDefaultDeclaration: function ExportDefaultDeclaration(_ref2, state) {
|
||||
var node = _ref2.node;
|
||||
|
||||
if (isCreateClass(node.declaration)) {
|
||||
var displayName = state.file.opts.basename;
|
||||
|
||||
// ./{module name}/index.js
|
||||
if (displayName === "index") {
|
||||
displayName = _path2["default"].basename(_path2["default"].dirname(state.file.opts.filename));
|
||||
}
|
||||
|
||||
addDisplayName(displayName, node.declaration);
|
||||
}
|
||||
},
|
||||
|
||||
CallExpression: function CallExpression(path) {
|
||||
var node = path.node;
|
||||
|
||||
if (!isCreateClass(node)) return;
|
||||
|
||||
var id = undefined;
|
||||
|
||||
// crawl up the ancestry looking for possible candidates for displayName inference
|
||||
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()) {
|
||||
// we've hit a statement, we should stop crawling up
|
||||
return true;
|
||||
}
|
||||
|
||||
// we've got an id! no need to continue
|
||||
if (id) return true;
|
||||
});
|
||||
|
||||
// ensure that we have an identifier we can inherit from
|
||||
if (!id) return;
|
||||
|
||||
// foo.bar -> bar
|
||||
if (t.isMemberExpression(id)) {
|
||||
id = id.property;
|
||||
}
|
||||
|
||||
// identifiers are the only thing we can reliably get a name from
|
||||
if (t.isIdentifier(id)) {
|
||||
addDisplayName(id.name, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = exports["default"];
|
92
react-app/node_modules/babel-plugin-transform-react-display-name/package.json
generated
vendored
Normal file
92
react-app/node_modules/babel-plugin-transform-react-display-name/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"babel-plugin-transform-react-display-name@^6.3.13",
|
||||
"/Users/mromano/dev/react-sfs/node_modules/babel-preset-react"
|
||||
]
|
||||
],
|
||||
"_from": "babel-plugin-transform-react-display-name@>=6.3.13 <7.0.0",
|
||||
"_id": "babel-plugin-transform-react-display-name@6.5.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/babel-plugin-transform-react-display-name",
|
||||
"_nodeVersion": "5.1.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/babel-plugin-transform-react-display-name-6.5.0.tgz_1454803685937_0.3640021972823888"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "hi@henryzoo.com",
|
||||
"name": "hzoo"
|
||||
},
|
||||
"_npmVersion": "3.6.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "babel-plugin-transform-react-display-name",
|
||||
"raw": "babel-plugin-transform-react-display-name@^6.3.13",
|
||||
"rawSpec": "^6.3.13",
|
||||
"scope": null,
|
||||
"spec": ">=6.3.13 <7.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-preset-react"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.5.0.tgz",
|
||||
"_shasum": "99bf7794e324aaf14983c01375db4f8cdef84bb7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "babel-plugin-transform-react-display-name@^6.3.13",
|
||||
"_where": "/Users/mromano/dev/react-sfs/node_modules/babel-preset-react",
|
||||
"dependencies": {
|
||||
"babel-runtime": "^5.0.0"
|
||||
},
|
||||
"description": "Add displayName to React.createClass calls",
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.3.13"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "99bf7794e324aaf14983c01375db4f8cdef84bb7",
|
||||
"tarball": "https://registry.npmjs.org/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.5.0.tgz"
|
||||
},
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "amjad.masad@gmail.com",
|
||||
"name": "amasad"
|
||||
},
|
||||
{
|
||||
"email": "hi@henryzoo.com",
|
||||
"name": "hzoo"
|
||||
},
|
||||
{
|
||||
"email": "npm-public@jessemccarthy.net",
|
||||
"name": "jmm"
|
||||
},
|
||||
{
|
||||
"email": "loganfsmyth@gmail.com",
|
||||
"name": "loganfsmyth"
|
||||
},
|
||||
{
|
||||
"email": "sebmck@gmail.com",
|
||||
"name": "sebmck"
|
||||
},
|
||||
{
|
||||
"email": "me@thejameskyle.com",
|
||||
"name": "thejameskyle"
|
||||
}
|
||||
],
|
||||
"name": "babel-plugin-transform-react-display-name",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-display-name"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "6.5.0"
|
||||
}
|
Reference in New Issue
Block a user