mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-20 00:54:09 -04:00
Update: updated adaptation rules
Signed-off-by: laibo102 <laibo2@huawei.com> Change-Id: I08ae1c53ef77172351f2c1ed30457ccaa289fdff
This commit is contained in:
+6
-5
@@ -24,6 +24,7 @@ const {
|
||||
configure,
|
||||
getLogger
|
||||
} = require('log4js');
|
||||
const { PARTIALUPDATESDKVERSIONS } = require('./lib/pre_define');
|
||||
|
||||
configure({
|
||||
appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}},
|
||||
@@ -380,8 +381,8 @@ function loadModuleInfo(projectConfig, envArgs) {
|
||||
projectConfig.nodeModulesPath = buildJsonInfo.nodeModulesPath;
|
||||
}
|
||||
projectConfig.pandaMode = buildJsonInfo.pandaMode;
|
||||
if (buildJsonInfo.compatibleSdkVersion) {
|
||||
sdkVersion.compatibleSdkVersion = buildJsonInfo.compatibleSdkVersion;
|
||||
if (PARTIALUPDATESDKVERSIONS.has(buildJsonInfo.compatibleSdkVersion)) {
|
||||
partialUpdateConfig.partialUpdateMode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -433,8 +434,8 @@ const globalProgram = {
|
||||
watchProgram: null
|
||||
};
|
||||
|
||||
const sdkVersion = {
|
||||
compatibleSdkVersion: 9
|
||||
const partialUpdateConfig = {
|
||||
partialUpdateMode: true
|
||||
};
|
||||
|
||||
exports.globalProgram = globalProgram;
|
||||
@@ -450,4 +451,4 @@ exports.loadModuleInfo = loadModuleInfo;
|
||||
exports.systemModules = systemModules;
|
||||
exports.checkAppResourcePath = checkAppResourcePath;
|
||||
exports.addSDKBuildDependencies = addSDKBuildDependencies;
|
||||
exports.sdkVersion = sdkVersion;
|
||||
exports.partialUpdateConfig = partialUpdateConfig;
|
||||
@@ -325,3 +325,4 @@ export const SYNCHED_PROPERTY_NESED_OBJECT_PU: string = 'SynchedPropertyNesedObj
|
||||
export const OBSERVED_PROPERTY_ABSTRACT_PU:string = 'ObservedPropertyAbstractPU';
|
||||
export const COMPONENT_CONSTRUCTOR_LOCALSTORAGE_PU: string = '__localStorage';
|
||||
export const COMPONENT_CONSTRUCTOR_LOCALSTORAGE_TYPE_PU: string = 'LocalStorage';
|
||||
export const PARTIALUPDATESDKVERSIONS: Set<Number> = new Set([9]);
|
||||
|
||||
@@ -116,7 +116,7 @@ import {
|
||||
componentInfo,
|
||||
createFunction
|
||||
} from './utils';
|
||||
import { sdkVersion, projectConfig } from '../main';
|
||||
import { partialUpdateConfig, projectConfig } from '../main';
|
||||
import { transformLog, contextGlobal } from './process_ui_syntax';
|
||||
import { props } from './compile_info';
|
||||
import { CUSTOM_COMPONENT } from '../lib/pre_define';
|
||||
@@ -125,7 +125,7 @@ export function processComponentBuild(node: ts.MethodDeclaration,
|
||||
log: LogInfo[]): ts.MethodDeclaration {
|
||||
let newNode: ts.MethodDeclaration;
|
||||
let renderNode: ts.Identifier;
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
renderNode = ts.factory.createIdentifier(COMPONENT_RENDER_FUNCTION);
|
||||
} else {
|
||||
renderNode = ts.factory.createIdentifier(COMPONENT_INITIAl_RENDER_FUNCTION);
|
||||
@@ -148,7 +148,7 @@ export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogI
|
||||
const newStatements: ts.Statement[] = [];
|
||||
processComponentChild(node, newStatements, log,
|
||||
{isAcceleratePreview: false, line: 0, column: 0, fileName: ''}, isInnerBuilder, parent);
|
||||
if (isLazy && sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (isLazy && !partialUpdateConfig.partialUpdateMode) {
|
||||
newStatements.unshift(createRenderingInProgress(true));
|
||||
}
|
||||
if (isTransition) {
|
||||
@@ -159,7 +159,7 @@ export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogI
|
||||
createFunction(ts.factory.createIdentifier(COMPONENT_TRANSITION_NAME),
|
||||
ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null)));
|
||||
}
|
||||
if (isLazy && sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (isLazy && !partialUpdateConfig.partialUpdateMode) {
|
||||
newStatements.push(createRenderingInProgress(false));
|
||||
}
|
||||
return ts.factory.updateBlock(node, newStatements);
|
||||
@@ -283,7 +283,7 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme
|
||||
break;
|
||||
case ComponentType.forEachComponent:
|
||||
parent = undefined;
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
processForEachComponent(item, newStatements, log, isInnerBuilder);
|
||||
} else {
|
||||
processForEachComponentNew(item, newStatements, log);
|
||||
@@ -414,9 +414,9 @@ function processInnerComponent(node: ts.ExpressionStatement, innerCompStatements
|
||||
newStatements.push(res.newNode);
|
||||
const nameResult: NameResult = { name: null };
|
||||
validateEtsComponentNode(node.expression as ts.EtsComponentExpression, nameResult);
|
||||
if (sdkVersion.compatibleSdkVersion === 9 && ItemComponents.includes(nameResult.name)) {
|
||||
if (partialUpdateConfig.partialUpdateMode && ItemComponents.includes(nameResult.name)) {
|
||||
processItemComponent(node, nameResult, innerCompStatements, log);
|
||||
} else if (sdkVersion.compatibleSdkVersion === 9 && TABCONTENT_COMPONENT.includes(nameResult.name)) {
|
||||
} else if (partialUpdateConfig.partialUpdateMode && TABCONTENT_COMPONENT.includes(nameResult.name)) {
|
||||
processTabContent(node, innerCompStatements, log);
|
||||
} else {
|
||||
processNormalComponent(node, nameResult, innerCompStatements, log, parent);
|
||||
@@ -492,7 +492,7 @@ function processInnerCompStatements(
|
||||
newStatements: ts.Statement[],
|
||||
node: ts.Statement
|
||||
): void {
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
innerCompStatements.push(...newStatements);
|
||||
} else {
|
||||
innerCompStatements.push(createComponentCreationStatement(node, newStatements));
|
||||
@@ -1086,7 +1086,7 @@ function processForEachBlock(node: ts.CallExpression, log: LogInfo[],
|
||||
const blockNode: ts.Block = ts.factory.createBlock([statement], true);
|
||||
// @ts-ignore
|
||||
statement.parent = blockNode;
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
return ts.factory.updateArrowFunction(
|
||||
arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters,
|
||||
arrowNode.type, arrowNode.equalsGreaterThanToken, processComponentBlock(blockNode, isLazy, log));
|
||||
@@ -1094,7 +1094,7 @@ function processForEachBlock(node: ts.CallExpression, log: LogInfo[],
|
||||
return processComponentBlock(blockNode, isLazy, log).statements;
|
||||
}
|
||||
} else {
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
return ts.factory.updateArrowFunction(
|
||||
arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters,
|
||||
arrowNode.type, arrowNode.equalsGreaterThanToken,
|
||||
@@ -1123,7 +1123,7 @@ function processIfStatement(node: ts.IfStatement, newStatements: ts.Statement[],
|
||||
const ifCreate: ts.ExpressionStatement = createIfCreate();
|
||||
const newIfNode: ts.IfStatement = processInnerIfStatement(node, 0, log, isInnerBuilder);
|
||||
const ifPop: ts.ExpressionStatement = createIfPop();
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
newStatements.push(ifCreate, newIfNode, ifPop);
|
||||
} else {
|
||||
newStatements.push(createComponentCreationStatement(node, [ifCreate, newIfNode]), ifPop);
|
||||
|
||||
@@ -112,7 +112,7 @@ import {
|
||||
LogInfo,
|
||||
hasDecorator
|
||||
} from './utils';
|
||||
import { sdkVersion } from '../main';
|
||||
import { partialUpdateConfig } from '../main';
|
||||
|
||||
export function processComponentClass(node: ts.StructDeclaration, context: ts.TransformationContext,
|
||||
log: LogInfo[], program: ts.Program): ts.ClassDeclaration {
|
||||
@@ -228,7 +228,7 @@ function processPropertyUnchanged(
|
||||
purgeVariableDepStatements: ts.Statement[],
|
||||
rerenderStatements: ts.Statement[]
|
||||
): void {
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
if(result.getPurgeVariableDepStatement()) {
|
||||
purgeVariableDepStatements.push(result.getPurgeVariableDepStatement());
|
||||
}
|
||||
@@ -245,7 +245,7 @@ function addIntoNewMembers(
|
||||
purgeVariableDepStatements: ts.Statement[],
|
||||
rerenderStatements: ts.Statement[]
|
||||
): void {
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
newMembers.unshift(
|
||||
addInitialParamsFunc(updateParamsStatements, parentComponentName),
|
||||
addPurgeVariableDepFunc(purgeVariableDepStatements)
|
||||
@@ -270,7 +270,7 @@ function addPropertyMember(item: ts.ClassElement, newMembers: ts.ClassElement[],
|
||||
let newType: ts.TypeNode;
|
||||
decoratorName = propertyItem.decorators[i].getText().replace(/\(.*\)$/, '').trim();
|
||||
let isLocalStorage: boolean = false;
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
newType = createTypeReference(decoratorName, type, log, program);
|
||||
} else {
|
||||
newType = createTypeReferencePU(decoratorName, type, log, program);
|
||||
@@ -522,7 +522,7 @@ export function createReference(node: ts.PropertyAssignment, log: LogInfo[]): ts
|
||||
pos: initExpression.getStart()
|
||||
});
|
||||
}
|
||||
} else if (sdkVersion.compatibleSdkVersion === 9 && isMatchInitExpression(initExpression) &&
|
||||
} else if (partialUpdateConfig.partialUpdateMode && isMatchInitExpression(initExpression) &&
|
||||
propParentComponent.includes(propertyName.escapedText.toString())) {
|
||||
initText = initExpression.name.escapedText.toString();
|
||||
}
|
||||
@@ -590,7 +590,7 @@ function addDeleteParamsFunc(statements: ts.PropertyDeclaration[]): ts.MethodDec
|
||||
statements.forEach((statement: ts.PropertyDeclaration) => {
|
||||
const name: ts.Identifier = statement.name as ts.Identifier;
|
||||
let paramsStatement: ts.ExpressionStatement;
|
||||
if (sdkVersion.compatibleSdkVersion === 9 && !statement.decorators) {
|
||||
if (partialUpdateConfig.partialUpdateMode && !statement.decorators) {
|
||||
paramsStatement = createParamsStatement(name);
|
||||
} else {
|
||||
paramsStatement = createParamsWithUnderlineStatement(name);
|
||||
@@ -606,11 +606,11 @@ function addDeleteParamsFunc(statements: ts.PropertyDeclaration[]): ts.MethodDec
|
||||
ts.factory.createIdentifier(CREATE_CONSTRUCTOR_DELETE_FUNCTION)),
|
||||
undefined, [ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(
|
||||
ts.factory.createThis(), ts.factory.createIdentifier(
|
||||
sdkVersion.compatibleSdkVersion === 8 ?
|
||||
!partialUpdateConfig.partialUpdateMode ?
|
||||
ABOUT_TO_BE_DELETE_FUNCTION_ID : ABOUT_TO_BE_DELETE_FUNCTION_ID__)),
|
||||
undefined, [])]));
|
||||
deleteStatements.push(defaultStatement);
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
const aboutToBeDeletedInternalStatement: ts.ExpressionStatement = createDeletedInternalStatement();
|
||||
deleteStatements.push(aboutToBeDeletedInternalStatement);
|
||||
}
|
||||
@@ -691,7 +691,7 @@ function validateHasController(componentName: ts.Identifier, checkController: Co
|
||||
}
|
||||
|
||||
function createHeritageClause(): ts.HeritageClause {
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
return ts.factory.createHeritageClause(
|
||||
ts.SyntaxKind.ExtendsKeyword,
|
||||
[ts.factory.createExpressionWithTypeArguments(ts.factory.createIdentifier(BASE_COMPONENT_NAME_PU), [])]
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
localStoragePropCollection
|
||||
} from './validate_ui_syntax';
|
||||
|
||||
import { sdkVersion } from '../main';
|
||||
import { partialUpdateConfig } from '../main';
|
||||
|
||||
export function getInitConstructor(members: ts.NodeArray<ts.Node>, parentComponentName: ts.Identifier
|
||||
): ts.ConstructorDeclaration {
|
||||
@@ -89,7 +89,7 @@ function initConstructorParams(node: ts.ConstructorDeclaration, parentComponentN
|
||||
}
|
||||
const localStorageNum: number = localStorageLinkCollection.get(parentComponentName.getText()).size +
|
||||
localStoragePropCollection.get(parentComponentName.getText()).size;
|
||||
const paramNames: Set<string> = sdkVersion.compatibleSdkVersion === 8 ? new Set([
|
||||
const paramNames: Set<string> = !partialUpdateConfig.partialUpdateMode ? new Set([
|
||||
COMPONENT_CONSTRUCTOR_ID,
|
||||
COMPONENT_CONSTRUCTOR_PARENT,
|
||||
COMPONENT_CONSTRUCTOR_PARAMS,
|
||||
@@ -131,7 +131,7 @@ function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.Param
|
||||
parameter = ts.factory.createParameterDeclaration(item.decorators, item.modifiers,
|
||||
item.dotDotDotToken, item.name, item.questionToken,
|
||||
ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(
|
||||
sdkVersion.compatibleSdkVersion === 8 ? BASE_COMPONENT_NAME : BASE_COMPONENT_NAME_PU), undefined),
|
||||
!partialUpdateConfig.partialUpdateMode ? BASE_COMPONENT_NAME : BASE_COMPONENT_NAME_PU), undefined),
|
||||
item.initializer);
|
||||
break;
|
||||
case COMPONENT_CONSTRUCTOR_PARAMS:
|
||||
@@ -180,7 +180,7 @@ export function addConstructor(ctorNode: any, watchMap: Map<string, ts.Node>,
|
||||
}
|
||||
|
||||
function createCallSuperStatement(localStorageNum: number): ts.Statement{
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
return ts.factory.createExpressionStatement(ts.factory.createCallExpression(
|
||||
ts.factory.createSuper(), undefined,
|
||||
localStorageNum ? [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_ID),
|
||||
@@ -202,7 +202,7 @@ function createUPdWithValStatement(): ts.Statement {
|
||||
ts.factory.createPropertyAccessExpression(
|
||||
ts.factory.createThis(),
|
||||
ts.factory.createIdentifier(
|
||||
sdkVersion.compatibleSdkVersion === 8 ?
|
||||
!partialUpdateConfig.partialUpdateMode ?
|
||||
COMPONENT_CONSTRUCTOR_UPDATE_PARAMS : COMPONENT_CONSTRUCTOR_INITIAL_PARAMS
|
||||
)
|
||||
),
|
||||
|
||||
@@ -93,7 +93,7 @@ import {
|
||||
import { transformLog } from './process_ui_syntax';
|
||||
import { globalProgram, projectConfig } from '../main';
|
||||
|
||||
import { sdkVersion } from '../main';
|
||||
import { partialUpdateConfig } from '../main';
|
||||
|
||||
export type ControllerType = {
|
||||
hasController: boolean
|
||||
@@ -254,7 +254,7 @@ export function processMemberVariableDecorators(parentName: ts.Identifier,
|
||||
createVariableInitStatement(item, COMPONENT_NON_DECORATOR, log, program, context, hasPreview,
|
||||
interfaceNode)]));
|
||||
updateResult.setControllerSet(createControllerSet(item, parentName, name, checkController));
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
updateResult.setDeleteParams(true);
|
||||
}
|
||||
} else if (!item.type) {
|
||||
@@ -361,7 +361,7 @@ function processStateDecorators(node: ts.PropertyDeclaration, decorator: string,
|
||||
if (setUpdateParamsDecorators.has(decorator)) {
|
||||
updateResult.setUpdateParams(createUpdateParams(name, decorator));
|
||||
}
|
||||
if (sdkVersion.compatibleSdkVersion === 9 && BASICDECORATORS.has(decorator)) {
|
||||
if (partialUpdateConfig.partialUpdateMode && BASICDECORATORS.has(decorator)) {
|
||||
const variableWithUnderLink: string = '__' + name.escapedText.toString();
|
||||
updateResult.setDecoratorName(decorator);
|
||||
updateResult.setPurgeVariableDepStatement(createPurgeVariableDepStatement(variableWithUnderLink));
|
||||
@@ -450,17 +450,17 @@ function createVariableInitStatement(node: ts.PropertyDeclaration, decorator: st
|
||||
break;
|
||||
case COMPONENT_STATE_DECORATOR:
|
||||
case COMPONENT_PROVIDE_DECORATOR:
|
||||
updateState = sdkVersion.compatibleSdkVersion === 8 ?
|
||||
updateState = !partialUpdateConfig.partialUpdateMode ?
|
||||
updateObservedProperty(node, name, type, program) : updateObservedPropertyPU(node, name, type, program);
|
||||
break;
|
||||
case COMPONENT_LINK_DECORATOR:
|
||||
wrongDecoratorInPreview(node, COMPONENT_LINK_DECORATOR, hasPreview, log);
|
||||
updateState = sdkVersion.compatibleSdkVersion === 8 ?
|
||||
updateState = !partialUpdateConfig.partialUpdateMode ?
|
||||
updateSynchedPropertyTwoWay(name, type, program) : updateSynchedPropertyTwoWayPU(name, type, program);
|
||||
break;
|
||||
case COMPONENT_PROP_DECORATOR:
|
||||
wrongDecoratorInPreview(node, COMPONENT_PROP_DECORATOR, hasPreview, log);
|
||||
updateState = sdkVersion.compatibleSdkVersion === 8
|
||||
updateState = !partialUpdateConfig.partialUpdateMode
|
||||
? updateSynchedPropertyOneWay(name, type, decorator, log, program)
|
||||
: updateSynchedPropertyOneWayPU(name, type, decorator, log, program);
|
||||
break;
|
||||
@@ -471,7 +471,7 @@ function createVariableInitStatement(node: ts.PropertyDeclaration, decorator: st
|
||||
updateState = updateStoragePropAndLinkProperty(node, name, setFuncName, log);
|
||||
break;
|
||||
case COMPONENT_OBJECT_LINK_DECORATOR:
|
||||
updateState = sdkVersion.compatibleSdkVersion === 8
|
||||
updateState = !partialUpdateConfig.partialUpdateMode
|
||||
? updateSynchedPropertyNesedObject(name, type, decorator, log)
|
||||
: updateSynchedPropertyNesedObjectPU(name, type, decorator, log);
|
||||
break;
|
||||
@@ -510,7 +510,7 @@ function createUpdateParams(name: ts.Identifier, decorator: string): ts.Statemen
|
||||
updateParamsNode = createUpdateParamsWithIf(name);
|
||||
break;
|
||||
case COMPONENT_PROP_DECORATOR:
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
updateParamsNode = createUpdateParamsWithoutIf(name);
|
||||
}
|
||||
break;
|
||||
@@ -662,7 +662,7 @@ function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaratio
|
||||
}
|
||||
|
||||
export function createViewCreate(node: ts.NewExpression | ts.Identifier): ts.CallExpression {
|
||||
if (sdkVersion.compatibleSdkVersion === 9) {
|
||||
if (partialUpdateConfig.partialUpdateMode) {
|
||||
return createFunction(ts.factory.createIdentifier(BASE_COMPONENT_NAME_PU),
|
||||
ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), ts.factory.createNodeArray([node]));
|
||||
}
|
||||
@@ -691,7 +691,7 @@ function addCustomComponentId(node: ts.NewExpression, componentName: string,
|
||||
if (!argumentsArray) {
|
||||
argumentsArray = [ts.factory.createObjectLiteralExpression([], true)];
|
||||
}
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
++componentInfo.id;
|
||||
argumentsArray.unshift(isInnerBuilder ? ts.factory.createBinaryExpression(
|
||||
ts.factory.createStringLiteral(path.basename(transformLog.sourceFile.fileName, EXTNAME_ETS) + '_'),
|
||||
|
||||
@@ -71,7 +71,7 @@ import {
|
||||
createFunction
|
||||
} from './utils';
|
||||
import { bindComponentAttr } from './process_component_build';
|
||||
import { sdkVersion } from '../main';
|
||||
import { partialUpdateConfig } from '../main';
|
||||
|
||||
const localArray: string[] = [...observedPropertyDecorators, COMPONENT_NON_DECORATOR,
|
||||
COMPONENT_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR];
|
||||
@@ -163,7 +163,7 @@ function addCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Stat
|
||||
function addCustomComponentStatements(node: ts.ExpressionStatement, newStatements: ts.Statement[],
|
||||
newNode: ts.NewExpression, name: string, props: ts.ObjectLiteralElementLike[],
|
||||
isInnerBuilder: boolean = false): void {
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
const id: string = componentInfo.id.toString();
|
||||
newStatements.push(createFindChildById(id, name, isInnerBuilder), createCustomComponentIfStatement(id,
|
||||
ts.factory.updateExpressionStatement(node, createViewCreate(newNode)),
|
||||
@@ -402,9 +402,9 @@ function isCorrectInitFormParent(parent: string, child: string): boolean {
|
||||
}
|
||||
break;
|
||||
case COMPONENT_OBJECT_LINK_DECORATOR:
|
||||
if (sdkVersion.compatibleSdkVersion === 8 && parent === COMPONENT_STATE_DECORATOR) {
|
||||
if (!partialUpdateConfig.partialUpdateMode && parent === COMPONENT_STATE_DECORATOR) {
|
||||
return true;
|
||||
} else if (sdkVersion.compatibleSdkVersion === 9 && STATE_OBJECTLINK_DECORATORS.includes(parent)) {
|
||||
} else if (partialUpdateConfig.partialUpdateMode && STATE_OBJECTLINK_DECORATORS.includes(parent)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -89,7 +89,7 @@ import {
|
||||
import {
|
||||
resources,
|
||||
projectConfig,
|
||||
sdkVersion
|
||||
partialUpdateConfig
|
||||
} from '../main';
|
||||
import { createCustomComponentNewExpression, createViewCreate } from './process_component_member';
|
||||
|
||||
@@ -120,7 +120,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function {
|
||||
});
|
||||
GLOBAL_STYLE_FUNCTION.clear();
|
||||
const statements: ts.Statement[] = Array.from(node.statements);
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
generateId(statements, node);
|
||||
}
|
||||
INTERFACE_NODE_SET.forEach(item => {
|
||||
@@ -588,7 +588,7 @@ export function isExtendFunction(node: ts.FunctionDeclaration): string {
|
||||
function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext): ts.SourceFile {
|
||||
if (componentCollection.previewComponent.size === 0 || !projectConfig.isPreview) {
|
||||
if (componentCollection.entryComponent) {
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
const entryNode: ts.ExpressionStatement =
|
||||
createEntryFunction(componentCollection.entryComponent, context) as ts.ExpressionStatement;
|
||||
return context.factory.updateSourceFile(node, [...node.statements, entryNode]);
|
||||
@@ -632,7 +632,7 @@ function createEntryFunction(name: string, context: ts.TransformationContext)
|
||||
if (localStorageName) {
|
||||
newArray.push(context.factory.createIdentifier(localStorageName));
|
||||
}
|
||||
if (sdkVersion.compatibleSdkVersion === 8) {
|
||||
if (!partialUpdateConfig.partialUpdateMode) {
|
||||
const newExpressionStatement: ts.ExpressionStatement =
|
||||
context.factory.createExpressionStatement(context.factory.createCallExpression(
|
||||
context.factory.createIdentifier(PAGE_ENTRY_FUNCTION_NAME), undefined,
|
||||
|
||||
@@ -36,7 +36,7 @@ const {
|
||||
SYSTEM_PLUGIN
|
||||
} = require('../lib/pre_define');
|
||||
const {
|
||||
sdkVersion
|
||||
partialUpdateConfig
|
||||
} = require('../main');
|
||||
|
||||
function expectActual(name, filePath) {
|
||||
@@ -64,7 +64,7 @@ function expectActual(name, filePath) {
|
||||
mocha.describe('compiler', () => {
|
||||
let utPath = path.resolve(__dirname, './ut');
|
||||
if (process.argv.includes('--partialUpdate')) {
|
||||
sdkVersion.compatibleSdkVersion = 9;
|
||||
partialUpdateConfig.partialUpdateMode = true;
|
||||
utPath = path.resolve(__dirname, './utForPartialUpdate');
|
||||
}
|
||||
const utFiles = [];
|
||||
|
||||
Reference in New Issue
Block a user