mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch hotfix/babel-build-bug into release/1.0.0
Title: fix: 修复 babel 编译行为不正确的地方 1. 修复 Set 解构行为不正确 2. 修复 types 检查不正确的地方 3. 补全部分注释 Link: https://code.aone.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/codereview/4062802
This commit is contained in:
commit
a9c9c788d6
@ -63,7 +63,7 @@ function buildPackageImport(
|
||||
const srcName = dep.exportName;
|
||||
let targetName = dep.componentName || dep.exportName;
|
||||
|
||||
// 如果是自组件,则导出父组件,并且根据自组件命名规则,判断是否需要定义标识符
|
||||
// 如果是子组件,则导出父组件,并且根据自组件命名规则,判断是否需要定义标识符
|
||||
if (dep.subName) {
|
||||
if (targetName !== `${srcName}.${dep.subName}`) {
|
||||
if (!isValidIdentifier(targetName)) {
|
||||
|
||||
@ -74,7 +74,6 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
||||
originTemplate: '@alifd/scaffold-lite-js',
|
||||
};
|
||||
|
||||
console.log(ir.packages);
|
||||
ir.packages.forEach((packageInfo) => {
|
||||
packageJson.dependencies[packageInfo.package] = packageInfo.version;
|
||||
});
|
||||
|
||||
@ -37,9 +37,9 @@ const writeFilesToFolder = async (folderPath: string, files: ResultFile[], fs: I
|
||||
await Promise.all(promises);
|
||||
};
|
||||
|
||||
const writeSubFoldersToFolder = async (folderPath: string, subFolders: ResultDir[]): Promise<void> => {
|
||||
const writeSubFoldersToFolder = async (folderPath: string, subFolders: ResultDir[], fs: IFileSystem): Promise<void> => {
|
||||
const promises = subFolders.map((subFolder) => {
|
||||
return writeFolder(subFolder, folderPath);
|
||||
return writeFolder(subFolder, folderPath, false, fs);
|
||||
});
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
@ -162,6 +162,9 @@ export type CompositeValueGeneratorOptions = {
|
||||
nodeGenerator?: NodeGenerator<string>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 作用域定义,维护作用域内定义,支持作用域链上溯
|
||||
*/
|
||||
export interface IScope {
|
||||
// 作用域内定义
|
||||
bindings?: IScopeBindings;
|
||||
|
||||
@ -2,6 +2,9 @@ import { IScope } from '../types/core';
|
||||
import { IScopeBindings, ScopeBindings } from './ScopeBindings';
|
||||
|
||||
class Scope implements IScope {
|
||||
/**
|
||||
* 创建根部 Scope,根据需要被上溯的作用域链决定是否开启新的
|
||||
*/
|
||||
static createRootScope(): IScope {
|
||||
return new Scope();
|
||||
}
|
||||
|
||||
@ -27,7 +27,9 @@ export function uniqueArray<T>(arr: T[], by: (i: T) => string) {
|
||||
arr.forEach((item) => {
|
||||
map[by(item)] = item;
|
||||
});
|
||||
const uniqueKeys = [...new Set<string>(Object.keys(map))];
|
||||
// FIXME: Babel 编译存在问题,暂时替换实现
|
||||
// const uniqueKeys = [...new Set<string>(Object.keys(map))];
|
||||
const uniqueKeys = Array.from(new Set<string>(Object.keys(map)));
|
||||
const uniqueItems = uniqueKeys.map((key) => map[key]);
|
||||
return uniqueItems;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ export function parseExpressionGetGlobalVariables(
|
||||
addUndeclaredIdentifierIfNeeded(item, path);
|
||||
});
|
||||
} else {
|
||||
addUndeclaredIdentifierIfNeeded(fieldValue, path);
|
||||
addUndeclaredIdentifierIfNeeded(fieldValue as Record<string, unknown> | null, path);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user