diff --git a/types/rollup-plugin-sourcemaps/index.d.ts b/types/rollup-plugin-sourcemaps/index.d.ts new file mode 100644 index 0000000000..d477648bb0 --- /dev/null +++ b/types/rollup-plugin-sourcemaps/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for rollup-plugin-sourcemaps 0.4 +// Project: https://github.com/maxdavidson/rollup-plugin-sourcemaps#readme +// Definitions by: Eoin O'Brien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +import { Plugin } from 'rollup'; + +export type ReadFileCallback = (err: NodeJS.ErrnoException, data: string) => void; +export type ReadFileFunction = (file: string | Buffer | number, encoding: string, callback: ReadFileCallback) => void; + +export interface Options { + include?: Array | string | RegExp | null; + exclude?: Array | string | RegExp | null; + readFile?: ReadFileFunction; +} + +export default function sourcemaps(options?: Options): Plugin; diff --git a/types/rollup-plugin-sourcemaps/package.json b/types/rollup-plugin-sourcemaps/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-sourcemaps/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts b/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts new file mode 100644 index 0000000000..2fc5cf75b9 --- /dev/null +++ b/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts @@ -0,0 +1,15 @@ +import sourcemaps from 'rollup-plugin-sourcemaps'; +import * as fs from 'fs'; + + // $ExpectType Plugin +sourcemaps(); + + // $ExpectType Plugin +sourcemaps({}); + + // $ExpectType Plugin +sourcemaps({ + include: 'node_modules/**', + exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ], + readFile: fs.readFile +}); diff --git a/types/rollup-plugin-sourcemaps/tsconfig.json b/types/rollup-plugin-sourcemaps/tsconfig.json new file mode 100644 index 0000000000..ace44db2e1 --- /dev/null +++ b/types/rollup-plugin-sourcemaps/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-sourcemaps-tests.ts" + ] +} diff --git a/types/rollup-plugin-sourcemaps/tslint.json b/types/rollup-plugin-sourcemaps/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-sourcemaps/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }