1/* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import typescript from '@rollup/plugin-typescript'; 17import { nodeResolve } from '@rollup/plugin-node-resolve'; 18 19export default { 20 input: 'src/arkui_transformer.ts', 21 output: { 22 file: 'build/arkui_transformer.js', 23 format: 'commonjs', 24 sourcemap: true, 25 banner: [ 26 "#!/usr/bin/env node", 27 APACHE_LICENSE_HEADER() 28 ].join("\n"), 29 }, 30 external: ["commander", "typescript"], 31 plugins: [ 32 typescript({ 33 tsconfig: './tsconfig.json' 34 }), 35 nodeResolve({ 36 extensions: ['.ts'], 37 preferBuiltins: true 38 }), 39 ] 40}; 41 42 43function APACHE_LICENSE_HEADER() { 44 return ` 45/** 46* @license 47* Copyright (c) ${new Date().getUTCFullYear()} Huawei Device Co., Ltd. 48* Licensed under the Apache License, Version 2.0 (the "License"); 49* you may not use this file except in compliance with the License. 50* You may obtain a copy of the License at 51* 52* http://www.apache.org/licenses/LICENSE-2.0 53* 54* Unless required by applicable law or agreed to in writing, software 55* distributed under the License is distributed on an "AS IS" BASIS, 56* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 57* See the License for the specific language governing permissions and 58* limitations under the License. 59*/ 60 61` 62}