mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-16 06:42:53 +00:00
feat: support multiple exported components
This commit is contained in:
parent
3f975232c7
commit
db1b6deaca
@ -26,6 +26,8 @@
|
|||||||
"prettier": "^1.15.3",
|
"prettier": "^1.15.3",
|
||||||
"rimraf": "^2.6.3",
|
"rimraf": "^2.6.3",
|
||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
|
"tslint": "^6.1.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0",
|
||||||
"typescript": "^3.2.2"
|
"typescript": "^3.2.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@ -93,7 +93,6 @@ class Generator implements IGenerator {
|
|||||||
matParsedModel: IMaterialParsedModel,
|
matParsedModel: IMaterialParsedModel,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
manifestFilePath: string; // manifest 文件路径
|
manifestFilePath: string; // manifest 文件路径
|
||||||
manifestJS: string; // manifest 文件内容
|
|
||||||
manifestObj: IComponentMaterial; // manifest 文件对象
|
manifestObj: IComponentMaterial; // manifest 文件对象
|
||||||
}> {
|
}> {
|
||||||
const manifestObj: Partial<IComponentMaterial> = {
|
const manifestObj: Partial<IComponentMaterial> = {
|
||||||
@ -127,7 +126,6 @@ class Generator implements IGenerator {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
manifestJS: manifest.manifestJS,
|
|
||||||
manifestObj: manifest.manifestObj,
|
manifestObj: manifest.manifestObj,
|
||||||
manifestFilePath: manifest.manifestFilePath,
|
manifestFilePath: manifest.manifestFilePath,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
} from '../types';
|
} from '../types';
|
||||||
import BaseParser from './BaseParser';
|
import BaseParser from './BaseParser';
|
||||||
import resolver from './resolver';
|
import resolver from './resolver';
|
||||||
|
import handlers from './handlers';
|
||||||
|
|
||||||
const log = debug.extend('mat');
|
const log = debug.extend('mat');
|
||||||
const parser = buildParser();
|
const parser = buildParser();
|
||||||
@ -75,7 +76,10 @@ function transformItem(name: string, item: any): any {
|
|||||||
result.description = description;
|
result.description = description;
|
||||||
}
|
}
|
||||||
if (defaultValue) {
|
if (defaultValue) {
|
||||||
result.defaultValue = defaultValue.value;
|
try {
|
||||||
|
const value = eval(defaultValue.value);
|
||||||
|
result.defaultValue = value;
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -179,8 +183,12 @@ class ReactParser extends BaseParser {
|
|||||||
item => item.filePath === model.mainEntry,
|
item => item.filePath === model.mainEntry,
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = reactDocs.parse(mainEntryItem.fileContent, resolver);
|
const result = reactDocs.parse(
|
||||||
const props = Object.keys(result.props).map(name => {
|
mainEntryItem.fileContent,
|
||||||
|
resolver,
|
||||||
|
handlers,
|
||||||
|
);
|
||||||
|
const props = Object.keys(result.props || {}).map(name => {
|
||||||
return transformItem(name, result.props[name]);
|
return transformItem(name, result.props[name]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -529,20 +537,17 @@ class ReactParser extends BaseParser {
|
|||||||
fileContent: string;
|
fileContent: string;
|
||||||
}): Promise<IMaterialParsedModel> {
|
}): Promise<IMaterialParsedModel> {
|
||||||
const ast = parser.parse(params.fileContent);
|
const ast = parser.parse(params.fileContent);
|
||||||
const result = reactDocs.parse(params.fileContent, resolver);
|
const result = reactDocs.parse(params.fileContent, resolver, handlers);
|
||||||
// @ts-ignore
|
const props = Object.keys(result.props || {}).map(name => {
|
||||||
// ast.__src = params.fileContent;
|
|
||||||
const props = Object.keys(result.props).map(name => {
|
|
||||||
return transformItem(name, result.props[name]);
|
return transformItem(name, result.props[name]);
|
||||||
});
|
});
|
||||||
// const defaultExportName = await this.parseDefaultExportNameES6(ast);
|
const defaultExportName = await this.parseDefaultExportNameES6(ast);
|
||||||
// const subModules = await this.parseSubModulesES6(ast);
|
// const subModules = await this.parseSubModulesES6(ast);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filePath: params.filePath,
|
filePath: params.filePath,
|
||||||
// defaultExportName,
|
defaultExportName,
|
||||||
// subModules,
|
// subModules,
|
||||||
// propsTypes,
|
|
||||||
props,
|
props,
|
||||||
} as any;
|
} as any;
|
||||||
}
|
}
|
||||||
|
|||||||
22
packages/material-parser/src/parser/handlers/index.ts
Normal file
22
packages/material-parser/src/parser/handlers/index.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const { handlers } = require('react-docgen');
|
||||||
|
import {
|
||||||
|
propTypeHandler,
|
||||||
|
contextTypeHandler,
|
||||||
|
childContextTypeHandler,
|
||||||
|
} from './propTypeHandler';
|
||||||
|
|
||||||
|
const defaultHandlers = [
|
||||||
|
propTypeHandler,
|
||||||
|
contextTypeHandler,
|
||||||
|
childContextTypeHandler,
|
||||||
|
handlers.propTypeCompositionHandler,
|
||||||
|
handlers.propDocBlockHandler,
|
||||||
|
handlers.flowTypeHandler,
|
||||||
|
handlers.defaultPropsHandler,
|
||||||
|
handlers.componentDocblockHandler,
|
||||||
|
handlers.displayNameHandler,
|
||||||
|
handlers.componentMethodsHandler,
|
||||||
|
handlers.componentMethodsJsDocHandler,
|
||||||
|
];
|
||||||
|
|
||||||
|
export default defaultHandlers;
|
||||||
136
packages/material-parser/src/parser/handlers/propTypeHandler.ts
Normal file
136
packages/material-parser/src/parser/handlers/propTypeHandler.ts
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { namedTypes as t, visit } from 'ast-types';
|
||||||
|
import { throwStatement } from '@babel/types';
|
||||||
|
const {
|
||||||
|
resolveToValue,
|
||||||
|
getPropType,
|
||||||
|
getPropertyName,
|
||||||
|
getMemberValuePath,
|
||||||
|
isReactModuleName,
|
||||||
|
printValue,
|
||||||
|
resolveToModule,
|
||||||
|
} = require('react-docgen').utils;
|
||||||
|
|
||||||
|
const isRequiredPropType = require('react-docgen/dist/utils/isRequiredPropType')
|
||||||
|
.default;
|
||||||
|
|
||||||
|
function getRoot(node: any) {
|
||||||
|
let root = node.parent;
|
||||||
|
while (root.parent) {
|
||||||
|
root = root.parent;
|
||||||
|
}
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
// import type Documentation from '../Documentation';
|
||||||
|
|
||||||
|
function isPropTypesExpression(path: any) {
|
||||||
|
const moduleName = resolveToModule(path);
|
||||||
|
if (moduleName) {
|
||||||
|
return isReactModuleName(moduleName) || moduleName === 'ReactPropTypes';
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function amendPropTypes(getDescriptor: any, path: any) {
|
||||||
|
if (!t.ObjectExpression.check(path.node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
path.get('properties').each((propertyPath: any) => {
|
||||||
|
switch (propertyPath.node.type) {
|
||||||
|
// @ts-ignore
|
||||||
|
case t.Property.name: {
|
||||||
|
const propName = getPropertyName(propertyPath);
|
||||||
|
if (!propName) return;
|
||||||
|
|
||||||
|
const propDescriptor = getDescriptor(propName);
|
||||||
|
const valuePath = propertyPath.get('value');
|
||||||
|
const type = isPropTypesExpression(valuePath)
|
||||||
|
? getPropType(valuePath)
|
||||||
|
: { name: 'custom', raw: printValue(valuePath) };
|
||||||
|
|
||||||
|
if (type) {
|
||||||
|
propDescriptor.type = type;
|
||||||
|
propDescriptor.required =
|
||||||
|
type.name !== 'custom' && isRequiredPropType(valuePath);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// @ts-ignore
|
||||||
|
case t.SpreadElement.name: {
|
||||||
|
const resolvedValuePath = resolveToValue(propertyPath.get('argument'));
|
||||||
|
switch (resolvedValuePath.node.type) {
|
||||||
|
// @ts-ignore
|
||||||
|
case t.ObjectExpression.name: // normal object literal
|
||||||
|
amendPropTypes(getDescriptor, resolvedValuePath);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefinePropertyValuePath(nodePath: any, propName: string) {
|
||||||
|
const program = getRoot(nodePath);
|
||||||
|
const componentName = nodePath.node.id.name;
|
||||||
|
let resultPath = nodePath;
|
||||||
|
|
||||||
|
visit(program, {
|
||||||
|
visitCallExpression: function(path) {
|
||||||
|
const args = path.get('arguments');
|
||||||
|
const argsNodeList = args.value;
|
||||||
|
if (
|
||||||
|
argsNodeList.length === 3 &&
|
||||||
|
t.Identifier.check(argsNodeList[0]) &&
|
||||||
|
argsNodeList[0].name === componentName &&
|
||||||
|
t.Literal.check(argsNodeList[1]) &&
|
||||||
|
argsNodeList[1].value === propName
|
||||||
|
) {
|
||||||
|
resultPath = args.get(2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return resultPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPropTypeHandler(propName: string) {
|
||||||
|
return function(documentation: any, path: any) {
|
||||||
|
let propTypesPath = getMemberValuePath(path, propName);
|
||||||
|
if (!propTypesPath) {
|
||||||
|
propTypesPath = getDefinePropertyValuePath(path, propName);
|
||||||
|
if (!propTypesPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
propTypesPath = resolveToValue(propTypesPath);
|
||||||
|
if (!propTypesPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let getDescriptor;
|
||||||
|
switch (propName) {
|
||||||
|
case 'childContextTypes':
|
||||||
|
getDescriptor = documentation.getChildContextDescriptor;
|
||||||
|
break;
|
||||||
|
case 'contextTypes':
|
||||||
|
getDescriptor = documentation.getContextDescriptor;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
getDescriptor = documentation.getPropDescriptor;
|
||||||
|
}
|
||||||
|
amendPropTypes(getDescriptor.bind(documentation), propTypesPath);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const propTypeHandler = getPropTypeHandler('propTypes');
|
||||||
|
export const contextTypeHandler = getPropTypeHandler('contextTypes');
|
||||||
|
export const childContextTypeHandler = getPropTypeHandler('childContextTypes');
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module.exports = function checkIsIIFE(path: any) {
|
export default function checkIsIIFE(path: any) {
|
||||||
return (
|
return (
|
||||||
path.value.callee &&
|
path.value.callee &&
|
||||||
path.value.callee.type === 'FunctionExpression' &&
|
path.value.callee.type === 'FunctionExpression' &&
|
||||||
path.node.type === 'CallExpression'
|
path.node.type === 'CallExpression'
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ const {
|
|||||||
resolveExportDeclaration,
|
resolveExportDeclaration,
|
||||||
resolveToValue,
|
resolveToValue,
|
||||||
} = require('react-docgen').utils;
|
} = require('react-docgen').utils;
|
||||||
|
import checkIsIIFE from './checkIsIIFE';
|
||||||
import resolveHOC from './resolveHOC';
|
import resolveHOC from './resolveHOC';
|
||||||
import resolveIIFE from './resolveIIFE';
|
import resolveIIFE from './resolveIIFE';
|
||||||
import resolveTranspiledClass from './resolveTranspiledClass';
|
import resolveTranspiledClass from './resolveTranspiledClass';
|
||||||
@ -56,6 +57,29 @@ function resolveDefinition(definition: any) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefinition(definition: any) {
|
||||||
|
if (checkIsIIFE(definition)) {
|
||||||
|
definition = resolveToValue(resolveIIFE(definition));
|
||||||
|
if (!isComponentDefinition(definition)) {
|
||||||
|
definition = resolveTranspiledClass(definition);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
definition = resolveToValue(resolveHOC(definition));
|
||||||
|
if (checkIsIIFE(definition)) {
|
||||||
|
definition = resolveToValue(resolveIIFE(definition));
|
||||||
|
if (!isComponentDefinition(definition)) {
|
||||||
|
definition = resolveTranspiledClass(definition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// definition = resolveToValue(resolveIIFE(definition));
|
||||||
|
// if (!isComponentDefinition(definition)) {
|
||||||
|
// definition = resolveTranspiledClass(definition);
|
||||||
|
// }
|
||||||
|
// definition = resolveToValue(resolveHOC(definition));
|
||||||
|
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Given an AST, this function tries to find the exported component definition.
|
* Given an AST, this function tries to find the exported component definition.
|
||||||
*
|
*
|
||||||
@ -80,13 +104,9 @@ export default function findExportedComponentDefinition(ast: any) {
|
|||||||
if (isComponentDefinition(definition)) {
|
if (isComponentDefinition(definition)) {
|
||||||
acc.push(definition);
|
acc.push(definition);
|
||||||
} else {
|
} else {
|
||||||
// definition = resolveToValue(resolveIIFE(definition));
|
definition = getDefinition(definition);
|
||||||
// if (!isComponentDefinition(definition)) {
|
if (isComponentDefinition(definition)) {
|
||||||
// definition = resolveTranspiledClass(definition);
|
acc.push(definition);
|
||||||
// }
|
|
||||||
const resolved = resolveToValue(resolveHOC(definition));
|
|
||||||
if (isComponentDefinition(resolved)) {
|
|
||||||
acc.push(resolved);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
@ -133,15 +153,7 @@ export default function findExportedComponentDefinition(ast: any) {
|
|||||||
// expression, something like React.createClass
|
// expression, something like React.createClass
|
||||||
path = resolveToValue(path.get('right'));
|
path = resolveToValue(path.get('right'));
|
||||||
if (!isComponentDefinition(path)) {
|
if (!isComponentDefinition(path)) {
|
||||||
// path = resolveToValue(resolveHOC(path));
|
path = getDefinition(path);
|
||||||
// if (!isComponentDefinition(path)) {
|
|
||||||
path = resolveToValue(resolveIIFE(path));
|
|
||||||
if (!isComponentDefinition(path)) {
|
|
||||||
path = resolveTranspiledClass(path);
|
|
||||||
if (!isComponentDefinition(path)) {
|
|
||||||
path = resolveToValue(resolveHOC(path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (foundDefinition) {
|
if (foundDefinition) {
|
||||||
// If a file exports multiple components, ... complain!
|
// If a file exports multiple components, ... complain!
|
||||||
|
|||||||
@ -38,11 +38,13 @@ export default function resolveHOC(path: any): any {
|
|||||||
t.SpreadElement.check(inner.node))
|
t.SpreadElement.check(inner.node))
|
||||||
) {
|
) {
|
||||||
return resolveHOC(
|
return resolveHOC(
|
||||||
resolveToValue(path.get('arguments', node.arguments.length - 1)),
|
// resolveToValue(path.get('arguments', node.arguments.length - 1)),
|
||||||
|
path.get('arguments', node.arguments.length - 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolveHOC(resolveToValue(inner));
|
// return resolveHOC(resolveToValue(inner));
|
||||||
|
return resolveHOC(inner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ const resolveFunctionDefinitionToReturnValue = require('react-docgen/dist/utils/
|
|||||||
// resolveToValue,
|
// resolveToValue,
|
||||||
// resolveHOC
|
// resolveHOC
|
||||||
|
|
||||||
const checkIsIIFE = require('./checkIsIIFE');
|
import checkIsIIFE from './checkIsIIFE';
|
||||||
/**
|
/**
|
||||||
* If the path is a call expression, it recursively resolves to the
|
* If the path is a call expression, it recursively resolves to the
|
||||||
* rightmost argument, stopping if it finds a React.createClass call expression
|
* rightmost argument, stopping if it finds a React.createClass call expression
|
||||||
|
|||||||
@ -42,9 +42,9 @@ class Scanner implements IScanner {
|
|||||||
const isDepsMode = cwd !== entry;
|
const isDepsMode = cwd !== entry;
|
||||||
const pkgJsonPath = join(cwd, 'package.json');
|
const pkgJsonPath = join(cwd, 'package.json');
|
||||||
// 判断是否存在 package.json
|
// 判断是否存在 package.json
|
||||||
if (!(await pathExists(pkgJsonPath))) {
|
// if (!(await pathExists(pkgJsonPath))) {
|
||||||
throw new Error(`Cannot find package.json. ${pkgJsonPath}`);
|
// throw new Error(`Cannot find package.json. ${pkgJsonPath}`);
|
||||||
}
|
// }
|
||||||
// 读取 package.json
|
// 读取 package.json
|
||||||
let pkgJson = await this.resolvePkgJson(pkgJsonPath);
|
let pkgJson = await this.resolvePkgJson(pkgJsonPath);
|
||||||
model.pkgName = pkgJson.name;
|
model.pkgName = pkgJson.name;
|
||||||
@ -69,10 +69,10 @@ class Scanner implements IScanner {
|
|||||||
log('entryFile', entryFile);
|
log('entryFile', entryFile);
|
||||||
model.mainEntry = entryFilePath;
|
model.mainEntry = entryFilePath;
|
||||||
// 记录入口文件
|
// 记录入口文件
|
||||||
// model.modules.push({
|
model.modules.push({
|
||||||
// filePath: entryFilePath,
|
filePath: entryFilePath,
|
||||||
// fileContent: entryFile,
|
fileContent: entryFile,
|
||||||
// });
|
});
|
||||||
log('model', model);
|
log('model', model);
|
||||||
// debugger;
|
// debugger;
|
||||||
if (options.isExportedAsMultiple) {
|
if (options.isExportedAsMultiple) {
|
||||||
@ -82,7 +82,7 @@ class Scanner implements IScanner {
|
|||||||
entryFilePath,
|
entryFilePath,
|
||||||
sourceType: model.sourceType,
|
sourceType: model.sourceType,
|
||||||
});
|
});
|
||||||
model.modules.push(...modules);
|
model.modules = [...modules];
|
||||||
}
|
}
|
||||||
log('model', model);
|
log('model', model);
|
||||||
return model;
|
return model;
|
||||||
|
|||||||
@ -8,4 +8,181 @@ 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',
|
||||||
|
manifestObj: {
|
||||||
|
docUrl: '',
|
||||||
|
npm: {
|
||||||
|
destructuring: false,
|
||||||
|
exportName: '',
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultValue: 123,
|
||||||
|
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: 'oneOfType',
|
||||||
|
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: {
|
||||||
|
isRequired: true,
|
||||||
|
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: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'func',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'requiredAny',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'any',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
screenshot: '',
|
||||||
|
title: 'single-exported-component',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|||||||
Binary file not shown.
@ -8,4 +8,181 @@ 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',
|
||||||
|
manifestObj: {
|
||||||
|
docUrl: '',
|
||||||
|
npm: {
|
||||||
|
destructuring: false,
|
||||||
|
exportName: '',
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultValue: 123,
|
||||||
|
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: 'oneOfType',
|
||||||
|
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: {
|
||||||
|
isRequired: true,
|
||||||
|
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: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'func',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'requiredAny',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'any',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
screenshot: '',
|
||||||
|
title: '@ali/lowcode-engine-material-parser',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -4,12 +4,311 @@ 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
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakeBlank',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'node',
|
||||||
|
},
|
||||||
|
'node',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleLayout',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBackground',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleFlexLayout',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'id',
|
||||||
|
propType: 'string',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakeIcon',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
propType: 'string',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'iconClassName',
|
||||||
|
propType: 'string',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'node',
|
||||||
|
},
|
||||||
|
'node',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleText',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBackground',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakeImage',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakeLink',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'node',
|
||||||
|
},
|
||||||
|
'node',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleText',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleLayout',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBackground',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakePlaceholder',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'node',
|
||||||
|
},
|
||||||
|
'node',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleLayout',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'AIMakeText',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'node',
|
||||||
|
},
|
||||||
|
'node',
|
||||||
|
'string',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'type',
|
||||||
|
propType: 'string',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBoxModel',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleText',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleLayout',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'styleBackground',
|
||||||
|
propType: {
|
||||||
|
isRequired: true,
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultExportName: 'Root',
|
||||||
|
filePath: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/index.js',
|
||||||
|
props: [
|
||||||
|
{
|
||||||
|
name: 'style',
|
||||||
|
propType: 'object',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'children',
|
||||||
|
propType: {
|
||||||
|
type: 'oneOfType',
|
||||||
|
value: [
|
||||||
|
'element',
|
||||||
|
{
|
||||||
|
type: 'arrayOf',
|
||||||
|
value: 'element',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
## parse es6 single exported component by local
|
## parse es6 single exported component by local
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
defaultExportName: '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',
|
||||||
props: [
|
props: [
|
||||||
{
|
{
|
||||||
@ -25,7 +324,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
propType: 'func',
|
propType: 'func',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultValue: '123',
|
defaultValue: 123,
|
||||||
name: 'optionalNumber',
|
name: 'optionalNumber',
|
||||||
propType: 'number',
|
propType: 'number',
|
||||||
},
|
},
|
||||||
@ -73,7 +372,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
{
|
{
|
||||||
name: 'optionalUnion',
|
name: 'optionalUnion',
|
||||||
propType: {
|
propType: {
|
||||||
type: 'union',
|
type: 'oneOfType',
|
||||||
value: [
|
value: [
|
||||||
'string',
|
'string',
|
||||||
'number',
|
'number',
|
||||||
|
|||||||
Binary file not shown.
@ -11,18 +11,6 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
{
|
{
|
||||||
mainEntry: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
mainEntry: '/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js',
|
||||||
modules: [
|
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";␊
|
fileContent: `import _extends from "@babel/runtime/helpers/extends";␊
|
||||||
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";␊
|
||||||
|
|||||||
Binary file not shown.
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeBlank","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeBlank","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"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"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"styleFlexLayout","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"},{"name":"id","propType":"string"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeIcon","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeIcon","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"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"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"className","propType":"string"},{"name":"iconClassName","propType":"string"},{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeImage","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeImage","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":"object"},{"name":"style","propType":"object"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeLink","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeLink","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"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"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakePlaceholder","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakePlaceholder","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"style","propType":"object"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeText","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeText","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"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"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node","string"]}},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"Root","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"Root","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object"},{"name":"children","propType":{"type":"union","value":["element",{"type":"arrayOf","value":"element"}]}}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object"},{"name":"children","propType":{"type":"oneOfType","value":["element",{"type":"arrayOf","value":"element"}]}}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeBlank","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeBlank","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType"}},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"styleFlexLayout","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"},{"name":"id","propType":"string"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"styleFlexLayout","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"},{"name":"id","propType":"string"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeIcon","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeIcon","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"className","propType":"string"},{"name":"iconClassName","propType":"string"},{"name":"children","propType":{"type":"oneOfType"}},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"className","propType":"string"},{"name":"iconClassName","propType":"string"},{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeImage","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeImage","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeLink","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeLink","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType"}},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakePlaceholder","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakePlaceholder","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType"}},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"AIMakeText","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeText","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType"}},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object","defaultValue":"{}"}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"oneOfType","value":[{"type":"arrayOf","value":"node"},"node","string"]}},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":{"type":"object","isRequired":true}},{"name":"styleText","propType":{"type":"object","isRequired":true}},{"name":"styleLayout","propType":{"type":"object","isRequired":true}},{"name":"styleBackground","propType":{"type":"object","isRequired":true}},{"name":"style","propType":"object"}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"componentName":"Root","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"Root","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object","defaultValue":"{\n padding: 0,\n backgroundColor: '#f0f2f5',\n minHeight: '100%'\n}"},{"name":"children","propType":{"type":"oneOfType"}}]}
|
{"title":"multiple-exported-component","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object"},{"name":"children","propType":{"type":"oneOfType","value":["element",{"type":"arrayOf","value":"element"}]}}]}
|
||||||
@ -1 +1 @@
|
|||||||
{"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}}]}
|
{"title":"single-exported-component","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"","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","defaultValue":123},{"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":"oneOfType","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}}]}
|
||||||
@ -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":{"type":"symbol"}},{"name":"optionalNode","propType":"node"},{"name":"optionalElement","propType":"element"},{"name":"optionalElementType","propType":{"type":"elementType"}},{"name":"optionalMessage","propType":{"type":"instanceOf"}},{"name":"optionalEnum","propType":{"type":"oneOf"}},{"name":"optionalUnion","propType":{"type":"oneOfType"}},{"name":"optionalArrayOf","propType":{"type":"arrayOf"}},{"name":"optionalObjectOf","propType":{"type":"objectOf"}},{"name":"optionalObjectWithShape","propType":{"type":"shape"}},{"name":"optionalObjectWithShape2","propType":{"type":"shape"}},{"name":"optionalObjectWithStrictShape","propType":{"type":"exact"}},{"name":"requiredFunc","propType":"func"},{"name":"requiredAny","propType":"any"}]}
|
{"title":"single-exported-component","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"","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","defaultValue":123},{"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":"oneOfType","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}}]}
|
||||||
@ -30,20 +30,20 @@ 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.serial('generate single exported components', async t => {
|
||||||
const options: IMaterializeOptions = {
|
const options: IMaterializeOptions = {
|
||||||
cwd: singleExportedComptPath,
|
cwd: singleExportedComptPath,
|
||||||
entry: singleExportedComptPath,
|
entry: singleExportedComptPath,
|
||||||
|
|||||||
@ -18,24 +18,23 @@ test.serial('parse es6 multiple exported component by local', async t => {
|
|||||||
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);
|
||||||
// debugger;
|
|
||||||
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 = {
|
||||||
// cwd: singleExportedComptPath,
|
cwd: singleExportedComptPath,
|
||||||
// entry: singleExportedComptPath,
|
entry: singleExportedComptPath,
|
||||||
// accesser: 'local',
|
accesser: 'local',
|
||||||
// isExportedAsMultiple: false,
|
isExportedAsMultiple: false,
|
||||||
// };
|
};
|
||||||
|
|
||||||
// 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);
|
||||||
// });
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user