mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-22 09:18:11 +00:00
fix: babel build bug & add some comment
This commit is contained in:
parent
8f6586c34d
commit
1511e2cb96
@ -63,7 +63,7 @@ function buildPackageImport(
|
|||||||
const srcName = dep.exportName;
|
const srcName = dep.exportName;
|
||||||
let targetName = dep.componentName || dep.exportName;
|
let targetName = dep.componentName || dep.exportName;
|
||||||
|
|
||||||
// 如果是自组件,则导出父组件,并且根据自组件命名规则,判断是否需要定义标识符
|
// 如果是子组件,则导出父组件,并且根据自组件命名规则,判断是否需要定义标识符
|
||||||
if (dep.subName) {
|
if (dep.subName) {
|
||||||
if (targetName !== `${srcName}.${dep.subName}`) {
|
if (targetName !== `${srcName}.${dep.subName}`) {
|
||||||
if (!isValidIdentifier(targetName)) {
|
if (!isValidIdentifier(targetName)) {
|
||||||
|
|||||||
@ -74,7 +74,6 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
|||||||
originTemplate: '@alifd/scaffold-lite-js',
|
originTemplate: '@alifd/scaffold-lite-js',
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(ir.packages);
|
|
||||||
ir.packages.forEach((packageInfo) => {
|
ir.packages.forEach((packageInfo) => {
|
||||||
packageJson.dependencies[packageInfo.package] = packageInfo.version;
|
packageJson.dependencies[packageInfo.package] = packageInfo.version;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -37,9 +37,9 @@ const writeFilesToFolder = async (folderPath: string, files: ResultFile[], fs: I
|
|||||||
await Promise.all(promises);
|
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) => {
|
const promises = subFolders.map((subFolder) => {
|
||||||
return writeFolder(subFolder, folderPath);
|
return writeFolder(subFolder, folderPath, false, fs);
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|||||||
@ -162,6 +162,9 @@ export type CompositeValueGeneratorOptions = {
|
|||||||
nodeGenerator?: NodeGenerator<string>;
|
nodeGenerator?: NodeGenerator<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作用域定义,维护作用域内定义,支持作用域链上溯
|
||||||
|
*/
|
||||||
export interface IScope {
|
export interface IScope {
|
||||||
// 作用域内定义
|
// 作用域内定义
|
||||||
bindings?: IScopeBindings;
|
bindings?: IScopeBindings;
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { IScope } from '../types/core';
|
|||||||
import { IScopeBindings, ScopeBindings } from './ScopeBindings';
|
import { IScopeBindings, ScopeBindings } from './ScopeBindings';
|
||||||
|
|
||||||
class Scope implements IScope {
|
class Scope implements IScope {
|
||||||
|
/**
|
||||||
|
* 创建根部 Scope,根据需要被上溯的作用域链决定是否开启新的
|
||||||
|
*/
|
||||||
static createRootScope(): IScope {
|
static createRootScope(): IScope {
|
||||||
return new Scope();
|
return new Scope();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,9 @@ export function uniqueArray<T>(arr: T[], by: (i: T) => string) {
|
|||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
map[by(item)] = 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]);
|
const uniqueItems = uniqueKeys.map((key) => map[key]);
|
||||||
return uniqueItems;
|
return uniqueItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,7 +168,7 @@ export function parseExpressionGetGlobalVariables(
|
|||||||
addUndeclaredIdentifierIfNeeded(item, path);
|
addUndeclaredIdentifierIfNeeded(item, path);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addUndeclaredIdentifierIfNeeded(fieldValue, path);
|
addUndeclaredIdentifierIfNeeded(fieldValue as Record<string, unknown> | null, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user