HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
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: //usr/share/nodejs/@popperjs/bundle/index.js
const { rollup, watch } = require('rollup');
const rimraf = require('rimraf');
const { argv } = require('yargs');

// Plugins
const babel = require('rollup-plugin-babel');
const babili = require('rollup-plugin-babel-minify');
const watchEnabled = argv.watch;

// Configs
const babelConfig = require('@popperjs/babel-config');
const sourcemap = true;
const external = ['popper.js'];
const globals = { 'popper.js': 'Popper' };

function bundle({ input, file, name, banner, miniBanner }) {
  rimraf.sync('dist');
  const minifyOptions = {
    comments: false,
    banner: miniBanner,
    mangle: { topLevel: true },
  };

  rollup({
    input,
    plugins: [babel(babelConfig.es6)],
    external,
  }).then(bundle => {
    bundle.write({
      format: 'es',
      file: `dist/${file}`,
      sourcemap,
      globals,
      banner,
    });
  });

  rollup({
    input,
    plugins: [babili(minifyOptions), babel(babelConfig.es6)],
    external,
  }).then(bundle => {
    bundle.write({
      format: 'es',
      file: `dist/${file.replace('.js', '.min.js')}`,
      sourcemap,
      globals,
    });
  });

  rollup({
    input,
    plugins: [babel(babelConfig.es5)],
    external,
  }).then(bundle => {
    bundle.write({
      format: 'umd',
      file: `dist/umd/${file}`,
      sourcemap,
      globals,
      name,
      banner,
    });
    bundle.write({
      format: 'es',
      file: `dist/esm/${file}`,
      sourcemap,
      globals,
      banner,
    });
  });

  rollup({
    input,
    plugins: [babili(minifyOptions), babel(babelConfig.es5)],
    external,
  }).then(bundle => {
    bundle.write({
      format: 'umd',
      file: `dist/umd/${file.replace('.js', '.min.js')}`,
      sourcemap,
      globals,
      name,
    });
    bundle.write({
      format: 'es',
      file: `dist/esm/${file.replace('.js', '.min.js')}`,
      sourcemap,
    });
  });
}

function bundleWatch({ input, file, name, banner, miniBanner }) {
  const watcher = watch({
    input,
    plugins: [babel(babelConfig.es5)],
    external,
    output: {
      format: 'umd',
      file: `dist/umd/${file}`,
      sourcemap,
      globals,
      name,
      banner,
    },
  });

  console.log('\x1Bc'); // reset console
  console.log('Rollup is watching for changes...');
  watcher.on('event', event => {
    switch (event.code) {
      case 'START':
        console.info('Rebuilding...');
        break;
      case 'BUNDLE_START':
        console.info('Bundling...');
        break;
      case 'BUNDLE_END':
        console.info('Bundled!');
        break;
      case 'END':
        console.info('Done!');
        break;
      case 'ERROR':
      case 'FATAL':
        console.error('Error!');
      /* eslint-enable no-console */
    }
  });

  process.on('exit', () => {
    watcher.close();
  });
}


module.exports = watchEnabled ? bundleWatch : bundle;