1// Copyright 2024 The Pigweed Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); you may not 4// use this file except in compliance with the License. You may obtain a copy of 5// the License at 6// 7// https://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, WITHOUT 11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12// License for the specific language governing permissions and limitations under 13// the License. 14 15import commonjs from '@rollup/plugin-commonjs'; 16import resolve from '@rollup/plugin-node-resolve'; 17import pluginTypescript from '@rollup/plugin-typescript'; 18import path from 'path'; 19import sourceMaps from 'rollup-plugin-sourcemaps'; 20 21export default [ 22 // // Bundle proto collection script 23 { 24 input: path.join('pw_protobuf_compiler', 'ts', 'build_default_protos.ts'), 25 output: [ 26 { 27 file: path.join('dist', 'bin', 'build_default_protos.js'), 28 format: 'cjs', 29 banner: '#!/usr/bin/env node\n\nconst window = null;', 30 }, 31 ], 32 plugins: [ 33 pluginTypescript({ 34 tsconfig: './tsconfig.json', 35 exclude: ['**/*_test.ts'], 36 }), 37 resolve(), 38 commonjs(), 39 40 // Resolve source maps to the original source 41 sourceMaps(), 42 ], 43 }, 44 { 45 input: path.join('pw_protobuf_compiler', 'ts', 'build_cli.ts'), 46 output: [ 47 { 48 file: path.join('dist', 'bin', 'pw_protobuf_compiler.js'), 49 format: 'cjs', 50 banner: '#!/usr/bin/env node\n\nconst window = null;', 51 }, 52 ], 53 plugins: [ 54 pluginTypescript({ 55 tsconfig: './tsconfig.json', 56 exclude: ['**/*_test.ts'], 57 }), 58 resolve(), 59 commonjs(), 60 61 // Resolve source maps to the original source 62 sourceMaps(), 63 ], 64 }, 65]; 66