fix: babel build bug & add some comment

This commit is contained in:
春希 2020-11-10 11:28:09 +08:00
parent 8f6586c34d
commit 1511e2cb96
7 changed files with 13 additions and 6 deletions

View File

@ -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)) {

View File

@ -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;
}); });

View File

@ -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);

View File

@ -162,6 +162,9 @@ export type CompositeValueGeneratorOptions = {
nodeGenerator?: NodeGenerator<string>; nodeGenerator?: NodeGenerator<string>;
}; };
/**
*
*/
export interface IScope { export interface IScope {
// 作用域内定义 // 作用域内定义
bindings?: IScopeBindings; bindings?: IScopeBindings;

View File

@ -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();
} }

View File

@ -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;
} }

View File

@ -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);
} }
} }
}); });