magic-nix-cache-action/rollup.config.js

48 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
const nodeModules = path.dirname(fileURLToPath(import.meta.url)) + '/node_modules';
export default {
input: './src/index.ts',
output: {
file: './dist/index.js',
format: 'es',
},
plugins: [
typescript({
noEmitOnError: true,
}),
nodeResolve({
exportConditions: ['node', 'default', 'module', 'require'],
}),
commonjs(),
],
onwarn(warning, warn) {
const allowlist = {
'CIRCULAR_DEPENDENCY': [
// core.ts -> oidc-utils.ts -> core.ts
nodeModules + '/@actions/core/lib/',
],
'THIS_IS_UNDEFINED': [
// __classPrivateField{Get,Set} generated by TypeScript
nodeModules + '/form-data-encoder/lib/',
],
};
if (allowlist.hasOwnProperty(warning.code)) {
for (const exception of allowlist[warning.code]) {
const ids = warning.ids || [ warning.id ];
if (ids.filter(p => !p.startsWith(exception)).length === 0) {
return;
}
}
}
warn(warning);
},
};