mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-21 16:30:32 +00:00
refactor: 💡 refactor with react-docgen
BREAKING CHANGE: 🧨 use react-docgen to replace parser
This commit is contained in:
parent
ebbe58df70
commit
64c9daa1f4
@ -1,11 +1,6 @@
|
|||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
import defaultExtension from '../extensions';
|
import defaultExtension from '../extensions';
|
||||||
import {
|
import { debug, IComponentMaterial, PropsSection } from '../otter-core';
|
||||||
debug,
|
|
||||||
IComponentMaterial,
|
|
||||||
PropsSection,
|
|
||||||
PropType,
|
|
||||||
} from '../otter-core';
|
|
||||||
import {
|
import {
|
||||||
IGenerator,
|
IGenerator,
|
||||||
IMaterializeOptions,
|
IMaterializeOptions,
|
||||||
@ -102,14 +97,14 @@ class Generator implements IGenerator {
|
|||||||
manifestObj: IComponentMaterial; // manifest 文件对象
|
manifestObj: IComponentMaterial; // manifest 文件对象
|
||||||
}> {
|
}> {
|
||||||
const manifestObj: Partial<IComponentMaterial> = {
|
const manifestObj: Partial<IComponentMaterial> = {
|
||||||
componentName: matParsedModel.defaultExportName,
|
// componentName: matParsedModel.defaultExportName,
|
||||||
title: '',
|
title: matScanModel.pkgName,
|
||||||
docUrl: '',
|
docUrl: '',
|
||||||
screenshot: '',
|
screenshot: '',
|
||||||
npm: {
|
npm: {
|
||||||
package: matScanModel.pkgName,
|
package: matScanModel.pkgName,
|
||||||
version: matScanModel.pkgVersion,
|
version: matScanModel.pkgVersion,
|
||||||
exportName: matParsedModel.defaultExportName,
|
exportName: '', // matParsedModel.defaultExportName,
|
||||||
main: matScanModel.mainEntry,
|
main: matScanModel.mainEntry,
|
||||||
destructuring: false,
|
destructuring: false,
|
||||||
subName: '',
|
subName: '',
|
||||||
@ -122,7 +117,7 @@ class Generator implements IGenerator {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 填充 props
|
// 填充 props
|
||||||
manifestObj.props = this.populateProps(matParsedModel);
|
manifestObj.props = matParsedModel.props;
|
||||||
// 执行扩展点
|
// 执行扩展点
|
||||||
const manifest: any = await this.executeExtensionPoint(
|
const manifest: any = await this.executeExtensionPoint(
|
||||||
'mat:config:manifest',
|
'mat:config:manifest',
|
||||||
@ -149,24 +144,8 @@ class Generator implements IGenerator {
|
|||||||
public populateProps(
|
public populateProps(
|
||||||
matParsedModel: IMaterialParsedModel,
|
matParsedModel: IMaterialParsedModel,
|
||||||
): PropsSection['props'] {
|
): PropsSection['props'] {
|
||||||
// 填充 props
|
// @ts-ignore
|
||||||
const props: PropsSection['props'] = [];
|
return matParsedModel.props;
|
||||||
matParsedModel.propsTypes.forEach(item => {
|
|
||||||
const defaultValueItem = matParsedModel.propsDefaults.find(
|
|
||||||
inner => inner.name === item.name,
|
|
||||||
);
|
|
||||||
let propItem: Partial<PropsSection['props'][0]> = item;
|
|
||||||
|
|
||||||
if (defaultValueItem) {
|
|
||||||
propItem = {
|
|
||||||
...propItem,
|
|
||||||
defaultValue: defaultValueItem.defaultValue,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
props.push(propItem as PropsSection['props'][0]);
|
|
||||||
});
|
|
||||||
|
|
||||||
return props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = function checkIsIIFE(path: any) {
|
||||||
|
return (
|
||||||
|
path.value.callee &&
|
||||||
|
path.value.callee.type === 'FunctionExpression' &&
|
||||||
|
path.node.type === 'CallExpression'
|
||||||
|
);
|
||||||
|
};
|
||||||
157
packages/material-parser/src/parser/resolver/index.ts
Normal file
157
packages/material-parser/src/parser/resolver/index.ts
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { namedTypes as t, visit } from 'ast-types';
|
||||||
|
const {
|
||||||
|
isExportsOrModuleAssignment,
|
||||||
|
isReactComponentClass,
|
||||||
|
isReactCreateClassCall,
|
||||||
|
isReactForwardRefCall,
|
||||||
|
isStatelessComponent,
|
||||||
|
normalizeClassDefinition,
|
||||||
|
resolveExportDeclaration,
|
||||||
|
resolveToValue,
|
||||||
|
} = require('react-docgen').utils;
|
||||||
|
import resolveHOC from './resolveHOC';
|
||||||
|
import resolveIIFE from './resolveIIFE';
|
||||||
|
import resolveTranspiledClass from './resolveTranspiledClass';
|
||||||
|
|
||||||
|
const ERROR_MULTIPLE_DEFINITIONS =
|
||||||
|
'Multiple exported component definitions found.';
|
||||||
|
|
||||||
|
function ignore() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isComponentDefinition(path: any) {
|
||||||
|
return (
|
||||||
|
isReactCreateClassCall(path) ||
|
||||||
|
isReactComponentClass(path) ||
|
||||||
|
isStatelessComponent(path) ||
|
||||||
|
isReactForwardRefCall(path)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveDefinition(definition: any) {
|
||||||
|
if (isReactCreateClassCall(definition)) {
|
||||||
|
// return argument
|
||||||
|
const resolvedPath = resolveToValue(definition.get('arguments', 0));
|
||||||
|
if (t.ObjectExpression.check(resolvedPath.node)) {
|
||||||
|
return resolvedPath;
|
||||||
|
}
|
||||||
|
} else if (isReactComponentClass(definition)) {
|
||||||
|
normalizeClassDefinition(definition);
|
||||||
|
return definition;
|
||||||
|
} else if (
|
||||||
|
isStatelessComponent(definition) ||
|
||||||
|
isReactForwardRefCall(definition)
|
||||||
|
) {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given an AST, this function tries to find the exported component definition.
|
||||||
|
*
|
||||||
|
* The component definition is either the ObjectExpression passed to
|
||||||
|
* `React.createClass` or a `class` definition extending `React.Component` or
|
||||||
|
* having a `render()` method.
|
||||||
|
*
|
||||||
|
* If a definition is part of the following statements, it is considered to be
|
||||||
|
* exported:
|
||||||
|
*
|
||||||
|
* modules.exports = Definition;
|
||||||
|
* exports.foo = Definition;
|
||||||
|
* export default Definition;
|
||||||
|
* export var Definition = ...;
|
||||||
|
*/
|
||||||
|
export default function findExportedComponentDefinition(ast: any) {
|
||||||
|
let foundDefinition: any;
|
||||||
|
|
||||||
|
function exportDeclaration(path: any) {
|
||||||
|
const definitions = resolveExportDeclaration(path).reduce(
|
||||||
|
(acc: any, definition: any) => {
|
||||||
|
if (isComponentDefinition(definition)) {
|
||||||
|
acc.push(definition);
|
||||||
|
} else {
|
||||||
|
definition = resolveToValue(resolveIIFE(definition));
|
||||||
|
if (!isComponentDefinition(definition)) {
|
||||||
|
definition = resolveTranspiledClass(definition);
|
||||||
|
// console.log("path");
|
||||||
|
}
|
||||||
|
const resolved = resolveToValue(resolveHOC(definition));
|
||||||
|
if (isComponentDefinition(resolved)) {
|
||||||
|
acc.push(resolved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (definitions.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (definitions.length > 1 || foundDefinition) {
|
||||||
|
// If a file exports multiple components, ... complain!
|
||||||
|
throw new Error(ERROR_MULTIPLE_DEFINITIONS);
|
||||||
|
}
|
||||||
|
foundDefinition = resolveDefinition(definitions[0]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
visit(ast, {
|
||||||
|
visitFunctionDeclaration: ignore,
|
||||||
|
visitFunctionExpression: ignore,
|
||||||
|
visitClassDeclaration: ignore,
|
||||||
|
visitClassExpression: ignore,
|
||||||
|
visitIfStatement: ignore,
|
||||||
|
visitWithStatement: ignore,
|
||||||
|
visitSwitchStatement: ignore,
|
||||||
|
visitWhileStatement: ignore,
|
||||||
|
visitDoWhileStatement: ignore,
|
||||||
|
visitForStatement: ignore,
|
||||||
|
visitForInStatement: ignore,
|
||||||
|
visitForOfStatement: ignore,
|
||||||
|
visitImportDeclaration: ignore,
|
||||||
|
|
||||||
|
visitExportNamedDeclaration: exportDeclaration,
|
||||||
|
visitExportDefaultDeclaration: exportDeclaration,
|
||||||
|
|
||||||
|
visitAssignmentExpression(path: any) {
|
||||||
|
// Ignore anything that is not `exports.X = ...;` or
|
||||||
|
// `module.exports = ...;`
|
||||||
|
if (!isExportsOrModuleAssignment(path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Resolve the value of the right hand side. It should resolve to a call
|
||||||
|
// expression, something like React.createClass
|
||||||
|
path = resolveToValue(path.get('right'));
|
||||||
|
if (!isComponentDefinition(path)) {
|
||||||
|
// path = resolveToValue(resolveHOC(path));
|
||||||
|
// if (!isComponentDefinition(path)) {
|
||||||
|
path = resolveToValue(resolveIIFE(path));
|
||||||
|
if (!isComponentDefinition(path)) {
|
||||||
|
path = resolveTranspiledClass(path);
|
||||||
|
if (!isComponentDefinition(path)) {
|
||||||
|
path = resolveToValue(resolveHOC(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foundDefinition) {
|
||||||
|
// If a file exports multiple components, ... complain!
|
||||||
|
throw new Error(ERROR_MULTIPLE_DEFINITIONS);
|
||||||
|
}
|
||||||
|
foundDefinition = resolveDefinition(path);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return foundDefinition;
|
||||||
|
}
|
||||||
50
packages/material-parser/src/parser/resolver/resolveHOC.ts
Normal file
50
packages/material-parser/src/parser/resolver/resolveHOC.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { namedTypes as t, visit } from 'ast-types';
|
||||||
|
const {
|
||||||
|
isReactCreateClassCall,
|
||||||
|
isReactForwardRefCall,
|
||||||
|
resolveToValue,
|
||||||
|
} = require('react-docgen').utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the path is a call expression, it recursively resolves to the
|
||||||
|
* rightmost argument, stopping if it finds a React.createClass call expression
|
||||||
|
*
|
||||||
|
* Else the path itself is returned.
|
||||||
|
*/
|
||||||
|
export default function resolveHOC(path: any): any {
|
||||||
|
const node = path.node;
|
||||||
|
if (
|
||||||
|
t.CallExpression.check(node) &&
|
||||||
|
!isReactCreateClassCall(path) &&
|
||||||
|
!isReactForwardRefCall(path)
|
||||||
|
) {
|
||||||
|
if (node.arguments.length) {
|
||||||
|
const inner = path.get('arguments', 0);
|
||||||
|
|
||||||
|
// If the first argument is one of these types then the component might be the last argument
|
||||||
|
// If there are all identifiers then we cannot figure out exactly and have to assume it is the first
|
||||||
|
if (
|
||||||
|
node.arguments.length > 1 &&
|
||||||
|
(t.Literal.check(inner.node) ||
|
||||||
|
t.ObjectExpression.check(inner.node) ||
|
||||||
|
t.ArrayExpression.check(inner.node) ||
|
||||||
|
t.SpreadElement.check(inner.node))
|
||||||
|
) {
|
||||||
|
return resolveHOC(
|
||||||
|
resolveToValue(path.get('arguments', node.arguments.length - 1)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolveHOC(resolveToValue(inner));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
33
packages/material-parser/src/parser/resolver/resolveIIFE.ts
Normal file
33
packages/material-parser/src/parser/resolver/resolveIIFE.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// const { namedTypes: t, visit } = require("ast-types");
|
||||||
|
const resolveFunctionDefinitionToReturnValue = require('react-docgen/dist/utils/resolveFunctionDefinitionToReturnValue')
|
||||||
|
.default;
|
||||||
|
// isReactCreateClassCall,
|
||||||
|
// isReactForwardRefCall,
|
||||||
|
// resolveToValue,
|
||||||
|
// resolveHOC
|
||||||
|
|
||||||
|
const checkIsIIFE = require('./checkIsIIFE');
|
||||||
|
/**
|
||||||
|
* If the path is a call expression, it recursively resolves to the
|
||||||
|
* rightmost argument, stopping if it finds a React.createClass call expression
|
||||||
|
*
|
||||||
|
* Else the path itself is returned.
|
||||||
|
*/
|
||||||
|
export default function resolveIIFE(path: any) {
|
||||||
|
if (!checkIsIIFE(path)) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
const returnValue = resolveFunctionDefinitionToReturnValue(
|
||||||
|
path.get('callee'),
|
||||||
|
);
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { builders, namedTypes as t, NodePath, visit } from 'ast-types';
|
||||||
|
/**
|
||||||
|
* If the path is a call expression, it recursively resolves to the
|
||||||
|
* rightmost argument, stopping if it finds a React.createClass call expression
|
||||||
|
*
|
||||||
|
* Else the path itself is returned.
|
||||||
|
*/
|
||||||
|
export default function resolveTranspiledClass(path: any) {
|
||||||
|
let classPath = path;
|
||||||
|
visit(path, {
|
||||||
|
visitFunctionDeclaration(arg) {
|
||||||
|
classPath = new NodePath(
|
||||||
|
builders.functionDeclaration(
|
||||||
|
arg.node.id,
|
||||||
|
[],
|
||||||
|
builders.blockStatement([
|
||||||
|
builders.returnStatement(
|
||||||
|
builders.jsxElement(
|
||||||
|
builders.jsxOpeningElement(
|
||||||
|
builders.jsxIdentifier('div'),
|
||||||
|
[],
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
path.parent,
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return classPath;
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { PropsSection } from '../otter-core';
|
||||||
/**
|
/**
|
||||||
* 对应解析器分析出的一些关键信息
|
* 对应解析器分析出的一些关键信息
|
||||||
*/
|
*/
|
||||||
@ -13,6 +14,7 @@ export type IPropTypes = IPropType[];
|
|||||||
export interface IMaterialParsedModel {
|
export interface IMaterialParsedModel {
|
||||||
filePath: string;
|
filePath: string;
|
||||||
defaultExportName: string;
|
defaultExportName: string;
|
||||||
|
props?: PropsSection['props'];
|
||||||
componentNames: Array<{
|
componentNames: Array<{
|
||||||
exportedName: string;
|
exportedName: string;
|
||||||
localName: string;
|
localName: string;
|
||||||
|
|||||||
@ -22,19 +22,19 @@ test('materialize single exported component by local', async t => {
|
|||||||
t.snapshot(actual);
|
t.snapshot(actual);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('materialize multiple exported component by local', async t => {
|
// test('materialize multiple exported component by local', async t => {
|
||||||
const options: IMaterializeOptions = {
|
// const options: IMaterializeOptions = {
|
||||||
cwd: multiExportedComptPath,
|
// cwd: multiExportedComptPath,
|
||||||
entry: multiExportedComptPath,
|
// entry: multiExportedComptPath,
|
||||||
accesser: 'local',
|
// accesser: 'local',
|
||||||
isExportedAsMultiple: true,
|
// isExportedAsMultiple: true,
|
||||||
};
|
// };
|
||||||
|
|
||||||
const instance = new Materialize(options);
|
// const instance = new Materialize(options);
|
||||||
const actual = await instance.start();
|
// const actual = await instance.start();
|
||||||
|
|
||||||
t.snapshot(actual);
|
// t.snapshot(actual);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// test('materialize single exported component by online', async t => {
|
// test('materialize single exported component by online', async t => {
|
||||||
// const options: IMaterializeOptions = {
|
// const options: IMaterializeOptions = {
|
||||||
|
|||||||
@ -17,13 +17,13 @@ test.serial('access single exported component by local', async t => {
|
|||||||
t.snapshot(actual);
|
t.snapshot(actual);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('access multiple exported component by local', async t => {
|
// test.serial('access multiple exported component by local', async t => {
|
||||||
const options: IMaterializeOptions = {
|
// const options: IMaterializeOptions = {
|
||||||
entry: multiExportedComptPath,
|
// entry: multiExportedComptPath,
|
||||||
accesser: 'local',
|
// accesser: 'local',
|
||||||
isExportedAsMultiple: true,
|
// isExportedAsMultiple: true,
|
||||||
};
|
// };
|
||||||
const accesser = new LocalAccesser(options);
|
// const accesser = new LocalAccesser(options);
|
||||||
const actual = await accesser.access();
|
// const actual = await accesser.access();
|
||||||
t.snapshot(actual);
|
// t.snapshot(actual);
|
||||||
});
|
// });
|
||||||
|
|||||||
@ -4,521 +4,8 @@ The actual snapshot is saved in `Materialize.ts.snap`.
|
|||||||
|
|
||||||
Generated by [AVA](https://avajs.dev).
|
Generated by [AVA](https://avajs.dev).
|
||||||
|
|
||||||
## materialize multiple exported component by local
|
|
||||||
|
|
||||||
> Snapshot 1
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeBlank',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeBlank',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleFlexLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'id',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeIcon',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeIcon',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'className',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'iconClassName',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeImage',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeImage',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeLink',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeLink',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakePlaceholder',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakePlaceholder',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeText',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeText',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
'string',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'type',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'Root',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'Root',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: 'multiple-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'element',
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'element',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
## materialize single exported component by local
|
## materialize single exported component by local
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
[
|
[]
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'Demo',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'Demo',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
|
||||||
package: 'single-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'optionalArray',
|
|
||||||
propType: 'array',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalBool',
|
|
||||||
propType: 'bool',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNumber',
|
|
||||||
propType: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObject',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalString',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalSymbol',
|
|
||||||
propType: 'symbol',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNode',
|
|
||||||
propType: 'node',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElement',
|
|
||||||
propType: 'element',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElementType',
|
|
||||||
propType: 'elementType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalMessage',
|
|
||||||
propType: {
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalEnum',
|
|
||||||
propType: {
|
|
||||||
type: 'oneOf',
|
|
||||||
value: [
|
|
||||||
'News',
|
|
||||||
'Photos',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalUnion',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'string',
|
|
||||||
'number',
|
|
||||||
{
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalArrayOf',
|
|
||||||
propType: {
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectOf',
|
|
||||||
propType: {
|
|
||||||
type: 'objectOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape2',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithStrictShape',
|
|
||||||
propType: {
|
|
||||||
type: 'exact',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredAny',
|
|
||||||
propType: 'any',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|||||||
Binary file not shown.
@ -4,521 +4,8 @@ The actual snapshot is saved in `LocalAccesser.ts.snap`.
|
|||||||
|
|
||||||
Generated by [AVA](https://avajs.dev).
|
Generated by [AVA](https://avajs.dev).
|
||||||
|
|
||||||
## access multiple exported component by local
|
|
||||||
|
|
||||||
> Snapshot 1
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeBlank',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeBlank',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleFlexLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'id',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeIcon',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeIcon',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'className',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'iconClassName',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeImage',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeImage',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeLink',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeLink',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakePlaceholder',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakePlaceholder',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'AIMakeText',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'AIMakeText',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
'string',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'type',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'Root',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'Root',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'element',
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'element',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
## access single exported component by local
|
## access single exported component by local
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
[
|
[]
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'Demo',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'Demo',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
|
||||||
package: '@ali/lowcode-engine-material-parser',
|
|
||||||
subName: '',
|
|
||||||
version: '0.1.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'optionalArray',
|
|
||||||
propType: 'array',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalBool',
|
|
||||||
propType: 'bool',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNumber',
|
|
||||||
propType: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObject',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalString',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalSymbol',
|
|
||||||
propType: 'symbol',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNode',
|
|
||||||
propType: 'node',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElement',
|
|
||||||
propType: 'element',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElementType',
|
|
||||||
propType: 'elementType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalMessage',
|
|
||||||
propType: {
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalEnum',
|
|
||||||
propType: {
|
|
||||||
type: 'oneOf',
|
|
||||||
value: [
|
|
||||||
'News',
|
|
||||||
'Photos',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalUnion',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'string',
|
|
||||||
'number',
|
|
||||||
{
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalArrayOf',
|
|
||||||
propType: {
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectOf',
|
|
||||||
propType: {
|
|
||||||
type: 'objectOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape2',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithStrictShape',
|
|
||||||
propType: {
|
|
||||||
type: 'exact',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredAny',
|
|
||||||
propType: 'any',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|||||||
Binary file not shown.
@ -8,175 +8,4 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
[
|
[]
|
||||||
{
|
|
||||||
manifestFilePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json',
|
|
||||||
manifestJS: undefined,
|
|
||||||
manifestObj: {
|
|
||||||
componentName: 'Demo',
|
|
||||||
docUrl: '',
|
|
||||||
npm: {
|
|
||||||
destructuring: false,
|
|
||||||
exportName: 'Demo',
|
|
||||||
main: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
|
||||||
package: 'single-exported-component',
|
|
||||||
subName: '',
|
|
||||||
version: '1.0.0',
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
{
|
|
||||||
name: 'optionalArray',
|
|
||||||
propType: 'array',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalBool',
|
|
||||||
propType: 'bool',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNumber',
|
|
||||||
propType: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObject',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalString',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalSymbol',
|
|
||||||
propType: 'symbol',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalNode',
|
|
||||||
propType: 'node',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElement',
|
|
||||||
propType: 'element',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalElementType',
|
|
||||||
propType: 'elementType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalMessage',
|
|
||||||
propType: {
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalEnum',
|
|
||||||
propType: {
|
|
||||||
type: 'oneOf',
|
|
||||||
value: [
|
|
||||||
'News',
|
|
||||||
'Photos',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalUnion',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'string',
|
|
||||||
'number',
|
|
||||||
{
|
|
||||||
type: 'instanceOf',
|
|
||||||
value: 'Demo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalArrayOf',
|
|
||||||
propType: {
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectOf',
|
|
||||||
propType: {
|
|
||||||
type: 'objectOf',
|
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithShape2',
|
|
||||||
propType: {
|
|
||||||
type: 'shape',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'optionalObjectWithStrictShape',
|
|
||||||
propType: {
|
|
||||||
type: 'exact',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
name: 'optionalProperty',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredProperty',
|
|
||||||
propType: {
|
|
||||||
isRequired: true,
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredFunc',
|
|
||||||
propType: 'func',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'requiredAny',
|
|
||||||
propType: 'any',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
screenshot: '',
|
|
||||||
title: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|||||||
Binary file not shown.
@ -4,907 +4,14 @@ The actual snapshot is saved in `ReactParser.ts.snap`.
|
|||||||
|
|
||||||
Generated by [AVA](https://avajs.dev).
|
Generated by [AVA](https://avajs.dev).
|
||||||
|
|
||||||
## parse es6 multiple exported component by local
|
|
||||||
|
|
||||||
> Snapshot 1
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
componentNames: [],
|
|
||||||
defaultExportName: '',
|
|
||||||
exportModules: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeBlank',
|
|
||||||
localName: 'AIMakeBlank',
|
|
||||||
source: './basic/AIMakeBlank',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeIcon',
|
|
||||||
localName: 'AIMakeIcon',
|
|
||||||
source: './basic/AIMakeIcon',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeImage',
|
|
||||||
localName: 'AIMakeImage',
|
|
||||||
source: './basic/AIMakeImage',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeLink',
|
|
||||||
localName: 'AIMakeLink',
|
|
||||||
source: './basic/AIMakeLink',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakePlaceholder',
|
|
||||||
localName: 'AIMakePlaceholder',
|
|
||||||
source: './basic/AIMakePlaceholder',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeText',
|
|
||||||
localName: 'AIMakeText',
|
|
||||||
source: './basic/AIMakeText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
exportedName: 'Root',
|
|
||||||
localName: 'Root',
|
|
||||||
source: './basic/Root',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakeBlank',
|
|
||||||
localName: 'AIMakeBlank',
|
|
||||||
source: './basic/AIMakeBlank',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakeIcon',
|
|
||||||
localName: 'AIMakeIcon',
|
|
||||||
source: './basic/AIMakeIcon',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakeImage',
|
|
||||||
localName: 'AIMakeImage',
|
|
||||||
source: './basic/AIMakeImage',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakeLink',
|
|
||||||
localName: 'AIMakeLink',
|
|
||||||
source: './basic/AIMakeLink',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakePlaceholder',
|
|
||||||
localName: 'AIMakePlaceholder',
|
|
||||||
source: './basic/AIMakePlaceholder',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'AIMakeText',
|
|
||||||
localName: 'AIMakeText',
|
|
||||||
source: './basic/AIMakeText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'Root',
|
|
||||||
localName: 'Root',
|
|
||||||
source: './basic/Root',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeBlank',
|
|
||||||
localName: 'AIMakeBlank',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakeBlank',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_extends',
|
|
||||||
localName: '_extends',
|
|
||||||
source: '@babel/runtime/helpers/extends',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBoxModelProps',
|
|
||||||
localName: 'HOCBoxModelProps',
|
|
||||||
source: '../utils/HOCBoxModelProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCLayoutProps',
|
|
||||||
localName: 'HOCLayoutProps',
|
|
||||||
source: '../utils/HOCLayoutProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBackgroundProps',
|
|
||||||
localName: 'HOCBackgroundProps',
|
|
||||||
source: '../utils/HOCBackgroundProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCFlexLayoutProps',
|
|
||||||
localName: 'HOCFlexLayoutProps',
|
|
||||||
source: '../utils/HOCFlexLayoutProps',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleFlexLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'id',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeIcon',
|
|
||||||
localName: 'AIMakeIcon',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakeIcon',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_extends',
|
|
||||||
localName: '_extends',
|
|
||||||
source: '@babel/runtime/helpers/extends',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_objectWithoutProperties',
|
|
||||||
localName: '_objectWithoutProperties',
|
|
||||||
source: '@babel/runtime/helpers/objectWithoutProperties',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'classNames',
|
|
||||||
localName: 'classNames',
|
|
||||||
source: 'classnames',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'createFromIconfont',
|
|
||||||
localName: 'createFromIconfont',
|
|
||||||
source: './IconFont',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'className',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'iconClassName',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [
|
|
||||||
{
|
|
||||||
isValueAnonymousFunc: false,
|
|
||||||
objectName: [
|
|
||||||
'AIMakeIcon',
|
|
||||||
],
|
|
||||||
propertyName: 'createFromIconfont',
|
|
||||||
value: 'createFromIconfont',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeImage',
|
|
||||||
localName: 'AIMakeImage',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakeImage',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_extends',
|
|
||||||
localName: '_extends',
|
|
||||||
source: '@babel/runtime/helpers/extends',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_objectWithoutProperties',
|
|
||||||
localName: '_objectWithoutProperties',
|
|
||||||
source: '@babel/runtime/helpers/objectWithoutProperties',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBoxModelProps',
|
|
||||||
localName: 'HOCBoxModelProps',
|
|
||||||
source: '../utils/HOCBoxModelProps',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeLink',
|
|
||||||
localName: 'AIMakeLink',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakeLink',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_extends',
|
|
||||||
localName: '_extends',
|
|
||||||
source: '@babel/runtime/helpers/extends',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_objectWithoutProperties',
|
|
||||||
localName: '_objectWithoutProperties',
|
|
||||||
source: '@babel/runtime/helpers/objectWithoutProperties',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBoxModelProps',
|
|
||||||
localName: 'HOCBoxModelProps',
|
|
||||||
source: '../utils/HOCBoxModelProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCTextProps',
|
|
||||||
localName: 'HOCTextProps',
|
|
||||||
source: '../utils/HOCTextProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCLayoutProps',
|
|
||||||
localName: 'HOCLayoutProps',
|
|
||||||
source: '../utils/HOCLayoutProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBackgroundProps',
|
|
||||||
localName: 'HOCBackgroundProps',
|
|
||||||
source: '../utils/HOCBackgroundProps',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakePlaceholder',
|
|
||||||
localName: 'AIMakePlaceholder',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakePlaceholder',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBoxModelProps',
|
|
||||||
localName: 'HOCBoxModelProps',
|
|
||||||
source: '../utils/HOCBoxModelProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCLayoutProps',
|
|
||||||
localName: 'HOCLayoutProps',
|
|
||||||
source: '../utils/HOCLayoutProps',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'AIMakeText',
|
|
||||||
localName: 'AIMakeText',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'AIMakeText',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_assertThisInitialized',
|
|
||||||
localName: '_assertThisInitialized',
|
|
||||||
source: '@babel/runtime/helpers/assertThisInitialized',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importName: 'Component',
|
|
||||||
localName: 'Component',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBoxModelProps',
|
|
||||||
localName: 'HOCBoxModelProps',
|
|
||||||
source: '../utils/HOCBoxModelProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCTextProps',
|
|
||||||
localName: 'HOCTextProps',
|
|
||||||
source: '../utils/HOCTextProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCLayoutProps',
|
|
||||||
localName: 'HOCLayoutProps',
|
|
||||||
source: '../utils/HOCLayoutProps',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'HOCBackgroundProps',
|
|
||||||
localName: 'HOCBackgroundProps',
|
|
||||||
source: '../utils/HOCBackgroundProps',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'node',
|
|
||||||
},
|
|
||||||
'node',
|
|
||||||
'string',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'type',
|
|
||||||
propType: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBoxModel',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleText',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleLayout',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'styleBackground',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'Root',
|
|
||||||
localName: 'Root',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'Root',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/index.js',
|
|
||||||
importModules: [
|
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_defineProperty',
|
|
||||||
localName: '_defineProperty',
|
|
||||||
source: '@babel/runtime/helpers/defineProperty',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
|
||||||
name: 'style',
|
|
||||||
propType: 'object',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'children',
|
|
||||||
propType: {
|
|
||||||
type: 'union',
|
|
||||||
value: [
|
|
||||||
'element',
|
|
||||||
{
|
|
||||||
type: 'arrayOf',
|
|
||||||
value: 'element',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subModules: [],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
## parse es6 single exported component by local
|
## parse es6 single exported component by local
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
componentNames: [
|
|
||||||
{
|
|
||||||
exportedName: 'Demo',
|
|
||||||
localName: 'Demo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
defaultExportName: 'Demo',
|
|
||||||
exportModules: [],
|
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
||||||
importModules: [
|
props: [
|
||||||
{
|
|
||||||
importDefaultName: '_classCallCheck',
|
|
||||||
localName: '_classCallCheck',
|
|
||||||
source: '@babel/runtime/helpers/classCallCheck',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_createClass',
|
|
||||||
localName: '_createClass',
|
|
||||||
source: '@babel/runtime/helpers/createClass',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_possibleConstructorReturn',
|
|
||||||
localName: '_possibleConstructorReturn',
|
|
||||||
source: '@babel/runtime/helpers/possibleConstructorReturn',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_getPrototypeOf',
|
|
||||||
localName: '_getPrototypeOf',
|
|
||||||
source: '@babel/runtime/helpers/getPrototypeOf',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: '_inherits',
|
|
||||||
localName: '_inherits',
|
|
||||||
source: '@babel/runtime/helpers/inherits',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'React',
|
|
||||||
localName: 'React',
|
|
||||||
source: 'react',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
importDefaultName: 'PropTypes',
|
|
||||||
localName: 'PropTypes',
|
|
||||||
source: 'prop-types',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
propsDefaults: [],
|
|
||||||
propsTypes: [
|
|
||||||
{
|
{
|
||||||
name: 'optionalArray',
|
name: 'optionalArray',
|
||||||
propType: 'array',
|
propType: 'array',
|
||||||
@ -918,6 +25,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
propType: 'func',
|
propType: 'func',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
defaultValue: '123',
|
||||||
name: 'optionalNumber',
|
name: 'optionalNumber',
|
||||||
propType: 'number',
|
propType: 'number',
|
||||||
},
|
},
|
||||||
@ -1012,6 +120,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
{
|
{
|
||||||
name: 'optionalObjectWithShape2',
|
name: 'optionalObjectWithShape2',
|
||||||
propType: {
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
type: 'shape',
|
type: 'shape',
|
||||||
value: [
|
value: [
|
||||||
{
|
{
|
||||||
@ -1049,13 +158,18 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'requiredFunc',
|
name: 'requiredFunc',
|
||||||
propType: 'func',
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'func',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'requiredAny',
|
name: 'requiredAny',
|
||||||
propType: 'any',
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'any',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
subModules: [],
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
Binary file not shown.
@ -622,7 +622,9 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
// A value of any data type␊
|
// A value of any data type␊
|
||||||
requiredAny: PropTypes.any.isRequired␊
|
requiredAny: PropTypes.any.isRequired␊
|
||||||
};␊
|
};␊
|
||||||
Demo.defaultProps = {};␊
|
Demo.defaultProps = {␊
|
||||||
|
optionalNumber: 123␊
|
||||||
|
};␊
|
||||||
export default Demo;`,
|
export default Demo;`,
|
||||||
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js',
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
@ -79,5 +79,7 @@ Demo.propTypes = {
|
|||||||
// A value of any data type
|
// A value of any data type
|
||||||
requiredAny: PropTypes.any.isRequired
|
requiredAny: PropTypes.any.isRequired
|
||||||
};
|
};
|
||||||
Demo.defaultProps = {};
|
Demo.defaultProps = {
|
||||||
|
optionalNumber: 123
|
||||||
|
};
|
||||||
export default Demo;
|
export default Demo;
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"Demo","title":"","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"Demo","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"optionalArray","propType":"array"},{"name":"optionalBool","propType":"bool"},{"name":"optionalFunc","propType":"func"},{"name":"optionalNumber","propType":"number"},{"name":"optionalObject","propType":"object"},{"name":"optionalString","propType":"string"},{"name":"optionalSymbol","propType":"symbol"},{"name":"optionalNode","propType":"node"},{"name":"optionalElement","propType":"element"},{"name":"optionalElementType","propType":"elementType"},{"name":"optionalMessage","propType":{"type":"instanceOf","value":"Demo"}},{"name":"optionalEnum","propType":{"type":"oneOf","value":["News","Photos"]}},{"name":"optionalUnion","propType":{"type":"union","value":["string","number",{"type":"instanceOf","value":"Demo"}]}},{"name":"optionalArrayOf","propType":{"type":"arrayOf","value":"number"}},{"name":"optionalObjectOf","propType":{"type":"objectOf","value":"number"}},{"name":"optionalObjectWithShape","propType":{"type":"shape","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithShape2","propType":{"type":"shape","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithStrictShape","propType":{"type":"exact","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"requiredFunc","propType":"func"},{"name":"requiredAny","propType":"any"}]}
|
{"componentName":"Demo","title":"single-exported-component","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"Demo","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"optionalArray","propType":"array"},{"name":"optionalBool","propType":"bool"},{"name":"optionalFunc","propType":"func"},{"name":"optionalNumber","propType":"number"},{"name":"optionalObject","propType":"object"},{"name":"optionalString","propType":"string"},{"name":"optionalSymbol","propType":"symbol"},{"name":"optionalNode","propType":"node"},{"name":"optionalElement","propType":"element"},{"name":"optionalElementType","propType":"elementType"},{"name":"optionalMessage","propType":{"type":"instanceOf","value":"Demo"}},{"name":"optionalEnum","propType":{"type":"oneOf","value":["News","Photos"]}},{"name":"optionalUnion","propType":{"type":"union","value":["string","number",{"type":"instanceOf","value":"Demo"}]}},{"name":"optionalArrayOf","propType":{"type":"arrayOf","value":"number"}},{"name":"optionalObjectOf","propType":{"type":"objectOf","value":"number"}},{"name":"optionalObjectWithShape","propType":{"type":"shape","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithShape2","propType":{"type":"shape","isRequired":true,"value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithStrictShape","propType":{"type":"exact","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"requiredFunc","propType":{"type":"func","isRequired":true}},{"name":"requiredAny","propType":{"type":"any","isRequired":true}}]}
|
||||||
@ -2,29 +2,29 @@
|
|||||||
"name": "single-exported-component",
|
"name": "single-exported-component",
|
||||||
"description": "",
|
"description": "",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "lib/index.js",
|
"main": "src/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"demo/",
|
"demo/",
|
||||||
"lib/",
|
"lib/",
|
||||||
"es/",
|
"es/",
|
||||||
"build/"
|
"build/"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postversion": "node ./scripts/postversion.js"
|
"postversion": "node ./scripts/postversion.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^16.8.5",
|
"react": "^16.8.5",
|
||||||
"react-dom": "^16.8.5"
|
"react-dom": "^16.8.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-spawn": "^6.0.5"
|
"cross-spawn": "^6.0.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.6"
|
"react": "^16.8.6"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npm.alibaba-inc.com"
|
"registry": "https://registry.npm.alibaba-inc.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,18 +30,18 @@ async function generate(
|
|||||||
return actual;
|
return actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
test.serial('generate multiple exported components', async t => {
|
// test.serial('generate multiple exported components', async t => {
|
||||||
const options: IMaterializeOptions = {
|
// const options: IMaterializeOptions = {
|
||||||
cwd: multiExportedComptPath,
|
// cwd: multiExportedComptPath,
|
||||||
entry: multiExportedComptPath,
|
// entry: multiExportedComptPath,
|
||||||
accesser: 'local',
|
// accesser: 'local',
|
||||||
isExportedAsMultiple: true,
|
// isExportedAsMultiple: true,
|
||||||
};
|
// };
|
||||||
|
|
||||||
const actual = await generate(options);
|
// const actual = await generate(options);
|
||||||
|
|
||||||
t.snapshot(actual);
|
// t.snapshot(actual);
|
||||||
});
|
// });
|
||||||
|
|
||||||
test.only('generate single exported components', async t => {
|
test.only('generate single exported components', async t => {
|
||||||
const options: IMaterializeOptions = {
|
const options: IMaterializeOptions = {
|
||||||
|
|||||||
@ -7,21 +7,21 @@ import { getFromFixtures } from '../helpers';
|
|||||||
const multiExportedComptPath = getFromFixtures('multiple-exported-component');
|
const multiExportedComptPath = getFromFixtures('multiple-exported-component');
|
||||||
const singleExportedComptPath = getFromFixtures('single-exported-component');
|
const singleExportedComptPath = getFromFixtures('single-exported-component');
|
||||||
|
|
||||||
test.serial('parse es6 multiple exported component by local', async t => {
|
// test.serial('parse es6 multiple exported component by local', async t => {
|
||||||
const options: IMaterializeOptions = {
|
// const options: IMaterializeOptions = {
|
||||||
cwd: multiExportedComptPath,
|
// cwd: multiExportedComptPath,
|
||||||
entry: multiExportedComptPath,
|
// entry: multiExportedComptPath,
|
||||||
accesser: 'local',
|
// accesser: 'local',
|
||||||
isExportedAsMultiple: true,
|
// isExportedAsMultiple: true,
|
||||||
};
|
// };
|
||||||
|
|
||||||
const scanner = new Scanner(options);
|
// const scanner = new Scanner(options);
|
||||||
const scanModel = await scanner.scan();
|
// const scanModel = await scanner.scan();
|
||||||
const parser = new ReactParser(options);
|
// const parser = new ReactParser(options);
|
||||||
const actual: IMaterialParsedModel[] = await parser.parse(scanModel);
|
// const actual: IMaterialParsedModel[] = await parser.parse(scanModel);
|
||||||
|
|
||||||
t.snapshot(actual);
|
// t.snapshot(actual);
|
||||||
});
|
// });
|
||||||
|
|
||||||
test.serial('parse es6 single exported component by local', async t => {
|
test.serial('parse es6 single exported component by local', async t => {
|
||||||
const options: IMaterializeOptions = {
|
const options: IMaterializeOptions = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user