mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-19 16:43:34 -04:00
c120766ac7
Signed-off-by: zhangrengao <zhangrengao1@huawei.com> Change-Id: Ib47c77cf607a8a4af4240e22d8196fd8a350149c
35 lines
1.2 KiB
TypeScript
35 lines
1.2 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 path from 'path';
|
|
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) {
|
|
if (process.env.processTs && process.env.processTs === 'false') {
|
|
writeFileSyncByNode(node, false);
|
|
}
|
|
return node;
|
|
} else {
|
|
return node;
|
|
}
|
|
|
|
}
|
|
}
|
|
} |