Skip to content

Commit fc08009

Browse files
feat: added an info message to warn about the usage of this plugin
1 parent 7762042 commit fc08009

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/plugin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import type FastGlob from 'fast-glob';
55

66
const pluginName = 'rollup-plugin-multi-input';
77

8+
const doYouNeedRollupMessage = `
9+
\u001b[31mATTENTION:\u001b[0m Do you still need \u001b[34m${pluginName}\u001b[0m?
10+
Since Rollup 3, the \u001b[32m[preserveModules](https://rollupjs.org/configuration-options/#output-preservemodules)\u001b[0m
11+
and \u001b[32m[preserveModulesRoot](https://rollupjs.org/configuration-options/#output-preservemodulesroot)\u001b[0m options are available,
12+
which can often eliminate the necessity of \u001b[34m${pluginName}\u001b[0m.
13+
`;
814
const isString = (value: any): value is string => typeof value === 'string';
915

1016
/**
@@ -38,6 +44,11 @@ const multiInput = (options: MultiInputOptions = defaultOptions): Plugin => {
3844
} = options;
3945
return ({
4046
name: pluginName,
47+
buildStart() {
48+
if (this.info) {
49+
this.info(doYouNeedRollupMessage);
50+
}
51+
},
4152
options(conf) {
4253
// flat to enable input to be a string or an array
4354
const inputs = [conf.input].flat();

0 commit comments

Comments
 (0)