This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add .d.ts typings file * Run typecheck in test script * Move typings-test back out so jest isn't triggered
- Loading branch information
1 parent
1081282
commit 79151ef
Showing
5 changed files
with
100 additions
and
3 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,50 @@ | ||
import { Plugin } from 'rollup'; | ||
|
||
interface RollupCommonJSOptions { | ||
/** | ||
* non-CommonJS modules will be ignored, but you can also | ||
* specifically include/exclude files | ||
* @default undefined | ||
*/ | ||
include?: string | RegExp, | ||
/** | ||
* non-CommonJS modules will be ignored, but you can also | ||
* specifically include/exclude files | ||
* @default undefined | ||
*/ | ||
exclude?: ReadonlyArray<string | RegExp> | ||
/** | ||
* search for files other than .js files (must already | ||
* be transpiled by a previous plugin!) | ||
* @default [ '.js' ] | ||
*/ | ||
extensions: ReadonlyArray<string | RegExp>, | ||
/** | ||
* if true then uses of `global` won't be dealt with by this plugin | ||
* @default false | ||
*/ | ||
ignoreGlobal?: boolean, | ||
/** | ||
* if false then skip sourceMap generation for CommonJS modules | ||
* @default true | ||
*/ | ||
sourceMap?: boolean, | ||
/** | ||
* explicitly specify unresolvable named exports | ||
* ([see below for more details](https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports)) | ||
* @default undefined | ||
*/ | ||
namedExports?: { [package: string]: ReadonlyArray<string> }, | ||
/** | ||
* sometimes you have to leave require statements | ||
* unconverted. Pass an array containing the IDs | ||
* or a `id => boolean` function. Only use this | ||
* option if you know what you're doing! | ||
*/ | ||
ignore?: ReadonlyArray<string | ((id: string) => boolean)>, | ||
} | ||
|
||
/** | ||
* Convert CommonJS modules to ES6, so they can be included in a Rollup bundle | ||
*/ | ||
export default function commonjs(options?: RollupCommonJSOptions): Plugin; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
// @ts-check | ||
import commonjs from '.'; | ||
|
||
/** @type {import("rollup").RollupOptions} */ | ||
const config = { | ||
input: 'main.js', | ||
output: { | ||
file: 'bundle.js', | ||
format: 'iife' | ||
}, | ||
plugins: [ | ||
commonjs({ | ||
include: 'node_modules/**', | ||
exclude: [ 'node_modules/foo/**', 'node_modules/bar/**', /node_modules/ ], | ||
extensions: [ '.js', '.coffee' ], | ||
ignoreGlobal: false, | ||
sourceMap: false, | ||
namedExports: { './module.js': ['foo', 'bar' ] }, | ||
ignore: [ 'conditional-runtime-dependency' ] | ||
}) | ||
] | ||
}; | ||
|
||
export default config; |