Releases: shuizhongyueming/rollup-plugin-output-manifest
Add support to output Assets
New Feature
more powerful options.filter
In Version 1.x, this plugin will filter out only the OutputChunk
of entry before the options.filter
this make it impossible to add custom support for OutputAsset
.
In this update, we move the pre filter logic intodefaultFilter
and make OutputAsset
pass in as default. So developers can use options.map
and options.filter
to add support the output of assets.
options.keyValueDecorator
In Version 1.x, the logic of keyValueDecorator is unchangable for developer. We make it as an option at this version. To make it work, we add an extra opt param for options.generate, and it will trans the opt param to options.keyValueDecorator
import outputManifest, {defaultKeyValueDecorator} from 'rollup-plugin-output-manifest'
outputManifest({
keyValueDecorator: (k, v, opt) => {
const res = defaultKeyValueDecorator(k,v,opt);
Object.keys(res).forEach(k => {
res[k.toUpperCase()] = res[k];
delete res[k];
});
return res;
}
})
Breaking Change
nameSuffix has no default value of .js
For the support of output multi kinds file, we can't force nameSuffix to only one kinds of file.
But we add a new option: nameWithExt, which will auto add correct ext for name from the output file name;
If you haven't use the option, nothing will bother you.
options.filter
, options.map
and options.sort
need to handle the Bundle
type
type Bundle = OutputChunk | OutputAsset;
So, if you have configed this options, you need to make some change.
We have add two function: isAsset
and isChunk
to help identifier different Bundle
import outputManifest, {isAsset} from 'rollup-plugin-output-manifest'
outputManifest({
fileName: "manifest.json",
filter: bundle => {
if (isAsset(bundle)) {
//...
}
},
map: bundle => {
if (isAsset(bundle) && !bundle.name) {
// do some
}
return bundle;
}
});