0.2.0 • Published 3 years ago

rollup-plugin-asc v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

rollup-plugin-asc Build Status Coverage Status

Compile AssemblyScript with Rollup.

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.

Install

Using npm:

$ npm i rollup-plugin-asc -D

Using yarn:

$ yarn add rollup-plugin-asc -D

Usage

Create a rollup.config.js configuration file and import the plugin:

import path from 'path';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import asc from 'rollup-plugin-asc';

const file = '<FILE_NAME>.ts';

export default {
  input: path.join(__dirname, 'src', file),
  output: {
    file: path.join(__dirname, 'dist', file.substring(file.lastIndexOf('.'), 0) + '.js'),
    format: 'cjs',
    exports: 'auto',
  },
  external: ['fs', 'path', '@assemblyscript/loader', '@assemblyscript/loader/umd'],
  plugins: [
    resolve(),
    commonjs(),
    asc({ output: path.join(__dirname, 'dist') }),
  ],
};

Then call rollup either via the CLI or the API.

Options

output

Type: string Default: '' Example: output: path.join(__dirname, 'dist'),

args

Type: string[] Default: [] Example: args: ['--measure'],

The arguments that is passed straight to the AssemblyScript compiler library.

textFile

Type: boolean Default: false Example: textFile: true,

tsdFile

Type: boolean Default: false Example: tsdFile: true,

Example

See the example folder.