@beyond-js/bundles-sdk
Version:
BeyondJS Bundles SDK
81 lines (65 loc) • 2.28 kB
JavaScript
const Files = require('./files-overwrites/files');
const Overwrites = require('./files-overwrites/overwrites');
const Extensions = require('./extensions');
/**
* Processor sources
*/
module.exports = class {
get processor() {
return this.
}
get files() {
return this.
}
get overwrites() {
return this.
}
get extensions() {
return this.
}
get options() {
return this.
}
get hashes() {
return this.
}
/**
* Processor sources constructor
*
* @param processor {object} The processor packager
*/
constructor(processor) {
this.
if (!processor.meta.sources) throw new Error(`Processor sources specification must be defined`);
let {extname} = processor.meta.sources;
extname = typeof extname === 'string' ? [extname] : extname;
if (!(extname instanceof Array)) throw new Error(`Processor extname sources specification is invalid`);
const {bundle} = processor.specs;
// Create the overwrites instance only if the processor specifies that it uses overwrites
// Do not create the overwrites instance if it is a template (template.processors)
const overwrites = processor.meta.sources.overwrites && !bundle.type.startsWith('template/');
this.
this.
this.
const {options} = processor.meta;
const Options = options ? (options.Options ? options.Options : require('./options')) : void 0;
this.
let {Hashes} = processor.meta.sources;
Hashes = Hashes ? Hashes : require('./hashes');
this.
}
configure(path, config) {
this.
}
destroy() {
this.
this.
this.
}
}