mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #32525 from Kocal/feat/add-type-for-rollup-plugin-node-globals
feat: add typings for rollup-plugin-node-globals
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for rollup-plugin-node-globals 1.4
|
||||
// Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#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';
|
||||
|
||||
export interface Options {
|
||||
// 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;
|
||||
|
||||
// Enable sourcemaps support
|
||||
sourceMap ?: boolean;
|
||||
|
||||
// Plugin's options
|
||||
process?: boolean;
|
||||
global?: boolean;
|
||||
buffer?: boolean;
|
||||
dirname?: boolean;
|
||||
filename?: boolean;
|
||||
baseDir?: string;
|
||||
}
|
||||
|
||||
export default function globals(options?: Options): Plugin;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"rollup": "^0.63.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import globals from 'rollup-plugin-node-globals';
|
||||
|
||||
// No options (default)
|
||||
(() => {
|
||||
// $ExpectType Plugin
|
||||
globals();
|
||||
})();
|
||||
|
||||
// With every options
|
||||
(() => {
|
||||
// $ExpectType Plugin
|
||||
globals({
|
||||
process: false,
|
||||
global: false,
|
||||
buffer: false,
|
||||
dirname: false,
|
||||
filename: false,
|
||||
baseDir: '/',
|
||||
});
|
||||
})();
|
||||
|
||||
// Filter files
|
||||
(() => {
|
||||
// $ExpectType Plugin
|
||||
globals({
|
||||
include: '*.js',
|
||||
exclude: '*.js',
|
||||
});
|
||||
|
||||
// $ExpectType Plugin
|
||||
globals({
|
||||
include: /.js$/,
|
||||
exclude: ['foo.js', 'bar.js'],
|
||||
});
|
||||
})();
|
||||
|
||||
// Sourcemaps
|
||||
(() => {
|
||||
// $ExpectType Plugin
|
||||
globals({
|
||||
sourceMap: false,
|
||||
});
|
||||
})();
|
||||
@@ -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-node-globals-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user