Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/alias/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"alias is not a function"_, then use the named export instead:
>
> ```js
> import { alias } from '@rollup/plugin-alias';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). If the build produces any errors, the plugin will write a 'alias' character to stderr, which should be audible on most systems.

## Options
Expand Down
3 changes: 2 additions & 1 deletion packages/alias/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function resolveCustomResolver(
return null;
}

export default function alias(options: RollupAliasOptions = {}): Plugin {
function alias(options: RollupAliasOptions = {}): Plugin {
const entries = getEntries(options);

if (entries.length === 0) {
Expand Down Expand Up @@ -114,3 +114,4 @@ export default function alias(options: RollupAliasOptions = {}): Plugin {
}
};
}
export { alias, alias as default };
3 changes: 2 additions & 1 deletion packages/alias/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ export interface RollupAliasOptions {
/**
* 🍣 A Rollup plugin for defining aliases when bundling packages.
*/
export default function alias(options?: RollupAliasOptions): Plugin;
declare function alias(options?: RollupAliasOptions): Plugin;
export { alias, alias as default };
14 changes: 11 additions & 3 deletions packages/auto-install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npm install @rollup/plugin-auto-install --save-dev
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:

```js
import auto from '@rollup/plugin-auto-install';
import autoInstall from '@rollup/plugin-auto-install';
import resolve from '@rollup/plugin-node-resolve';

export default {
Expand All @@ -37,11 +37,19 @@ export default {
dir: 'output',
format: 'cjs'
},
plugins: [auto(), resolve()]
plugins: [autoInstall(), resolve()]
};
```

_Note: ensure that this plugin is added to the `plugins` array *before* [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve)._
> [!NOTE]
> If your editor complains that _"autoInstall is not a function"_, then use the named export instead:
>
> ```js
> import { autoInstall } from '@rollup/plugin-auto-install';
> ```

> [!IMPORTANT]
> Ensure that this plugin is added to the `plugins` array _before_ [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve).

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

Expand Down
3 changes: 2 additions & 1 deletion packages/auto-install/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { RollupAutoInstallOptions } from '../types';

const execAsync = promisify(exec);

export default function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin {
function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin {
const defaults = {
// intentionally undocumented options. used for tests
commands: {
Expand Down Expand Up @@ -73,3 +73,4 @@ export default function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin
}
};
}
export { autoInstall, autoInstall as default };
3 changes: 2 additions & 1 deletion packages/auto-install/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export interface RollupAutoInstallOptions {
/**
* 🍣 A Rollup plugin which automatically installs dependencies that are imported by a bundle, even if not yet in `package.json`.
*/
export default function auto(options?: RollupAutoInstallOptions): Plugin;
declare function autoInstall(options?: RollupAutoInstallOptions): Plugin;
export { autoInstall, autoInstall as default };
4 changes: 2 additions & 2 deletions packages/babel/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ export function createBabelOutputPluginFactory(
* @param options - Plugin options.
* @returns Plugin instance.
*/
export function babel(options?: RollupBabelInputPluginOptions): Plugin;
export default babel;
declare function babel(options?: RollupBabelInputPluginOptions): Plugin;
export { babel, babel as default };
11 changes: 9 additions & 2 deletions packages/beep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npm install @rollup/plugin-beep --save-dev
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:

```js
const beep = require('@rollup/plugin-beep');
import beep from '@rollup/plugin-beep';

module.exports = {
export default {
input: 'src/index.js',
output: {
dir: 'output',
Expand All @@ -40,6 +40,13 @@ module.exports = {
};
```

> [!NOTE]
> If your editor complains that _"beep is not a function"_, then use the named export instead:
>
> ```javascript
> import { alias } from '@rollup/plugin-alias';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). If the build produces any errors, the plugin will write a "beep" character to stderr, which should be audible on most systems.

## Options
Expand Down
1 change: 1 addition & 0 deletions packages/beep/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ const beep = (opts) => {
};

module.exports = beep;
module.exports.beep = beep;
3 changes: 2 additions & 1 deletion packages/beep/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import type { Plugin } from 'rollup';
/**
* 🍣 A Rollup plugin that beeps when a build ends with errors.
*/
export default function beep(): Plugin;
declare function beep(): Plugin;
export { beep, beep as default };
7 changes: 7 additions & 0 deletions packages/buble/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"buble is not a function"_, then use the named export instead:
>
> ```js
> import { buble } from '@rollup/plugin-buble';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

## Options
Expand Down
3 changes: 2 additions & 1 deletion packages/buble/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFilter } from '@rollup/pluginutils';

import type { RollupBubleOptions } from '../types';

export default function buble(options: RollupBubleOptions = {}): Plugin {
export function buble(options: RollupBubleOptions = {}): Plugin {
const filter = createFilter(options.include, options.exclude);
const transformOptions = { ...options, transforms: { ...options.transforms, modules: false } };

Expand All @@ -26,3 +26,4 @@ export default function buble(options: RollupBubleOptions = {}): Plugin {
}
};
}
export default buble;
3 changes: 2 additions & 1 deletion packages/buble/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface RollupBubleOptions extends TransformOptions {
/**
* Convert ES2015 with buble.
*/
export default function buble(options?: RollupBubleOptions): Plugin;
declare function buble(options?: RollupBubleOptions): Plugin;
export { buble, buble as default };
7 changes: 7 additions & 0 deletions packages/commonjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"commonjs is not a function"_, then use the named export instead:
>
> ```js
> import { commonjs } from '@rollup/plugin-commonjs';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

When used together with the node-resolve plugin
Expand Down
3 changes: 2 additions & 1 deletion packages/commonjs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { getName, getStrictRequiresFilter, normalizePathSlashes } from './utils'

const PLUGIN_NAME = 'commonjs';

export default function commonjs(options = {}) {
export function commonjs(options = {}) {
const {
ignoreGlobal,
ignoreDynamicRequires,
Expand Down Expand Up @@ -324,3 +324,4 @@ export default function commonjs(options = {}) {
}
};
}
export default commonjs;
3 changes: 2 additions & 1 deletion packages/commonjs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,5 @@ interface RollupCommonJSOptions {
/**
* Convert CommonJS modules to ES6, so they can be included in a Rollup bundle
*/
export default function commonjs(options?: RollupCommonJSOptions): Plugin;
declare function commonjs(options?: RollupCommonJSOptions): Plugin;
export { commonjs, commonjs as default };
9 changes: 8 additions & 1 deletion packages/data-uri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/
```js
import dataUri from '@rollup/plugin-data-uri';

module.exports = {
export default {
input: 'src/index.js',
output: {
dir: 'output',
Expand All @@ -40,6 +40,13 @@ module.exports = {
};
```

> [!NOTE]
> If your editor complains that _"dataUri is not a function"_, then use the named export instead:
>
> ```js
> import { dataUri } from '@rollup/plugin-data-uri';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). If the build produces any errors, the plugin will write a "data-uri" character to stderr, which should be audible on most systems.

## Options
Expand Down
3 changes: 2 additions & 1 deletion packages/data-uri/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const mimeTypes = {
json: 'application/json'
};

export default function dataUri(): Plugin {
export function dataUri(): Plugin {
const resolved: { [key: string]: { mime: string | null; content: string | null } } = {};

return {
Expand Down Expand Up @@ -84,3 +84,4 @@ export default function dataUri(): Plugin {
}
};
}
export default dataUri;
3 changes: 2 additions & 1 deletion packages/data-uri/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import type { Plugin } from 'rollup';
/**
* A Rollup plugin which imports modules from Data URIs.
*/
export default function dataUri(): Plugin;
declare function dataUri(): Plugin;
export { dataUri, dataUri as default };
7 changes: 7 additions & 0 deletions packages/dsv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"dsv is not a function"_, then use the named export instead:
>
> ```js
> import { dsv } from '@rollup/plugin-dsv';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

## Practical Example
Expand Down
3 changes: 2 additions & 1 deletion packages/dsv/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import stripBom from 'strip-bom';

const parsers = { '.csv': csvParse, '.tsv': tsvParse };

export default function dsv(options = {}) {
export function dsv(options = {}) {
const filter = createFilter(options.include, options.exclude);

return {
Expand All @@ -32,3 +32,4 @@ export default function dsv(options = {}) {
}
};
}
export default dsv;
3 changes: 2 additions & 1 deletion packages/dsv/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ interface RollupDsvOptions {
/**
* Convert `.csv` and `.tsv `files into JavaScript modules with `d3-dsv`.
*/
export default function dsv(options?: RollupDsvOptions): Plugin;
declare function dsv(options?: RollupDsvOptions): Plugin;
export { dsv, dsv as default };
7 changes: 7 additions & 0 deletions packages/dynamic-import-vars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"dynamicImportVars is not a function"_, then use the named export instead:
>
> ```js
> import { dynamicImportVars } from '@rollup/plugin-dynamic-import-vars';
> ```

### Options

#### `include`
Expand Down
2 changes: 1 addition & 1 deletion packages/dynamic-import-vars/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ ${` default: return new Promise(function(resolve, reject) {
}

export default dynamicImportVariables;
export { dynamicImportToGlob, VariableDynamicImportError };
export { dynamicImportVariables, dynamicImportToGlob, VariableDynamicImportError };
5 changes: 2 additions & 3 deletions packages/dynamic-import-vars/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ export function dynamicImportToGlob(node: BaseNode, sourceString: string): null
/**
* Support variables in dynamic imports in Rollup.
*/
export default function dynamicImportVariables(
options?: RollupDynamicImportVariablesOptions
): Plugin;
declare function dynamicImportVariables(options?: RollupDynamicImportVariablesOptions): Plugin;
export { dynamicImportVariables, dynamicImportVariables as default };
7 changes: 7 additions & 0 deletions packages/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"eslint is not a function"_, then use the named export instead:
>
> ```js
> import { eslint } from '@rollup/plugin-eslint';
> ```

## Options

This plugin takes a configuration object intended for the [ESLint constructor](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions) with the addition of a `throwOnWarning`, `throwOnError`, `formatter`, `include` and `exclude` prop.
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function normalizePath(id: string) {
return relative(process.cwd(), id).split(sep).join('/');
}

export default function eslint(options = {} as RollupEslintOptions): Plugin {
export function eslint(options = {} as RollupEslintOptions): Plugin {
if (typeof options === 'string') {
const configFile = resolve(process.cwd(), options);
// eslint-disable-next-line global-require, import/no-dynamic-require, no-param-reassign
Expand Down Expand Up @@ -81,3 +81,4 @@ export default function eslint(options = {} as RollupEslintOptions): Plugin {
}
};
}
export default eslint;
3 changes: 2 additions & 1 deletion packages/eslint/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ export interface RollupEslintOptions extends ESLint.Options {
/**
* 🍣 A Rollup plugin for verifing entry points and all imported files with ESLint.
*/
export default function eslint(options?: RollupEslintOptions | string): Plugin;
declare function eslint(options?: RollupEslintOptions | string): Plugin;
export { eslint, eslint as default };
7 changes: 7 additions & 0 deletions packages/esm-shim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"esmShim is not a function"_, then use the named export instead:
>
> ```typescript
> import { esmShim } from '@rollup/plugin-esm-shim';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

## Meta
Expand Down
1 change: 1 addition & 0 deletions packages/esm-shim/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export function esmShim(): Plugin {
}
};
}
export default esmShim;
6 changes: 4 additions & 2 deletions packages/esm-shim/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ interface Output {
map?: SourceMapInput;
}

export function provideCJSSyntax(code: string): Output | null;

/**
* A Rollup plugin to replace cjs syntax for esm output bundles.
*
* @returns Plugin instance.
*/
export default function commonjsShim(): Plugin;
export function provideCJSSyntax(code: string): Output | null;
declare function esShim(): Plugin;
export { esShim, esShim as default };
7 changes: 7 additions & 0 deletions packages/graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default {
};
```

> [!NOTE]
> If your editor complains that _"graphql is not a function"_, then use the named export instead:
>
> ```js
> import { graphql } from '@rollup/plugin-graphql';
> ```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

With an accompanying file `src/index.js`, you can import GraphQL files or named queries/mutations:
Expand Down
Loading
Loading