Merge pull request #32368 from eoin-obrien/rollup-plugin-sourcemaps

[rollup-plugin-sourcemaps] Add types
This commit is contained in:
Benjamin Lichtman
2019-01-23 10:51:46 -08:00
committed by GitHub
5 changed files with 64 additions and 0 deletions
+19
View File
@@ -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 <https://github.com/eoin-obrien>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
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> | string | RegExp | null;
exclude?: Array<string | RegExp> | string | RegExp | null;
readFile?: ReadFileFunction;
}
export default function sourcemaps(options?: Options): Plugin;
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"rollup": "^0.63.4"
}
}
@@ -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
});
@@ -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"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }