HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/alq-cali.bikenow.co/node_modules/laravel-mix/src/components/Define.js
const { Component } = require('./Component');

/** @typedef {undefined | null | string | number | bigint | boolean} CodeValuePrimitive */
/** @typedef {() => CodeValuePrimitive} LazyCodeValue */
/** @typedef {CodeValuePrimitive | LazyCodeValue} CodeValue */

module.exports = class Define extends Component {
    /**
     * @type {Record<string, CodeValue>}
     * @internal
     **/
    definitions = {};

    /**
     *
     * @param {Record<string, CodeValue>} definitions
     */
    register(definitions) {
        this.definitions = {
            ...this.definitions,
            ...definitions
        };
    }

    /** @internal */
    get defaults() {
        return {
            'import.meta.env.PROD': () => this.context.api.inProduction(),
            'import.meta.env.DEV': () => !this.context.api.inProduction()
        };
    }

    /**
     * @param {Record<string, CodeValue>} definitions
     */
    resolve(definitions) {
        for (const [key, value] of Object.entries(definitions)) {
            if (typeof value === 'function') {
                definitions[key] = value();
            }
        }

        return definitions;
    }

    webpackPlugins() {
        const { DefinePlugin } = require('webpack');

        return [
            new DefinePlugin(
                this.resolve({
                    ...this.defaults,
                    ...this.definitions
                })
            )
        ];
    }
};