diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index 02b70a024823468f1e61210039815f8f6364a394..41693a1752eee6d107b41cd255bcc1b03558f1bc 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -122,7 +122,7 @@ export class ResultStates { } logger.info(this.blue, 'COMPILE RESULT:' + result + `{${resultInfo}}`, this.reset); } else { - logger.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset); + console.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset); } } diff --git a/compiler/src/component_map.ts b/compiler/src/component_map.ts index 9dea80f23c7a13fc35525934ba423b4438b7a359..81a7ef1f2e04cbb11a62314b8b5727810be84fd2 100644 --- a/compiler/src/component_map.ts +++ b/compiler/src/component_map.ts @@ -14,6 +14,12 @@ */ export const COMPONENT_MAP: any = { + Search: { + atomic: true, + attrs: [ + 'searchButton', 'placeholderColor', 'placeholderFont', 'onSubmit', 'onChange' + ] + }, FormComponent: { atomic: true, attrs: [ @@ -37,13 +43,14 @@ export const COMPONENT_MAP: any = { }, Animator: { atomic: true, + noDebugLine: true, attrs: [ 'state', 'duration', 'curve', 'delay', 'fillMode', 'iterations', 'playMode', 'motion', 'onStart', 'onPause', 'onRepeat', 'onCancel', 'onFinish', 'onFrame' ] }, Refresh: { - atomic: true, + single: true, attrs: [ 'refreshing', 'offset', 'friction', 'onStateChange', 'onRefreshing' @@ -241,10 +248,12 @@ export const COMPONENT_MAP: any = { }, PageTransitionEnter: { atomic: true, + noDebugLine: true, attrs: ['onEnter'] }, PageTransitionExit: { atomic: true, + noDebugLine: true, attrs: ['onExit'] }, Blank: { @@ -329,13 +338,13 @@ export const COMPONENT_MAP: any = { TextInput: { atomic: true, attrs: [ - 'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'onEditChanged', + 'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'maxLength', 'onEditChanged', 'onSubmit', 'onChange' ] }, Marquee: { atomic: true, - attrs: ['onStart', 'onBounce', 'onFinish'] + attrs: ['fontColor', 'fontSize', 'allowScale', 'fontWeight', 'fontFamily', 'onStart', 'onBounce', 'onFinish'] }, Menu: { children: ['Option'], @@ -367,7 +376,7 @@ const COMMON_ATTRS: Set = new Set([ 'accessibilityGroup', 'accessibilityText', 'accessibilityDescription', 'accessibilityImportance', 'onAccessibility', 'grayscale', 'brightness', 'contrast', 'saturate', 'geometryTransition', - 'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate' + 'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate', 'bindMenu' ]); const TRANSITION_COMMON_ATTRS: Set = new Set([ 'slide', 'translate', 'scale', 'opacity' @@ -376,9 +385,13 @@ export const GESTURE_ATTRS: Set = new Set([ 'gesture', 'parallelGesture', 'priorityGesture' ]); -export const forbiddenUseStateType: Set = new Set(['Scroller', 'SwiperScroller']); +export const forbiddenUseStateType: Set = new Set(['Scroller', 'SwiperScroller', + 'VideoController', 'CustomDialogController', 'SwiperController', 'TabsController', + 'CalendarController', 'AbilityController' +]); export const INNER_COMPONENT_NAMES: Set = new Set(); +export const NO_DEBUG_LINE_COMPONENT: Set = new Set(); export const BUILDIN_CONTAINER_COMPONENT: Set = new Set(); export const BUILDIN_STYLE_NAMES: Set = new Set([ ...COMMON_ATTRS, ...GESTURE_ATTRS, ...TRANSITION_COMMON_ATTRS @@ -424,5 +437,8 @@ export const JS_BIND_COMPONENTS: Set = new Set([ BUILDIN_STYLE_NAMES.add(item); }); } + if (COMPONENT_MAP[componentName].noDebugLine) { + NO_DEBUG_LINE_COMPONENT.add(componentName); + } }); })(); diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index e784300f49a9ab8ea582cee0c2aaf5c8c0fa3fbd..f59db6ad9acfbea406e1e6fdc8622ec56fc7d18d 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -53,7 +53,8 @@ import { CUSTOM_BUILDER_METHOD, GESTURE_ATTRS, GESTURE_TYPE_NAMES, - EXTEND_ATTRIBUTE + EXTEND_ATTRIBUTE, + NO_DEBUG_LINE_COMPONENT } from './component_map'; import { componentCollection } from './validate_ui_syntax'; import { processCustomComponent } from './process_custom_component'; @@ -145,9 +146,10 @@ function processComponentChild(node: ts.Block, newStatements: ts.Statement[], if (node.statements.length) { node.statements.forEach((item, index) => { if (ts.isExpressionStatement(item)) { - switch (getComponentType(item, log)) { + const name: string = getName(item); + switch (getComponentType(item, log, name)) { case ComponentType.innerComponent: - processInnerComponent(item, index, Array.from(node.statements), newStatements, log); + processInnerComponent(item, index, Array.from(node.statements), newStatements, log, name); break; case ComponentType.customComponent: processCustomComponent(item, newStatements, log); @@ -174,10 +176,10 @@ function processComponentChild(node: ts.Block, newStatements: ts.Statement[], } function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], - newStatements: ts.Statement[], log: LogInfo[]): void { + newStatements: ts.Statement[], log: LogInfo[], name: string): void { const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); newStatements.push(res.newNode); - if (projectConfig.isPreview) { + if (projectConfig.isPreview && !NO_DEBUG_LINE_COMPONENT.has(name)) { const posOfNode: ts.LineAndCharacter = transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node)); const projectPath: string = projectConfig.projectPath; @@ -664,8 +666,8 @@ enum ComponentType { customBuilderMethod } -function getComponentType(node: ts.ExpressionStatement, log: LogInfo[]): ComponentType { - const name: string = getName(node); +function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], + name: string): ComponentType { if (INNER_COMPONENT_NAMES.has(name)) { return ComponentType.innerComponent; } else if (componentCollection.customComponents.has(name)) {