mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-18 07:42:54 +00:00
634 lines
29 KiB
Markdown
634 lines
29 KiB
Markdown
# Snapshot report for `test/scanner/Scanner.ts`
|
|
|
|
The actual snapshot is saved in `Scanner.ts.snap`.
|
|
|
|
Generated by [AVA](https://ava.li).
|
|
|
|
## scan multiple exported component
|
|
|
|
> Snapshot 1
|
|
|
|
{
|
|
mainEntry: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
modules: [
|
|
{
|
|
fileContent: `import AIMakeBlank from './basic/AIMakeBlank';␊
|
|
import AIMakeIcon from './basic/AIMakeIcon';␊
|
|
import AIMakeImage from './basic/AIMakeImage';␊
|
|
import AIMakeLink from './basic/AIMakeLink';␊
|
|
import AIMakePlaceholder from './basic/AIMakePlaceholder';␊
|
|
import AIMakeText from './basic/AIMakeText';␊
|
|
import Root from './basic/Root';␊
|
|
export { AIMakeBlank, AIMakeIcon, AIMakeImage, AIMakeLink, AIMakePlaceholder, AIMakeText, Root };␊
|
|
`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _extends from "@babel/runtime/helpers/extends";␊
|
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import HOCBoxModelProps from '../utils/HOCBoxModelProps';␊
|
|
import HOCLayoutProps from '../utils/HOCLayoutProps';␊
|
|
import HOCBackgroundProps from '../utils/HOCBackgroundProps';␊
|
|
import HOCFlexLayoutProps from '../utils/HOCFlexLayoutProps';␊
|
|
␊
|
|
var AIMakeBlank =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakeBlank, _Component);␊
|
|
␊
|
|
function AIMakeBlank() {␊
|
|
_classCallCheck(this, AIMakeBlank);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(AIMakeBlank).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakeBlank, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var merged = {};␊
|
|
var _this$props = this.props,␊
|
|
children = _this$props.children,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
styleLayout = _this$props.styleLayout,␊
|
|
styleBackground = _this$props.styleBackground,␊
|
|
styleFlexLayout = _this$props.styleFlexLayout,␊
|
|
style = _this$props.style,␊
|
|
id = _this$props.id;␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...styleLayout,␊
|
|
...styleBackground,␊
|
|
...styleFlexLayout,␊
|
|
...style␊
|
|
};␊
|
|
␊
|
|
if (id) {␊
|
|
merged.id = id;␊
|
|
}␊
|
|
␊
|
|
return React.createElement("div", _extends({␊
|
|
style: styles␊
|
|
}, merged), children);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakeBlank;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakeBlank, "propTypes", {␊
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
styleLayout: PropTypes.object.isRequired,␊
|
|
styleBackground: PropTypes.object.isRequired,␊
|
|
styleFlexLayout: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object,␊
|
|
id: PropTypes.string␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakeBlank, "defaultProps", {␊
|
|
children: [],␊
|
|
style: {},␊
|
|
id: ''␊
|
|
});␊
|
|
␊
|
|
export default HOCBoxModelProps(HOCLayoutProps(HOCBackgroundProps(HOCFlexLayoutProps(AIMakeBlank))));`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _extends from "@babel/runtime/helpers/extends";␊
|
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";␊
|
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import classNames from 'classnames';␊
|
|
import createFromIconfont from './IconFont';␊
|
|
␊
|
|
var AIMakeIcon =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakeIcon, _Component);␊
|
|
␊
|
|
function AIMakeIcon() {␊
|
|
_classCallCheck(this, AIMakeIcon);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(AIMakeIcon).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakeIcon, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
className = _this$props.className,␊
|
|
iconClassName = _this$props.iconClassName,␊
|
|
children = _this$props.children,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
styleText = _this$props.styleText,␊
|
|
styleBackground = _this$props.styleBackground,␊
|
|
style = _this$props.style,␊
|
|
otherProps = _objectWithoutProperties(_this$props, ["className", "iconClassName", "children", "styleBoxModel", "styleText", "styleBackground", "style"]);␊
|
|
␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...styleText,␊
|
|
...styleBackground,␊
|
|
...style␊
|
|
};␊
|
|
return React.createElement("i", _extends({}, otherProps, {␊
|
|
className: classNames(className, iconClassName),␊
|
|
style: styles␊
|
|
}), children);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakeIcon;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakeIcon, "propTypes", {␊
|
|
className: PropTypes.string,␊
|
|
iconClassName: PropTypes.string,␊
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
styleText: PropTypes.object.isRequired,␊
|
|
styleBackground: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakeIcon, "defaultProps", {␊
|
|
className: '',␊
|
|
iconClassName: 'iconfont',␊
|
|
children: '',␊
|
|
style: {}␊
|
|
});␊
|
|
␊
|
|
AIMakeIcon.createFromIconfont = createFromIconfont;␊
|
|
export default AIMakeIcon;`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _extends from "@babel/runtime/helpers/extends";␊
|
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";␊
|
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import HOCBoxModelProps from '../utils/HOCBoxModelProps';␊
|
|
␊
|
|
var AIMakeImage =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakeImage, _Component);␊
|
|
␊
|
|
function AIMakeImage() {␊
|
|
_classCallCheck(this, AIMakeImage);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(AIMakeImage).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakeImage, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
style = _this$props.style,␊
|
|
otherProps = _objectWithoutProperties(_this$props, ["styleBoxModel", "style"]);␊
|
|
␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...style␊
|
|
};␊
|
|
return React.createElement("img", _extends({}, otherProps, {␊
|
|
style: styles,␊
|
|
alt: "AIMakeImage"␊
|
|
}));␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakeImage;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakeImage, "propTypes", {␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakeImage, "defaultProps", {␊
|
|
style: {}␊
|
|
});␊
|
|
␊
|
|
export default HOCBoxModelProps(AIMakeImage);`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _extends from "@babel/runtime/helpers/extends";␊
|
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";␊
|
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import HOCBoxModelProps from '../utils/HOCBoxModelProps';␊
|
|
import HOCTextProps from '../utils/HOCTextProps';␊
|
|
import HOCLayoutProps from '../utils/HOCLayoutProps';␊
|
|
import HOCBackgroundProps from '../utils/HOCBackgroundProps';␊
|
|
␊
|
|
var AIMakeLink =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakeLink, _Component);␊
|
|
␊
|
|
function AIMakeLink() {␊
|
|
_classCallCheck(this, AIMakeLink);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(AIMakeLink).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakeLink, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
children = _this$props.children,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
styleText = _this$props.styleText,␊
|
|
styleLayout = _this$props.styleLayout,␊
|
|
styleBackground = _this$props.styleBackground,␊
|
|
style = _this$props.style,␊
|
|
otherProps = _objectWithoutProperties(_this$props, ["children", "styleBoxModel", "styleText", "styleLayout", "styleBackground", "style"]);␊
|
|
␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...styleText,␊
|
|
...styleLayout,␊
|
|
...styleBackground,␊
|
|
...style␊
|
|
};␊
|
|
␊
|
|
if (typeof children !== 'string') {␊
|
|
styles.display = 'inline-block';␊
|
|
}␊
|
|
␊
|
|
return React.createElement("a", _extends({}, otherProps, {␊
|
|
style: styles␊
|
|
}), [children]);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakeLink;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakeLink, "propTypes", {␊
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
styleText: PropTypes.object.isRequired,␊
|
|
styleLayout: PropTypes.object.isRequired,␊
|
|
styleBackground: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakeLink, "defaultProps", {␊
|
|
children: '',␊
|
|
style: {}␊
|
|
});␊
|
|
␊
|
|
export default HOCBoxModelProps(HOCTextProps(HOCLayoutProps(HOCBackgroundProps(AIMakeLink))));`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import HOCBoxModelProps from '../utils/HOCBoxModelProps';␊
|
|
import HOCLayoutProps from '../utils/HOCLayoutProps';␊
|
|
␊
|
|
var AIMakePlaceholder =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakePlaceholder, _Component);␊
|
|
␊
|
|
function AIMakePlaceholder() {␊
|
|
_classCallCheck(this, AIMakePlaceholder);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(AIMakePlaceholder).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakePlaceholder, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
children = _this$props.children,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
styleLayout = _this$props.styleLayout,␊
|
|
style = _this$props.style;␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...styleLayout,␊
|
|
...style␊
|
|
};␊
|
|
var placeholderStyle = {␊
|
|
display: 'inline-block',␊
|
|
border: '1px dashed #aaa',␊
|
|
lineHeight: styles.height,␊
|
|
backgroundColor: '#F5E075',␊
|
|
overflow: 'hidden',␊
|
|
textAlign: 'center',␊
|
|
...styles␊
|
|
};␊
|
|
return React.createElement("div", {␊
|
|
style: placeholderStyle␊
|
|
}, children);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakePlaceholder;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakePlaceholder, "propTypes", {␊
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
styleLayout: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakePlaceholder, "defaultProps", {␊
|
|
children: '',␊
|
|
style: {}␊
|
|
});␊
|
|
␊
|
|
export default HOCBoxModelProps(HOCLayoutProps(AIMakePlaceholder));`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React, { Component } from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import HOCBoxModelProps from '../utils/HOCBoxModelProps';␊
|
|
import HOCTextProps from '../utils/HOCTextProps';␊
|
|
import HOCLayoutProps from '../utils/HOCLayoutProps';␊
|
|
import HOCBackgroundProps from '../utils/HOCBackgroundProps';␊
|
|
␊
|
|
var AIMakeText =␊
|
|
/*#__PURE__*/␊
|
|
function (_Component) {␊
|
|
_inherits(AIMakeText, _Component);␊
|
|
␊
|
|
function AIMakeText() {␊
|
|
var _this;␊
|
|
␊
|
|
_classCallCheck(this, AIMakeText);␊
|
|
␊
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {␊
|
|
args[_key] = arguments[_key];␊
|
|
}␊
|
|
␊
|
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(AIMakeText).call(this, ...args));␊
|
|
␊
|
|
_defineProperty(_assertThisInitialized(_this), "generateComponentType", function (componentType) {␊
|
|
var componentNameMap = {␊
|
|
h1: 'h1',␊
|
|
h2: 'h2',␊
|
|
h3: 'h3',␊
|
|
h4: 'h4',␊
|
|
h5: 'h5',␊
|
|
paragraph: 'p',␊
|
|
label: 'label'␊
|
|
};␊
|
|
return componentNameMap[componentType] || 'div';␊
|
|
});␊
|
|
␊
|
|
return _this;␊
|
|
}␊
|
|
␊
|
|
_createClass(AIMakeText, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
children = _this$props.children,␊
|
|
type = _this$props.type,␊
|
|
styleBoxModel = _this$props.styleBoxModel,␊
|
|
styleText = _this$props.styleText,␊
|
|
styleLayout = _this$props.styleLayout,␊
|
|
styleBackground = _this$props.styleBackground,␊
|
|
style = _this$props.style;␊
|
|
var styles = { ...styleBoxModel,␊
|
|
...styleText,␊
|
|
...styleLayout,␊
|
|
...styleBackground,␊
|
|
...style␊
|
|
};␊
|
|
var Comp = this.generateComponentType(type);␊
|
|
var labelStyle = Comp === 'label' ? {␊
|
|
display: 'inline-block'␊
|
|
} : {};␊
|
|
return React.createElement(Comp, {␊
|
|
className: "AIMakeText",␊
|
|
style: Object.assign(labelStyle, styles)␊
|
|
}, [children]);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return AIMakeText;␊
|
|
}(Component);␊
|
|
␊
|
|
_defineProperty(AIMakeText, "propTypes", {␊
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.string]),␊
|
|
type: PropTypes.string,␊
|
|
styleBoxModel: PropTypes.object.isRequired,␊
|
|
styleText: PropTypes.object.isRequired,␊
|
|
styleLayout: PropTypes.object.isRequired,␊
|
|
styleBackground: PropTypes.object.isRequired,␊
|
|
style: PropTypes.object␊
|
|
});␊
|
|
␊
|
|
_defineProperty(AIMakeText, "defaultProps", {␊
|
|
children: '',␊
|
|
type: '',␊
|
|
// paragraph || label␊
|
|
style: {}␊
|
|
});␊
|
|
␊
|
|
export default HOCBoxModelProps(HOCTextProps(HOCLayoutProps(HOCBackgroundProps(AIMakeText))));`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/index.js',
|
|
},
|
|
{
|
|
fileContent: `import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";␊
|
|
import React from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
␊
|
|
var Root =␊
|
|
/*#__PURE__*/␊
|
|
function (_React$Component) {␊
|
|
_inherits(Root, _React$Component);␊
|
|
␊
|
|
function Root() {␊
|
|
_classCallCheck(this, Root);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(Root).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(Root, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
var _this$props = this.props,␊
|
|
style = _this$props.style,␊
|
|
children = _this$props.children;␊
|
|
var newStyle = Object.assign({}, Root.defaultProps.style, style);␊
|
|
return React.createElement("div", {␊
|
|
style: newStyle␊
|
|
}, children);␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return Root;␊
|
|
}(React.Component);␊
|
|
␊
|
|
_defineProperty(Root, "propTypes", {␊
|
|
style: PropTypes.object,␊
|
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])␊
|
|
});␊
|
|
␊
|
|
_defineProperty(Root, "defaultProps", {␊
|
|
style: {␊
|
|
padding: 0,␊
|
|
backgroundColor: '#f0f2f5',␊
|
|
minHeight: '100%'␊
|
|
},␊
|
|
children: null␊
|
|
});␊
|
|
␊
|
|
export default Root;`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/index.js',
|
|
},
|
|
],
|
|
pkgName: 'multiple-exported-component',
|
|
pkgVersion: '1.0.0',
|
|
sourceType: 'module',
|
|
}
|
|
|
|
## scan single exported component
|
|
|
|
> Snapshot 1
|
|
|
|
{
|
|
mainEntry: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
|
modules: [
|
|
{
|
|
fileContent: `import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
|
import _createClass from "@babel/runtime/helpers/createClass";␊
|
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";␊
|
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";␊
|
|
import _inherits from "@babel/runtime/helpers/inherits";␊
|
|
␊
|
|
/* eslint-disable react/no-unused-prop-types */␊
|
|
␊
|
|
/* eslint-disable react/require-default-props */␊
|
|
import React from 'react';␊
|
|
import PropTypes from 'prop-types';␊
|
|
import "./main.css";␊
|
|
␊
|
|
var Demo =␊
|
|
/*#__PURE__*/␊
|
|
function (_React$Component) {␊
|
|
_inherits(Demo, _React$Component);␊
|
|
␊
|
|
function Demo() {␊
|
|
_classCallCheck(this, Demo);␊
|
|
␊
|
|
return _possibleConstructorReturn(this, _getPrototypeOf(Demo).apply(this, arguments));␊
|
|
}␊
|
|
␊
|
|
_createClass(Demo, [{␊
|
|
key: "render",␊
|
|
value: function render() {␊
|
|
return React.createElement("div", null, " Test ");␊
|
|
}␊
|
|
}]);␊
|
|
␊
|
|
return Demo;␊
|
|
}(React.Component);␊
|
|
␊
|
|
Demo.propTypes = {␊
|
|
optionalArray: PropTypes.array,␊
|
|
optionalBool: PropTypes.bool,␊
|
|
optionalFunc: PropTypes.func,␊
|
|
optionalNumber: PropTypes.number,␊
|
|
optionalObject: PropTypes.object,␊
|
|
optionalString: PropTypes.string,␊
|
|
optionalSymbol: PropTypes.symbol,␊
|
|
// Anything that can be rendered: numbers, strings, elements or an array␊
|
|
// (or fragment) containing these types.␊
|
|
optionalNode: PropTypes.node,␊
|
|
// A React element (ie. <MyComponent />).␊
|
|
optionalElement: PropTypes.element,␊
|
|
// A React element type (ie. MyComponent).␊
|
|
optionalElementType: PropTypes.elementType,␊
|
|
// You can also declare that a prop is an instance of a class. This uses␊
|
|
// JS's instanceof operator.␊
|
|
optionalMessage: PropTypes.instanceOf(Demo),␊
|
|
// You can ensure that your prop is limited to specific values by treating␊
|
|
// it as an enum.␊
|
|
optionalEnum: PropTypes.oneOf(['News', 'Photos']),␊
|
|
// An object that could be one of many types␊
|
|
optionalUnion: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Demo)]),␊
|
|
// An array of a certain type␊
|
|
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),␊
|
|
// An object with property values of a certain type␊
|
|
optionalObjectOf: PropTypes.objectOf(PropTypes.number),␊
|
|
// You can chain any of the above with `isRequired` to make sure a warning␊
|
|
// is shown if the prop isn't provided.␊
|
|
// An object taking on a particular shape␊
|
|
optionalObjectWithShape: PropTypes.shape({␊
|
|
optionalProperty: PropTypes.string,␊
|
|
requiredProperty: PropTypes.number.isRequired␊
|
|
}),␊
|
|
optionalObjectWithShape2: PropTypes.shape({␊
|
|
optionalProperty: PropTypes.string,␊
|
|
requiredProperty: PropTypes.number.isRequired␊
|
|
}).isRequired,␊
|
|
// An object with warnings on extra properties␊
|
|
optionalObjectWithStrictShape: PropTypes.exact({␊
|
|
optionalProperty: PropTypes.string,␊
|
|
requiredProperty: PropTypes.number.isRequired␊
|
|
}),␊
|
|
requiredFunc: PropTypes.func.isRequired,␊
|
|
// A value of any data type␊
|
|
requiredAny: PropTypes.any.isRequired␊
|
|
};␊
|
|
Demo.defaultProps = {};␊
|
|
export default Demo;`,
|
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
|
},
|
|
],
|
|
pkgName: 'single-exported-component',
|
|
pkgVersion: '1.0.0',
|
|
sourceType: 'module',
|
|
}
|