feat: add type for "rollup-plugin-buble"

This commit is contained in:
Hugo Alliaume
2019-02-03 19:43:24 +01:00
parent 9ce154849c
commit 86ca25c6fa
5 changed files with 105 additions and 0 deletions

18
types/rollup-plugin-buble/index.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
// Type definitions for rollup-plugin-buble 0.19
// Project: https://github.com/rollup/rollup-plugin-buble#readme
// Definitions by: Hugo Alliaume <https://github.com/Kocal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
import { Plugin } from 'rollup';
import { TransformOptions } from 'buble';
export interface Options extends TransformOptions {
// Every files will be parsed by default, but you can specify which files to include or exclude
include?: Array<string | RegExp> | string | RegExp | null;
exclude?: Array<string | RegExp> | string | RegExp | null;
}
export default function buble(options?: Options): Plugin;

View File

@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"rollup": "^0.63.4"
}
}

View File

@@ -0,0 +1,57 @@
import buble from 'rollup-plugin-buble';
// No options (default)
(() => {
// $ExpectType Plugin
buble();
})();
// With every options
(() => {
// $ExpectType Plugin
buble({
target: {
chrome: 71,
firefox: 64,
},
objectAssign: true,
transforms: {
arrow: true,
classes: false,
collections: true,
computedProperty: false,
conciseMethodProperty: true,
constLoop: false,
dangerousForOf: true,
dangerousTaggedTemplateString: false,
defaultParameter: true,
destructuring: false,
forOf: true,
generator: false,
letConst: true,
modules: false,
numericLiteral: true,
parameterDestructuring: false,
reservedProperties: true,
spreadRest: false,
stickyRegExp: true,
templateString: false,
unicodeRegExp: true,
}
});
})();
// Filter files
(() => {
// $ExpectType Plugin
buble({
include: '*.js',
exclude: '*.js',
});
// $ExpectType Plugin
buble({
include: /.js$/,
exclude: ['foo.js', 'bar.js'],
});
})();

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"rollup-plugin-buble-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }