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