diff --git a/package.json b/package.json index 9a864456..21fe7a2d 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "devDependencies": { "cpy-cli": "^3.1.1", "del-cli": "^3.0.1", - "devextreme-internal-tools": "^7.2.3", + "devextreme-internal-tools": "^7.3.2", "gulp": "^4.0.0", "gulp-tslint": "^8.1.3", "jest": "^26.6.3", diff --git a/packages/devextreme-vue-generator/package.json b/packages/devextreme-vue-generator/package.json index de01b1dc..7ae348a8 100644 --- a/packages/devextreme-vue-generator/package.json +++ b/packages/devextreme-vue-generator/package.json @@ -27,7 +27,7 @@ "license": "MIT", "dependencies": { "dasherize": "^2.0.0", - "devextreme-internal-tools": "^7.2.3", + "devextreme-internal-tools": "^7.3.2", "dot": "^1.1.2" }, "devDependencies": { diff --git a/packages/devextreme-vue-generator/src/component-generator.test.ts b/packages/devextreme-vue-generator/src/component-generator.test.ts index 94f54921..961bbaeb 100644 --- a/packages/devextreme-vue-generator/src/component-generator.test.ts +++ b/packages/devextreme-vue-generator/src/component-generator.test.ts @@ -50,6 +50,10 @@ export { it("generates component with model", () => { //#region EXPECTED const EXPECTED = ` +export { + ReexportedMember, + OtherReexportedMember, +} from "widget-gackage-name/DX/WIDGET/PATH"; import WIDGET from "widget-gackage-name/DX/WIDGET/PATH"; import { BASE_COMPONENT } from "./BASE_COMPONENT_PATH"; @@ -91,7 +95,8 @@ export { name: "CONFIG_COMPONENT", path: "./CONFIG_COMPONENT_PATH" }, - hasModel: true + hasModel: true, + reexports: [ "ReexportedMember", "OtherReexportedMember", "default"] }, "widget-gackage-name") ).toBe(EXPECTED); }); @@ -151,7 +156,8 @@ export { name: "CONFIG_COMPONENT", path: "./CONFIG_COMPONENT_PATH" }, - props: [{ name: "PROP" }] + props: [{ name: "PROP" }], + reexports: [ "default" ] }, "widget-gackage-name") ).toBe(EXPECTED); }); diff --git a/packages/devextreme-vue-generator/src/component-generator.ts b/packages/devextreme-vue-generator/src/component-generator.ts index f0109dbe..bc78a2ef 100644 --- a/packages/devextreme-vue-generator/src/component-generator.ts +++ b/packages/devextreme-vue-generator/src/component-generator.ts @@ -21,6 +21,7 @@ interface IComponent { hasExplicitTypes?: boolean; nestedComponents?: INestedComponent[]; expectedChildren?: Record; + reexports?: string[]; } interface INestedComponent { @@ -108,6 +109,7 @@ function generate(component: IComponent, widgetsPackage: string = "devextreme", nestedComponents, defaultExport: component.name, namedExports, + reexports: component.reexports, expectedChildren: formatExpectedChildren(component.expectedChildren), widgetsPackage, templatesRenderAsynchronously: !USE_SYNC_TEMPLATES.has(component.name), @@ -165,6 +167,7 @@ const renderComponent: (model: { expectedChildren?: IExpectedChildModel[]; defaultExport: string; namedExports: string[]; + reexports?: string[]; widgetsPackage: string; templatesRenderAsynchronously: boolean; isVue3: boolean; @@ -174,6 +177,10 @@ const renderComponent: (model: { `export { ExplicitTypes } from "<#= it.widgetsPackage #>/<#= it.widgetImport.path #>";\n` + `<#?#>` + +`<#? it.reexports?.filter(n => n != 'default')?.length #>` + + `export {\n <#= it.reexports.filter(n => n != 'default').join(',\\n ') #>,\n} from "<#= it.widgetsPackage #>/<#= it.widgetImport.path #>";\n` + +`<#?#>` + + `import <#= it.widgetImport.name #><#? it.props #>, { Properties }<#?#> from "<#= it.widgetsPackage #>/<#= it.widgetImport.path #>";\n` + `<#~ it.namedImports :namedImport #>` + `import { <#= namedImport.name #> } from "<#= namedImport.path #>";\n` + diff --git a/packages/devextreme-vue-generator/src/generator.ts b/packages/devextreme-vue-generator/src/generator.ts index c415ffa9..690f5dea 100644 --- a/packages/devextreme-vue-generator/src/generator.ts +++ b/packages/devextreme-vue-generator/src/generator.ts @@ -111,6 +111,7 @@ function mapWidget( props: getProps(raw.options, customTypeHash), hasModel: !!raw.isEditor, hasExplicitTypes: !!raw.optionsTypeParams?.length, + reexports: raw.reexports, nestedComponents: raw.complexOptions ? raw.complexOptions.map((o) => mapNestedComponent(o, customTypeHash)) : undefined,