Files
developtools_ace-ets2bundle/compiler/src/process_js_ast.ts
T
zhangrengao 8d83033839 fix pr issue
Signed-off-by: zhangrengao <zhangrengao1@huawei.com>
Change-Id: I0815b0f0c28aeeebfad97b4fc6ced1e607163512
2022-06-07 14:20:46 +08:00

34 lines
1.1 KiB
TypeScript

/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ts from 'typescript';
import {
BUILD_ON
} from './pre_define';
import { writeFileSyncByNode } from './utils';
export function processJs(program: ts.Program, ut = false): Function {
return (context: ts.TransformationContext) => {
return (node: ts.SourceFile) => {
if (process.env.compiler === BUILD_ON) {
writeFileSyncByNode(node, false);
return node;
} else {
return node;
}
};
};
}