Skip to content

unassert-js/rollup-plugin-unassert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-plugin-unassert

Rollup plugin to remove assertion calls via Unassert

Installation

yarn add --dev rollup-plugin-unassert

or

npm install --save-dev rollup-plugin-unassert

Usage

As with any other Rollup plugin, just add it to the plugins option in your RollupJS config:

// In rollup.config.js
import rollupUnassert from 'rollup-plugin-unassert'

export default {
	entry: 'src/index.js',
	dest: 'dist/my-lib.js',
	plugins: [
		rollupUnassert()
	]
};

Available options

This plugin accepts the following options:

  • include: A minimatch pattern or array of minimatch patterns, controlling which files are to be handled by this plugin. By default matches *.js only.
  • exclude: A minimatch pattern or array of minimatch patterns, controlling which files are to be ignored by this plugin. By default it's empty.
  • sourcemap: A boolean controlling whether to handle any existing sourcemaps, defaults to true. Setting this to false will hide the assert calls when debugging the generated bundle.
  • assertionPatterns: as per unassert options.
  • requirePatterns: as per unassert options.
  • importPatterns: as per unassert options.

e.g.:

// In rollup.config.js
import rollupUnassert from 'rollup-plugin-unassert'

export default {
	entry: 'src/index.js',
	dest: 'dist/my-lib.js',
	plugins: [
		rollupUnassert({
			exclude: 'test/**/**.js',
			requirePatterns: [ 'assert = require("assert")' ]
		}),
	]
};

License

"THE BEER-WARE LICENSE": ivan@sanchezortega.es wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

Also, thanks for Takuto Wada for https://github.com/unassert-js/unassertify , from which this project takes a lot of the code to wrap unassert.

About

A Rollup plugin to remove assertion calls via Unassert

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy