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/BrowserSync.js
const { Component } = require('./Component');

/** @typedef {import('../../types/browsersync').Options} BrowserSyncOptions */

module.exports = class BrowserSync extends Component {
    requiresReload = true;

    /** @type {BrowserSyncOptions} */
    userConfig = {};

    /**
     * Required dependencies for the component.
     */
    dependencies() {
        return ['browser-sync', 'browser-sync-webpack-plugin@^2.3.0'];
    }

    /**
     * Register the component.
     *
     * @param {string|BrowserSyncOptions} userConfig
     */
    register(userConfig) {
        this.userConfig =
            typeof userConfig == 'string' ? { proxy: userConfig } : userConfig;
    }

    /**
     * webpack plugins to be appended to the master config.
     */
    webpackPlugins() {
        let BrowserSyncPlugin = require('browser-sync-webpack-plugin');

        return [new BrowserSyncPlugin(this.config(), { reload: false })];
    }

    /**
     * The regex used to determine where the Browsersync
     * javascript snippet is injected onto each page.
     */
    regex() {
        return RegExp('(</body>|</pre>)(?!.*(</body>|</pre>))', 'is');
    }

    /**
     * Build the BrowserSync configuration.
     */
    config() {
        let userConfig = this.userConfig;
        let defaultConfig = {
            host: 'localhost',
            port: 3000,
            proxy: 'app.test',
            files: [
                'app/**/*.php',
                'resources/views/**/*.php',
                `${this.context.config.publicPath || 'public'}/**/*.(js|css)`
            ],
            snippetOptions: {
                rule: {
                    match: this.regex(),
                    fn: function (snippet, match) {
                        return snippet + match;
                    }
                }
            }
        };

        if (userConfig && userConfig.server) {
            delete defaultConfig.proxy;
        }

        return Object.assign(defaultConfig, userConfig);
    }
};