New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rollup-plugin-docker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-docker

A Rollup plugin that wraps docker-preprocessor.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

rollup-plugin-docker

A Rollup plugin that wraps docker-preprocessor.

Install

npm install --save-dev rollup-plugin-docker

Usage

rollup-plugin-docker is for tasks that require lots of setup or configuration of the host machine. A good example is compiling C++ to WebAssembly (wasm), which requires Emscripten to be compiled, configured, and installed.

This can also be used for multiple times within a configuration for different file types, allowing for easy seperation of concerns via Docker containers.

file.js

import wasmModule from 'file.cpp';

rollup.config.js

import docker from 'rollup-plugin-docker';
import wasmModule from 'rollup-plugin-wasm-module';

export default {
  plugins: [
    docker({
      include: ['**/*.cpp'],
      options: {
        image: 'apiaryio/emcc',
        createOptions: {
          Binds: ['/:/host'],
        },
        command: path => [
          'sh',
          '-c',
          `
            emcc \
              /host${path} \
              -g \
              -Os \
              -s WASM=1 \
              -s SIDE_MODULE=1 \
              -o target.wasm \
            ;
          `,
        ],
        paths: {
          main: '/src/target.wasm',
          emittedFiles: [
            '/src/target.wast',
          ],
          sourceMap: '/src/target.wasm.map',
        },
      },
    }),
    wasmModule({
      include: ['**/*.cpp', '**/*.rs'],
    }),
  ],
};

Options

All options are defined by and are passed directly to docker-preprocessor; check its documentation for more a in-depth explanation.

Keywords

rollup

FAQs

Package last updated on 11 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts