2024-09-27 17:00:13 +08:00
|
|
|
import { createRequire } from 'node:module';
|
2023-10-13 20:11:41 +08:00
|
|
|
import copy from 'rollup-plugin-copy';
|
2024-03-22 22:46:32 +08:00
|
|
|
import svg from 'rollup-plugin-svg-import';
|
2023-10-13 20:11:41 +08:00
|
|
|
|
2025-06-12 21:25:16 +08:00
|
|
|
import { cjsOutput, entryPoint, esmOutput, plugins } from '../rollup.config.parts';
|
2025-02-25 16:11:09 +08:00
|
|
|
|
2024-09-27 17:00:13 +08:00
|
|
|
const rq = createRequire(import.meta.url);
|
|
|
|
const icons = rq('../../public/app/core/icons/cached.json');
|
|
|
|
const pkg = rq('./package.json');
|
2019-02-21 17:58:28 +08:00
|
|
|
|
2023-10-13 20:11:41 +08:00
|
|
|
const iconSrcPaths = icons.map((iconSubPath) => {
|
2025-05-12 17:34:17 +08:00
|
|
|
// eslint-disable-next-line @grafana/no-restricted-img-srcs
|
2023-10-13 20:11:41 +08:00
|
|
|
return `../../public/img/icons/${iconSubPath}.svg`;
|
|
|
|
});
|
|
|
|
|
2022-08-03 21:47:09 +08:00
|
|
|
export default [
|
|
|
|
{
|
2025-02-25 16:11:09 +08:00
|
|
|
input: entryPoint,
|
2023-10-13 20:11:41 +08:00
|
|
|
plugins: [
|
2025-02-25 16:11:09 +08:00
|
|
|
...plugins,
|
2024-03-22 22:46:32 +08:00
|
|
|
svg({ stringify: true }),
|
2023-10-13 20:11:41 +08:00
|
|
|
copy({
|
|
|
|
targets: [{ src: iconSrcPaths, dest: './dist/public/' }],
|
|
|
|
flatten: false,
|
|
|
|
}),
|
|
|
|
],
|
2025-02-25 16:11:09 +08:00
|
|
|
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-ui')],
|
2025-07-24 16:54:02 +08:00
|
|
|
treeshake: false,
|
2022-08-03 21:47:09 +08:00
|
|
|
},
|
2025-03-04 16:55:41 +08:00
|
|
|
{
|
|
|
|
input: 'src/unstable.ts',
|
|
|
|
plugins: [
|
|
|
|
...plugins,
|
|
|
|
svg({ stringify: true }),
|
|
|
|
copy({
|
|
|
|
targets: [{ src: iconSrcPaths, dest: './dist/public/' }],
|
|
|
|
flatten: false,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-ui')],
|
2025-07-24 16:54:02 +08:00
|
|
|
treeshake: false,
|
2025-03-04 16:55:41 +08:00
|
|
|
},
|
2022-08-03 21:47:09 +08:00
|
|
|
];
|