diff --git a/packages/material-parser/src/parser/ReactParser.ts b/packages/material-parser/src/parser/ReactParser.ts index cd1c17227..6e53f73ac 100644 --- a/packages/material-parser/src/parser/ReactParser.ts +++ b/packages/material-parser/src/parser/ReactParser.ts @@ -17,38 +17,47 @@ import BaseParser from './BaseParser'; const log = debug.extend('mat'); const parser = buildParser(); -function transformType(item: any): any { - switch (typeof item) { - case 'string': - return { - propType: item, - }; - case 'object': - if (Array.isArray(item)) { - return item.map(transformType); - } else if (Object.keys(item).length === 1 && item.name) { - return { - propType: item.name, - }; - } else if (item.name === 'shape' || item.name === 'exact') { - return { - propType: item.name, - value: Object.keys(item.value).map(name => { - return { - name, - ...transformType(item.value[name]), - }; - }), - }; - } else if (item.name === 'enum') { - return item.value.map((x: any) => x.value); - } else { - return { - propType: item.name, - isRequired: item.required, - }; - } +function transformType(type: any): any { + const { name, value, computed, required } = type; + if (!value && !required) { + return name; } + if (computed !== undefined && value) { + // tslint:disable-next-line:no-eval + return eval(value); + } + const result: any = { + type: name, + }; + if (required) { + result.isRequired = required; + } + if (Array.isArray(value)) { + if (name === 'enum') { + result.type = 'oneOf'; + } + result.value = value.map(transformType); + } else if (typeof value === 'object') { + if (name === 'objectOf' || name === 'arrayOf' || name === 'instanceOf') { + result.value = transformType(value); + } else { + result.value = Object.keys(value).map((n: string) => { + return transformItem(n, value[n]); + }); + } + } else if (value !== undefined) { + result.value = value; + } + return result; +} + +function transformItem(name: string, item: any): any { + const result: any = { + name, + propType: transformType(item), + }; + + return result; } /** * 解析 react 生态下的组件 @@ -120,10 +129,14 @@ class ReactParser extends BaseParser { } public static parseProperties(objectPath: any): IPropTypes { - const results: IPropTypes = objectPath.get('properties').map((p: any) => ({ - name: p.get('key').node.name, - ...transformType(ReactDocUtils.getPropType(p.get('value'))), - })); + const results: IPropTypes = objectPath + .get('properties') + .map((p: any) => + transformItem( + p.get('key').node.name, + ReactDocUtils.getPropType(p.get('value')), + ), + ); // console.log(JSON.stringify(results, null, 2)); // objectPath.node.properties.forEach((prop: any) => { // if (t.isProperty(prop)) { @@ -239,7 +252,7 @@ class ReactParser extends BaseParser { path.node.expression.left.object.name === defaultExportName && ['propTypes'].includes(path.node.expression.left.property.name) ) { - debugger; + // debugger; // 处理 propTypes results.push( // @ts-ignore diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.md b/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.md index fe9b21702..9d00ac48d 100644 --- a/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.md +++ b/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.md @@ -25,9 +25,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -82,9 +90,17 @@ Generated by [AVA](https://avajs.dev). propType: 'string', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -151,9 +167,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -196,9 +220,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -233,9 +265,18 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + 'string', + ], + }, }, { name: 'type', @@ -286,9 +327,17 @@ Generated by [AVA](https://avajs.dev). propType: 'object', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + 'element', + { + type: 'arrayOf', + value: 'element', + }, + ], + }, }, ], screenshot: '', @@ -358,77 +407,106 @@ Generated by [AVA](https://avajs.dev). propType: 'elementType', }, { - isRequired: undefined, name: 'optionalMessage', - propType: 'instanceOf', + propType: { + type: 'instanceOf', + value: 'Demo', + }, }, { - 0: '\'News\'', - 1: '\'Photos\'', name: 'optionalEnum', + propType: { + type: 'oneOf', + value: [ + 'News', + 'Photos', + ], + }, }, { - isRequired: undefined, name: 'optionalUnion', - propType: 'union', + propType: { + type: 'union', + value: [ + 'string', + 'number', + { + type: 'instanceOf', + value: 'Demo', + }, + ], + }, }, { - isRequired: undefined, name: 'optionalArrayOf', - propType: 'arrayOf', + propType: { + type: 'arrayOf', + value: 'number', + }, }, { - isRequired: undefined, name: 'optionalObjectOf', - propType: 'objectOf', + propType: { + type: 'objectOf', + value: 'number', + }, }, { name: 'optionalObjectWithShape', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithShape2', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithStrictShape', - propType: 'exact', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'exact', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'requiredFunc', diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.snap b/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.snap index 4ae2a9c88..83251adf0 100644 Binary files a/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.snap and b/packages/material-parser/test/fixtures/__snapshots__/test/Materialize.ts.snap differ diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.md b/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.md index 92d7eeb69..db57fd94d 100644 --- a/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.md +++ b/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.md @@ -25,9 +25,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -82,9 +90,17 @@ Generated by [AVA](https://avajs.dev). propType: 'string', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -151,9 +167,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -196,9 +220,17 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -233,9 +265,18 @@ Generated by [AVA](https://avajs.dev). }, props: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + 'string', + ], + }, }, { name: 'type', @@ -286,9 +327,17 @@ Generated by [AVA](https://avajs.dev). propType: 'object', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + 'element', + { + type: 'arrayOf', + value: 'element', + }, + ], + }, }, ], screenshot: '', @@ -358,77 +407,106 @@ Generated by [AVA](https://avajs.dev). propType: 'elementType', }, { - isRequired: undefined, name: 'optionalMessage', - propType: 'instanceOf', + propType: { + type: 'instanceOf', + value: 'Demo', + }, }, { - 0: '\'News\'', - 1: '\'Photos\'', name: 'optionalEnum', + propType: { + type: 'oneOf', + value: [ + 'News', + 'Photos', + ], + }, }, { - isRequired: undefined, name: 'optionalUnion', - propType: 'union', + propType: { + type: 'union', + value: [ + 'string', + 'number', + { + type: 'instanceOf', + value: 'Demo', + }, + ], + }, }, { - isRequired: undefined, name: 'optionalArrayOf', - propType: 'arrayOf', + propType: { + type: 'arrayOf', + value: 'number', + }, }, { - isRequired: undefined, name: 'optionalObjectOf', - propType: 'objectOf', + propType: { + type: 'objectOf', + value: 'number', + }, }, { name: 'optionalObjectWithShape', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithShape2', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithStrictShape', - propType: 'exact', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'exact', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'requiredFunc', diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.snap b/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.snap index a1f33fe5d..6457c4511 100644 Binary files a/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.snap and b/packages/material-parser/test/fixtures/__snapshots__/test/accesser/LocalAccesser.ts.snap differ diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.md b/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.md index 85d277700..c37057bcc 100644 --- a/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.md +++ b/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.md @@ -65,77 +65,106 @@ Generated by [AVA](https://avajs.dev). propType: 'elementType', }, { - isRequired: undefined, name: 'optionalMessage', - propType: 'instanceOf', + propType: { + type: 'instanceOf', + value: 'Demo', + }, }, { - 0: '\'News\'', - 1: '\'Photos\'', name: 'optionalEnum', + propType: { + type: 'oneOf', + value: [ + 'News', + 'Photos', + ], + }, }, { - isRequired: undefined, name: 'optionalUnion', - propType: 'union', + propType: { + type: 'union', + value: [ + 'string', + 'number', + { + type: 'instanceOf', + value: 'Demo', + }, + ], + }, }, { - isRequired: undefined, name: 'optionalArrayOf', - propType: 'arrayOf', + propType: { + type: 'arrayOf', + value: 'number', + }, }, { - isRequired: undefined, name: 'optionalObjectOf', - propType: 'objectOf', + propType: { + type: 'objectOf', + value: 'number', + }, }, { name: 'optionalObjectWithShape', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithShape2', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithStrictShape', - propType: 'exact', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'exact', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'requiredFunc', diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.snap b/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.snap index 2e435fcd3..74a335ea8 100644 Binary files a/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.snap and b/packages/material-parser/test/fixtures/__snapshots__/test/generator/Generator.ts.snap differ diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.md b/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.md index 96255e4d6..d53a144ba 100644 --- a/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.md +++ b/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.md @@ -176,9 +176,17 @@ Generated by [AVA](https://avajs.dev). propsDefaults: [], propsTypes: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -295,9 +303,17 @@ Generated by [AVA](https://avajs.dev). propType: 'string', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -502,9 +518,17 @@ Generated by [AVA](https://avajs.dev). propsDefaults: [], propsTypes: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -599,9 +623,17 @@ Generated by [AVA](https://avajs.dev). propsDefaults: [], propsTypes: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + ], + }, }, { name: 'styleBoxModel', @@ -703,9 +735,18 @@ Generated by [AVA](https://avajs.dev). propsDefaults: [], propsTypes: [ { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + { + type: 'arrayOf', + value: 'node', + }, + 'node', + 'string', + ], + }, }, { name: 'type', @@ -793,9 +834,17 @@ Generated by [AVA](https://avajs.dev). propType: 'object', }, { - isRequired: undefined, name: 'children', - propType: 'union', + propType: { + type: 'union', + value: [ + 'element', + { + type: 'arrayOf', + value: 'element', + }, + ], + }, }, ], subModules: [], @@ -897,77 +946,106 @@ Generated by [AVA](https://avajs.dev). propType: 'elementType', }, { - isRequired: undefined, name: 'optionalMessage', - propType: 'instanceOf', + propType: { + type: 'instanceOf', + value: 'Demo', + }, }, { - 0: '\'News\'', - 1: '\'Photos\'', name: 'optionalEnum', + propType: { + type: 'oneOf', + value: [ + 'News', + 'Photos', + ], + }, }, { - isRequired: undefined, name: 'optionalUnion', - propType: 'union', + propType: { + type: 'union', + value: [ + 'string', + 'number', + { + type: 'instanceOf', + value: 'Demo', + }, + ], + }, }, { - isRequired: undefined, name: 'optionalArrayOf', - propType: 'arrayOf', + propType: { + type: 'arrayOf', + value: 'number', + }, }, { - isRequired: undefined, name: 'optionalObjectOf', - propType: 'objectOf', + propType: { + type: 'objectOf', + value: 'number', + }, }, { name: 'optionalObjectWithShape', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithShape2', - propType: 'shape', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'shape', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'optionalObjectWithStrictShape', - propType: 'exact', - value: [ - { - isRequired: false, - name: 'optionalProperty', - propType: 'string', - }, - { - isRequired: true, - name: 'requiredProperty', - propType: 'number', - }, - ], + propType: { + type: 'exact', + value: [ + { + name: 'optionalProperty', + propType: 'string', + }, + { + name: 'requiredProperty', + propType: { + isRequired: true, + type: 'number', + }, + }, + ], + }, }, { name: 'requiredFunc', diff --git a/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.snap b/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.snap index 550492400..3e1b7f1e9 100644 Binary files a/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.snap and b/packages/material-parser/test/fixtures/__snapshots__/test/parser/ReactParser.ts.snap differ diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json index 05b55086f..94d358017 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeBlank/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakeBlank","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"styleFlexLayout","propType":"object"},{"name":"style","propType":"object"},{"name":"id","propType":"string"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json index 506e8ec9d..1b9fd4b3d 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeIcon/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakeIcon","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json index ceb9f04c0..2092db4b6 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeImage/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakeImage","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json index c9a853d92..993baf75f 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeLink/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakeLink","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json index 2a81c74be..f4d1ef441 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakePlaceholder/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakePlaceholder","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"style","propType":"object"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json index 288ff813a..b9bc6c295 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/AIMakeText/manifest.json @@ -1 +1 @@ -{"componentName":"AIMakeText","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json index 06b8ece40..a791f69fa 100644 --- a/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json +++ b/packages/material-parser/test/fixtures/multiple-exported-component/es/basic/Root/manifest.json @@ -1 +1 @@ -{"componentName":"Root","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.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":"union"}]} \ No newline at end of file +{"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"}]}}]} \ No newline at end of file diff --git a/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json b/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json index 9c78c9ee8..a37753723 100644 --- a/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json +++ b/packages/material-parser/test/fixtures/single-exported-component/es/manifest.json @@ -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":"instanceOf"},{"0":"'News'","1":"'Photos'","name":"optionalEnum"},{"name":"optionalUnion","propType":"union"},{"name":"optionalArrayOf","propType":"arrayOf"},{"name":"optionalObjectOf","propType":"objectOf"},{"name":"optionalObjectWithShape","propType":"shape","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"optionalObjectWithShape2","propType":"shape","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"optionalObjectWithStrictShape","propType":"exact","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"requiredFunc","propType":"func"},{"name":"requiredAny","propType":"any"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file