exports_base.js

/**
 * @file exports/base.js
 * @copyright @spmhome @_2025
 * @author Scott Meesseman @spmeesseman
 *//** */

const WpwModule = require("../core/module");

// const ABSTRACT_ERROR = SpmhMessage.Code.ERROR_ABSTRACT_FUNCTION;


/**
 * @abstract
 * @augments WpwModule
 */
class WpwWebpackExport extends WpwModule
{
    /**
     * @override
     * @type {WpwModuleType}
     */
    type = "export";

    /**
     * @type {boolean | undefined}
     */
    hasPluginHooks;


    /**
     * @param {WpwExportOptions} options Plugin options to be applied
     */
	constructor(options)
    {
        super({ type: "export", ...options });
        this.hasPluginHooks = options.hasPluginHooks;
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    app(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][app]` });
    }


	/**
	 * @protected
     * @param {WpwBuild} _build
	 */
	base(_build) {}


	/**
	 * @protected
     * @param {WpwBuild} _build
	 */
	baseDone(_build) {}


	/**
     * @override
	 * @protected
     * @param {WpwBuild} _build
	 */
	create(_build)
	{
        this.base(this.build);
		this[this.build.type](this.build);
		this.baseDone(this.build);
	}


	/**
	 * @private
     * @param {WpwBuild} build
	 */
	doc(build)
    {
        const options = this.build.options.doc;
        if (options)
        {
            if (options.doxygen) {
                this.doxygen(build);
            }
            if (options.extjsdoc) {
                this.extjsdoc(build);
            }
            if (options.jsdoc) {
                this.jsdoc(build);
            }
        }
    }


	/**
	 * @protected
     * @param {WpwBuild} _build
	 */
	doxygen(_build)
    {
       // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][doxygen]` });
    }


	/**
	 * @protected
     * @param {WpwBuild} _build
	 */
	extjsdoc(_build)
    {
       // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][doxygen]` });
    }


    /**
     * @override
     * @param {string} message
     * @param {SpmhErrorCode | null} [code]
     * @param {Error | undefined} [exception]
     * @returns {WpwBaseMessageInfo}
     */
    getErrorDefaultCfg(message, code, exception)
    {
        return this._obj_.apply(super.getErrorDefaultCfg(message, code, exception),
        {
            code: code || this.MsgCode.ERROR_EXPORT_FAILED
        });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    jsdoc(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][jsdoc]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    lib(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][lib]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    plugin(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][lib]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    resource(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][resource]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    schema(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][schema]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    script(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][script]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    tests(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][tests]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    types(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][types]` });
    }


    /**
     * @protected
     * @param {WpwBuild} _build
     */
    webapp(_build)
    {
        // this.build.addMessage({ code: ABSTRACT_ERROR, message: `name[${this.name}][build][webapp]` });
    }


    /**
     * Wraps a vendor plugin to give it access to the WpwBuild instance, and couples it with
     * the the WpwPlugin instance.
     *
     * @override
     * @param {WpwBuild} build
     * @param {Array<boolean | string | undefined>} [xEnabledFlags]
     * @returns {WpwWebpackExport | undefined}
     */
    static wrap(build, ...xEnabledFlags) { return super.wrap.call(this, build, "isExport", ...xEnabledFlags); }
}


module.exports = WpwWebpackExport;