The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojo::Alien::rollup - Runs the external nodejs program rollup

SYNOPSIS

  use Mojo::Alien::rollup;
  my $rollup = Mojo::Alien::rollup->new;

  # Run once
  $rollup->build;

  # Build when rollup see files change
  $rollup->watch

DESCRIPTION

Mojo::Alien::rollup is a class for runnig the external nodejs program rollup.

ATTRIBUTES

assets_dir

See "assets_dir" in Mojo::Alien::webpack.

binary

  $array_ref = $rollup->binary;
  $rollup = $rollup->binary('rollup');

The path to the rollup executable. Defaults to MOJO_ROLLUP_BINARY environment variable, or "rollup" inside "./node_modules". Fallback to just "rollup".

config

  $path = $rollup->config;
  $rollup = $rollup->config(path->to_abs->child('rollup.config.js'));

Holds an /absolute path to rollup.config.js.

dependencies

  $hash_ref = $rollup->dependencies;

A hash where the keys can match the items in "include" and the values are lists of packages to install. Keys that does /not match items in "include" will be ignored. This attribute will be used by "init".

These dependencies are predefined:

  core   | rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve
  css    | cssnano postcss-preset-env rollup-plugin-postcss
  eslint | @rollup-plugin-eslint
  js     | @babel/core @babel/preset-env @rollup/plugin-babel rollup-plugin-terser
  sass   | cssnano @csstools/postcss-sass postcss-preset-env rollup-plugin-postcss sass
  svelte | rollup-plugin-svelte

include

See "include" in Mojo::Alien::webpack.

mode

See "mode" in Mojo::Alien::webpack.

npm

See "npm" in Mojo::Alien::webpack.

out_dir

See "out_dir" in Mojo::Alien::webpack.

METHODS

asset_map

  $hash_ref = $rollup->asset_map;

Parses the filenames in "out_dir" and returns a hash ref with information about the generated assets. Example return value:

  {
    'entry-name.js' => '/path/to/entry-name.development.js',
    'cool-beans.png' => /path/to/f47352684211060f3e34.png',
  }

Note that this method is currently EXPERIMENTAL.

build

See "build" in Mojo::Alien::webpack.

exec

See "exec" in Mojo::Alien::webpack.

init

See "init" in Mojo::Alien::webpack.

pid

See "pid" in Mojo::Alien::webpack.

stop

See "stop" in Mojo::Alien::webpack.

watch

See "watch" in Mojo::Alien::webpack.

SEE ALSO

Mojolicious::Plugin::Webpack and Mojo::Alien::webpack.