From 3f944ca274d0eb2404905e1de7d4ba76535074e1 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 08:48:50 +0100 Subject: [PATCH 1/3] chore: setup type --- types/rollup-plugin-node-globals/index.d.ts | 4 ++++ .../rollup-plugin-node-globals-tests.ts | 0 .../rollup-plugin-node-globals/tsconfig.json | 23 +++++++++++++++++++ types/rollup-plugin-node-globals/tslint.json | 1 + 4 files changed, 28 insertions(+) create mode 100644 types/rollup-plugin-node-globals/index.d.ts create mode 100644 types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts create mode 100644 types/rollup-plugin-node-globals/tsconfig.json create mode 100644 types/rollup-plugin-node-globals/tslint.json diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts new file mode 100644 index 0000000000..08b8b52926 --- /dev/null +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -0,0 +1,4 @@ +// Type definitions for rollup-plugin-node-globals 1.4 +// Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme +// Definitions by: Kocal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/rollup-plugin-node-globals/tsconfig.json b/types/rollup-plugin-node-globals/tsconfig.json new file mode 100644 index 0000000000..29e93758c9 --- /dev/null +++ b/types/rollup-plugin-node-globals/tsconfig.json @@ -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" + ] +} diff --git a/types/rollup-plugin-node-globals/tslint.json b/types/rollup-plugin-node-globals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-node-globals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 69863b59ba6fd60ee321582d883677d468b4d74e Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 09:23:25 +0100 Subject: [PATCH 2/3] feat: add type for "rollup-plugin-node-globals" --- types/rollup-plugin-node-globals/index.d.ts | 24 +++++++++++ types/rollup-plugin-node-globals/package.json | 6 +++ .../rollup-plugin-node-globals-tests.ts | 43 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 types/rollup-plugin-node-globals/package.json diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts index 08b8b52926..97284aaabd 100644 --- a/types/rollup-plugin-node-globals/index.d.ts +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -2,3 +2,27 @@ // Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme // Definitions by: Kocal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +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 | null; + exclude?: Array | 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; diff --git a/types/rollup-plugin-node-globals/package.json b/types/rollup-plugin-node-globals/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-node-globals/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts index e69de29bb2..93d10a2730 100644 --- a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts +++ b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts @@ -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, + }); +})(); From a3ce51ce058fe7d35f7e507af91184bc7e09c0ce Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 12:00:53 +0100 Subject: [PATCH 3/3] chore: use my name --- types/rollup-plugin-node-globals/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts index 97284aaabd..2cf29ae912 100644 --- a/types/rollup-plugin-node-globals/index.d.ts +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for rollup-plugin-node-globals 1.4 // Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme -// Definitions by: Kocal +// Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3