
| Current Path : /var/www/html/pallets/web/core/scripts/js/assets/process/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/pallets/web/core/scripts/js/assets/process/map.js |
/**
* Process map files.
*
* In the `sources` member, remove all "../" values at the start of the file
* names to avoid virtual files located outside of the library vendor folder.
*
* @param {object} data
* Object passed to the callback.
* @param {string} data.contents
* Content of the file being processed.
*
* @return {Promise<[{contents: string}]>}
* Return a Promise that resolves into an array of file and content to create
* in the assets/vendor/ directory.
*/
module.exports = ({ contents }) => {
const json = JSON.parse(contents);
json.sources = json.sources.map((source) => source.replace(/^(\.\.\/)+/, ''));
return [{ contents: JSON.stringify(json) }];
};