rollup-plugin-asc

0.2.0 • Public • Published

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.

Package Sidebar

Install

npm i rollup-plugin-asc

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

5.97 kB

Total Files

4

Last publish

Collaborators

  • shyam-chen