Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Packager = require('parcel-bundler').Packager;
class UrlsPackager extends Packager {
addAsset(asset) {
return this.write(asset.generated.urls);
}
}
module.exports = UrlsPackager;
const Packager = require('parcel-bundler').Packager;
class JSONPackager extends Packager {
constructor(...args) {
super(...args);
this.combinedAst = {};
}
addAsset(asset) {
if(!asset.generated.json)
throw new Error(`JSON missing in parsed asset: ${asset.relativeName}; got ${Object.keys(asset.generated).join(',')}`);
try {
Object.assign(this.combinedAst, JSON.parse(asset.generated.json));
} catch (e) {
e.message = `In ${asset.name}: ${e.message}:\n${asset.generated.json}`;
throw e;
}