mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 09:47:20 +00:00
fix: miss scope
This commit is contained in:
parent
7ce3df0eda
commit
97242c3c48
@ -13,6 +13,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "ava --watch",
|
"start": "ava --watch",
|
||||||
"build": "rimraf lib && build-scripts build --skip-demo",
|
"build": "rimraf lib && build-scripts build --skip-demo",
|
||||||
|
"build:tsc": "rimraf lib && tsc",
|
||||||
"demo": "node ./demo/demo.js",
|
"demo": "node ./demo/demo.js",
|
||||||
"test": "ava",
|
"test": "ava",
|
||||||
"template": "node ./tools/createTemplate.js"
|
"template": "node ./tools/createTemplate.js"
|
||||||
|
|||||||
@ -5,11 +5,13 @@ import {
|
|||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IContainerInfo,
|
IContainerInfo,
|
||||||
|
IScope,
|
||||||
} from '../../../types';
|
} from '../../../types';
|
||||||
|
|
||||||
import { REACT_CHUNK_NAME } from './const';
|
import { REACT_CHUNK_NAME } from './const';
|
||||||
|
|
||||||
import { createReactNodeGenerator } from '../../../utils/nodeToJSX';
|
import { createReactNodeGenerator } from '../../../utils/nodeToJSX';
|
||||||
|
import Scope from '../../../utils/Scope';
|
||||||
|
|
||||||
type PluginConfig = {
|
type PluginConfig = {
|
||||||
fileType?: string;
|
fileType?: string;
|
||||||
@ -26,9 +28,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
|||||||
const { nodeTypeMapping } = cfg;
|
const { nodeTypeMapping } = cfg;
|
||||||
|
|
||||||
const generator = createReactNodeGenerator({
|
const generator = createReactNodeGenerator({
|
||||||
handlers: {
|
tagMapping: (v) => nodeTypeMapping[v] || v,
|
||||||
tagName: (v) => nodeTypeMapping[v] || v,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
@ -37,7 +37,8 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ir = next.ir as IContainerInfo;
|
const ir = next.ir as IContainerInfo;
|
||||||
const jsxContent = generator(ir);
|
const scope: IScope = Scope.createRootScope();
|
||||||
|
const jsxContent = generator(ir, scope);
|
||||||
|
|
||||||
next.chunks.push({
|
next.chunks.push({
|
||||||
type: ChunkType.STRING,
|
type: ChunkType.STRING,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ir = next.ir as IParseResult;
|
const ir = next.ir as IParseResult;
|
||||||
|
// TODO: miniAppBuildType 这个东西是不是不应该在 schema 里面,而是应该由 plugin 的构造参数传入
|
||||||
const miniAppBuildType = ir.project?.config.miniAppBuildType;
|
const miniAppBuildType = ir.project?.config.miniAppBuildType;
|
||||||
|
|
||||||
const buildCfg = {
|
const buildCfg = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user