mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-27 01:30:35 +01:00
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
|
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);
|
||
|
},
|
||
|
};
|