mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-11 02:16:03 +00:00
feat: 🎸 与国凯的数据源引擎联调,对齐包名和导出方式
This commit is contained in:
parent
19fabc1760
commit
fea0946150
@ -42,19 +42,22 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
|||||||
|
|
||||||
dataSourceItems.forEach((ds) => {
|
dataSourceItems.forEach((ds) => {
|
||||||
if (!(ds.type in requestHandlersMap) && ds.type !== 'custom') {
|
if (!(ds.type in requestHandlersMap) && ds.type !== 'custom') {
|
||||||
const handlerName = '__$$' + changeCase.camelCase(ds.type) + 'RequestHandler';
|
const handlerFactoryName = '__$$create' + changeCase.pascal(ds.type) + 'RequestHandler';
|
||||||
|
|
||||||
requestHandlersMap[ds.type] = {
|
requestHandlersMap[ds.type] = {
|
||||||
type: 'JSExpression',
|
type: 'JSExpression',
|
||||||
value: handlerName + (ds.type === 'urlParams' ? '(this.props.location.search)' : ''),
|
value: handlerFactoryName + (ds.type === 'urlParams' ? '(this.props.location.search)' : '()'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlerFactoryExportName = `create${changeCase.pascal(ds.type)}Handler`;
|
||||||
|
const handlerPkgName = `@ali/lowcode-datasource-${changeCase.kebab(ds.type)}-handler`;
|
||||||
|
|
||||||
next.chunks.push({
|
next.chunks.push({
|
||||||
type: ChunkType.STRING,
|
type: ChunkType.STRING,
|
||||||
fileType: FileType.JSX,
|
fileType: FileType.JSX,
|
||||||
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
||||||
content: `
|
content: `
|
||||||
import ${handlerName} from '@ali/lowcode-datasource-engine/handlers/${changeCase.kebabCase(ds.type)}';
|
import { ${handlerFactoryExportName} as ${handlerFactoryName} } from '${handlerPkgName}';
|
||||||
`,
|
`,
|
||||||
linkAfter: [],
|
linkAfter: [],
|
||||||
});
|
});
|
||||||
@ -69,7 +72,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
|||||||
fileType: FileType.JSX,
|
fileType: FileType.JSX,
|
||||||
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
||||||
content: `
|
content: `
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
`,
|
`,
|
||||||
linkAfter: [],
|
linkAfter: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -33,7 +33,12 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
|||||||
lint: 'eslint --ext .js --ext .jsx ./',
|
lint: 'eslint --ext .js --ext .jsx ./',
|
||||||
},
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
'@ali/lowcode-datasource-engine': '^0.1.0',
|
'@ali/lowcode-datasource-engine': '*',
|
||||||
|
// TODO: 如何动态获取下面这些依赖?
|
||||||
|
'@ali/lowcode-datasource-url-params-handler': '*',
|
||||||
|
'@ali/lowcode-datasource-fetch-handler': '*',
|
||||||
|
'@ali/lowcode-datasource-mtop-handler': '*',
|
||||||
|
'@ali/lowcode-datasource-mopen-handler': '*',
|
||||||
'universal-env': '^3.2.0',
|
'universal-env': '^3.2.0',
|
||||||
'intl-messageformat': '^9.3.6',
|
'intl-messageformat': '^9.3.6',
|
||||||
rax: '^1.1.0',
|
rax: '^1.1.0',
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
"lint": "eslint --ext .js --ext .jsx ./"
|
"lint": "eslint --ext .js --ext .jsx ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
"@ali/lowcode-datasource-engine": "*",
|
||||||
|
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||||
"universal-env": "^3.2.0",
|
"universal-env": "^3.2.0",
|
||||||
"intl-messageformat": "^9.3.6",
|
"intl-messageformat": "^9.3.6",
|
||||||
"rax": "^1.1.0",
|
"rax": "^1.1.0",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import Page from 'rax-view';
|
|||||||
|
|
||||||
import Text from 'rax-text';
|
import Text from 'rax-text';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
"lint": "eslint --ext .js --ext .jsx ./"
|
"lint": "eslint --ext .js --ext .jsx ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
"@ali/lowcode-datasource-engine": "*",
|
||||||
|
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||||
"universal-env": "^3.2.0",
|
"universal-env": "^3.2.0",
|
||||||
"intl-messageformat": "^9.3.6",
|
"intl-messageformat": "^9.3.6",
|
||||||
"rax": "^1.1.0",
|
"rax": "^1.1.0",
|
||||||
|
|||||||
@ -9,11 +9,11 @@ import Text from 'rax-text';
|
|||||||
|
|
||||||
import Image from 'rax-image';
|
import Image from 'rax-image';
|
||||||
|
|
||||||
import __$$urlParamsRequestHandler from '@ali/lowcode-datasource-engine/handlers/url-params';
|
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from '@ali/lowcode-datasource-url-params-handler';
|
||||||
|
|
||||||
import __$$fetchRequestHandler from '@ali/lowcode-datasource-engine/handlers/fetch';
|
import { createFetchHandler as __$$createFetchRequestHandler } from '@ali/lowcode-datasource-fetch-handler';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
@ -51,8 +51,8 @@ class Home$$Page extends Component {
|
|||||||
_dataSourceEngine = __$$createDataSourceEngine(this._dataSourceConfig, this._context, {
|
_dataSourceEngine = __$$createDataSourceEngine(this._dataSourceConfig, this._context, {
|
||||||
runtimeConfig: true,
|
runtimeConfig: true,
|
||||||
requestHandlersMap: {
|
requestHandlersMap: {
|
||||||
urlParams: __$$urlParamsRequestHandler(this.props.location.search),
|
urlParams: __$$createUrlParamsRequestHandler(this.props.location.search),
|
||||||
fetch: __$$fetchRequestHandler,
|
fetch: __$$createFetchRequestHandler(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
"lint": "eslint --ext .js --ext .jsx ./"
|
"lint": "eslint --ext .js --ext .jsx ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
"@ali/lowcode-datasource-engine": "*",
|
||||||
|
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||||
"universal-env": "^3.2.0",
|
"universal-env": "^3.2.0",
|
||||||
"intl-messageformat": "^9.3.6",
|
"intl-messageformat": "^9.3.6",
|
||||||
"rax": "^1.1.0",
|
"rax": "^1.1.0",
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
|||||||
|
|
||||||
import Image from 'rax-image';
|
import Image from 'rax-image';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
|||||||
|
|
||||||
import Image from 'rax-image';
|
import Image from 'rax-image';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
|||||||
|
|
||||||
import Image from 'rax-image';
|
import Image from 'rax-image';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
"lint": "eslint --ext .js --ext .jsx ./"
|
"lint": "eslint --ext .js --ext .jsx ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
"@ali/lowcode-datasource-engine": "*",
|
||||||
|
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||||
"universal-env": "^3.2.0",
|
"universal-env": "^3.2.0",
|
||||||
"intl-messageformat": "^9.3.6",
|
"intl-messageformat": "^9.3.6",
|
||||||
"rax": "^1.1.0",
|
"rax": "^1.1.0",
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Text from 'rax-text';
|
|||||||
|
|
||||||
import Image from 'rax-image';
|
import Image from 'rax-image';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
"lint": "eslint --ext .js --ext .jsx ./"
|
"lint": "eslint --ext .js --ext .jsx ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
"@ali/lowcode-datasource-engine": "*",
|
||||||
|
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||||
|
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||||
"universal-env": "^3.2.0",
|
"universal-env": "^3.2.0",
|
||||||
"intl-messageformat": "^9.3.6",
|
"intl-messageformat": "^9.3.6",
|
||||||
"rax": "^1.1.0",
|
"rax": "^1.1.0",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import Page from 'rax-view';
|
|||||||
|
|
||||||
import Text from 'rax-text';
|
import Text from 'rax-text';
|
||||||
|
|
||||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||||
|
|
||||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user