| import resolve from 'rollup-plugin-node-resolve' |
| import commonjs from 'rollup-plugin-commonjs' |
| import sourceMaps from 'rollup-plugin-sourcemaps' |
| import typescript from 'rollup-plugin-typescript2' |
| import json from 'rollup-plugin-json' |
| import replace from '@rollup/plugin-replace' |
|
|
| const pkg = require('./package.json') |
|
|
| export default [ |
| { |
| input: `src/index.ts`, |
| output: [ |
| |
| { file: pkg.main, format: 'es', sourcemap: true }, |
| ], |
| |
| external: ['path'], |
| watch: { |
| include: 'src/**', |
| }, |
| plugins: [ |
| |
| json(), |
| |
| typescript({ useTsconfigDeclarationDir: true }), |
| |
| commonjs(), |
| |
| |
| |
| replace({ |
| 'preventAssignment': true, |
| 'node:crypto': 'crypto', |
| 'delimiters': ['"', '"'], |
| }), |
| resolve({ |
| browser: true, |
| }), |
|
|
| |
| sourceMaps(), |
| ], |
| }, |
| { |
| input: `src/node/index.ts`, |
| output: [{ file: 'dist/node/index.cjs.js', format: 'cjs', sourcemap: true }], |
| |
| external: [ |
| 'fs/promises', |
| 'path', |
| 'pacote', |
| '@types/pacote', |
| '@npmcli/arborist', |
| 'ulidx', |
| 'node-fetch', |
| 'fs', |
| 'request', |
| 'crypto', |
| 'url', |
| 'http', |
| 'os', |
| 'util', |
| 'child_process', |
| ], |
| watch: { |
| include: 'src/node/**', |
| }, |
| plugins: [ |
| |
| json(), |
| |
| typescript({ useTsconfigDeclarationDir: true }), |
| |
| commonjs(), |
| |
| |
| |
| resolve(), |
|
|
| |
| sourceMaps(), |
| ], |
| }, |
| ] |
|
|