refactor: 💡 将所有的 schema 相关的定义都收敛到 types/schema.ts 中

This commit is contained in:
牧毅 2020-08-13 23:02:44 +08:00
parent 78f34ab1ca
commit bb48fe1bd1
4 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,3 @@
import { CompositeValue, DataSourceConfig, isJSExpression, isJSFunction } from '@ali/lowcode-types';
import { CLASS_DEFINE_CHUNK_NAME, COMMON_CHUNK_NAME } from '../../../const/generator';
import {
@ -8,7 +6,12 @@ import {
ChunkType,
FileType,
ICodeStruct,
CompositeValue,
DataSourceConfig,
isJSExpression,
isJSFunction,
} from '../../../types';
import { generateUnknownType } from '../../../utils/compositeType';
import { isContainerSchema } from '../../../utils/schema';
import { RAX_CHUNK_NAME } from './const';

View File

@ -1,4 +1,3 @@
import { NpmInfo } from '@ali/lowcode-types';
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
import {
@ -9,6 +8,7 @@ import {
ICodeStruct,
IPackageJSON,
IProjectInfo,
NpmInfo,
} from '../../../../../types';
import { isNpmInfo } from '../../../../../utils/schema';
import { calcCompatibleVersion } from '../../../../../utils/version';

View File

@ -1,9 +1,7 @@
import { JSExpression, JSFunction, NodeSchema } from '@ali/lowcode-types';
import { CustomHandlerSet } from '../utils/compositeType';
import { IParseResult } from './intermediate';
import { IResultDir, IResultFile } from './result';
import { IBasicSchema, IProjectSchema } from './schema';
import { IBasicSchema, IProjectSchema, JSExpression, JSFunction, NodeSchema } from './schema';
export enum FileType {
CSS = 'css',

View File

@ -1,4 +1,4 @@
import { ContainerSchema, NpmInfo } from '@ali/lowcode-types';
import { ContainerSchema, NpmInfo } from '../types';
export function isContainerSchema(x: any): x is ContainerSchema {
return typeof x === 'object' && x && typeof x.componentName === 'string' && typeof x.fileName === 'string';