forked from rollup/rollup-plugin-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38bce40
commit 30079e8
Showing
4 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Plugin } from 'rollup'; | ||
import { CompilerOptionsValue, TsConfigSourceFile } from 'typescript'; | ||
|
||
interface RollupTypescriptOptions { | ||
/** | ||
* Determine which files are transpiled by Typescript (all `.ts` and | ||
* `.tsx` files by default). | ||
*/ | ||
include?: string | RegExp | ReadonlyArray<string | RegExp> | null; | ||
/** | ||
* Determine which files are transpiled by Typescript (all `.ts` and | ||
* `.tsx` files by default). | ||
*/ | ||
exclude?: string | RegExp | ReadonlyArray<string | RegExp> | null; | ||
/** | ||
* When set to false, ignores any options specified in the config file. | ||
* If set to a string that corresponds to a file path, the specified file | ||
* will be used as config file. | ||
*/ | ||
tsconfig?: string | false; | ||
/** | ||
* Overrides TypeScript used for transpilation | ||
*/ | ||
typescript?: typeof import('typescript'); | ||
/** | ||
* Overrides the injected TypeScript helpers with a custom version | ||
*/ | ||
tslib?: typeof import('tslib'); | ||
|
||
/** | ||
* Other Typescript compiler options | ||
*/ | ||
[option: string]: | ||
| CompilerOptionsValue | ||
| TsConfigSourceFile | ||
| RollupTypescriptOptions['include'] | ||
| RollupTypescriptOptions['typescript'] | ||
| RollupTypescriptOptions['tslib'] | ||
| undefined; | ||
} | ||
|
||
/** | ||
* Seamless integration between Rollup and Typescript. | ||
*/ | ||
export default function typescript(options?: RollupTypescriptOptions): Plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": [ | ||
"es6" | ||
], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"allowJs": true | ||
}, | ||
"files": [ | ||
"index.d.ts", | ||
"typings-test.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @ts-check | ||
import typescript from '.'; | ||
|
||
/** @type {import("rollup").RollupOptions} */ | ||
const config = { | ||
input: 'main.js', | ||
output: { | ||
file: 'bundle.js', | ||
format: 'iife' | ||
}, | ||
plugins: [ | ||
typescript({ | ||
lib: ["es5", "es6", "dom"], | ||
target: "es5", | ||
include: 'node_modules/**', | ||
exclude: ['node_modules/foo/**', 'node_modules/bar/**', /node_modules/], | ||
}) | ||
] | ||
}; | ||
|
||
export default config; |