<commit_before>/**
 * Plugin Setup: Browsersync
 *
 * @module setup/plugins/browser-sync
 * @example {@lang javascript}
 * const PluginBrowserSync = require('./plugins/browser-sync');
 * const pluginBrowserSync = new PluginBrowserSync(options, assets);
 *
 * @see {@link https://www.browsersync.io/|Official Site}
 * @see {@link https://www.browsersync.io/docs/options/|Avaliable Options}
 * @see {@link https://github.com/browsersync/browser-sync/|Github}
 */
class PluginBrowserSync {
  constructor(options, assets) {
    const argv = options.argv || {};
    const pref = assets.getPreference();

    const server = pref.server || {};
    const port = argv.port || server.port;
    const isHttps = server.https;

    this.port = port;
    this.server = {
      baseDir: assets.dist,
      index: server.index,
    };
    this.https = isHttps;
    this.ui = {
      port: port + 1,
    };
    this.startPath = pref.root;

    if (!port) {
      delete this.port;
      delete this.ui.port;
    }
  }
}

module.exports = PluginBrowserSync;
<commit_msg>Refactoring<commit_after>/**
 * Plugin Setup: Browsersync
 *
 * @module setup/plugins/browser-sync
 *
 * @example {@lang javascript}
 * const PluginBrowserSync = require('./plugins/browser-sync');
 * const pluginBrowserSync = new PluginBrowserSync(options, assets);
 *
 * @see {@link https://www.browsersync.io/|Official Site}
 * @see {@link https://www.browsersync.io/docs/options/|Avaliable Options}
 * @see {@link https://github.com/browsersync/browser-sync/|Github}
 */
class PluginBrowserSync {
  constructor(options, assets) {
    const argv = options.argv || {};
    const pref = assets.getPreference();

    const server = pref.server || {};
    const port = argv.port || server.port;
    const isHttps = server.https;

    this.port = port;
    this.server = {
      baseDir: assets.dist,
      index: server.index,
    };
    this.https = isHttps;
    this.ui = {
      port: port + 1,
    };
    this.startPath = pref.root;

    if (!port) {
      delete this.port;
      delete this.ui.port;
    }
  }
}

module.exports = PluginBrowserSync;

{'fraction_non_alphanumeric': 0.1486935866983373, 'fraction_numerical': 0.0009501187648456057, 'mean_word_length': 2.9962049335863377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3014795', 'n_tokens_mistral': 699, 'n_tokens_neox': 680, 'n_words': 142}