Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Fix TypeScript Typings (rename and export Options interface) (#206)
Browse files Browse the repository at this point in the history
* fix(type): allow options to be exported

* fix(type): rename options type name

* add some spaces
  • Loading branch information
Kocal authored and lukastaegert committed Apr 10, 2019
1 parent 70f54ed commit f582f9c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import {Plugin} from 'rollup';
import {AsyncOpts} from 'resolve';

interface RollupNodeResolveOptions {
export interface Options {
/**
* the fields to scan in a package.json to determine the entry point
* if this list contains "browser", overrides specified in "pkg.browser"
* will be used
* @default ['module', 'main']
*/
mainFields?: string[],
mainFields?: string[];

/**
* @deprecated use "mainFields" instead
* use "module" field for ES6 module if possible
* @default true
*/
module?: boolean;

/**
* @deprecated use "mainFields" instead
* use "jsnext:main" if possible
Expand All @@ -24,6 +26,7 @@ interface RollupNodeResolveOptions {
* @default false
*/
jsnext?: boolean;

/**
* @deprecated use "mainFields" instead
* use "main" field or index.js, even if it's not an ES6 module
Expand All @@ -32,6 +35,7 @@ interface RollupNodeResolveOptions {
* @default true
*/
main?: boolean;

/**
* some package.json files have a "browser" field which specifies
* alternative files to load for people bundling for the browser. If
Expand All @@ -40,42 +44,49 @@ interface RollupNodeResolveOptions {
* @default false
*/
browser?: boolean;

/**
* not all files you want to resolve are .js files
* @default [ '.mjs', '.js', '.json', '.node' ]
*/
extensions?: ReadonlyArray<string>;

/**
* whether to prefer built-in modules (e.g. `fs`, `path`) or
* local ones with the same names
* @default true
*/
preferBuiltins?: boolean;

/**
* Lock the module search in this path (like a chroot). Module defined
* outside this path will be marked as external
* @default '/'
*/
jail?: string;

/**
* Set to an array of strings and/or regexps to lock the module search
* to modules that match at least one entry. Modules not matching any
* entry will be marked as external
* @default null
*/
only?: ReadonlyArray<string | RegExp> | null;

/**
* If true, inspect resolved files to check that they are
* ES2015 modules
* @default false
*/
modulesOnly?: boolean;

/**
* Force resolving for these modules to root's node_modules that helps
* to prevent bundling the same package multiple times if package is
* imported from dependencies.
*/
dedupe?: string[];

/**
* Any additional options that should be passed through
* to node-resolve
Expand All @@ -86,4 +97,4 @@ interface RollupNodeResolveOptions {
/**
* Locate modules using the Node resolution algorithm, for using third party modules in node_modules
*/
export default function nodeResolve(options?: RollupNodeResolveOptions): Plugin;
export default function nodeResolve(options?: Options): Plugin;

0 comments on commit f582f9c

Please sign in to comment.