1 | import type { Plugin } from 'rollup';
|
2 |
|
3 | export const DEFAULTS: {
|
4 | customResolveOptions: {};
|
5 | dedupe: [];
|
6 | extensions: ['.mjs', '.js', '.json', '.node'];
|
7 | resolveOnly: [];
|
8 | };
|
9 |
|
10 | export interface RollupNodeResolveOptions {
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | exportConditions?: string[];
|
22 |
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | browser?: boolean;
|
32 |
|
33 | |
34 |
|
35 |
|
36 |
|
37 | moduleDirectories?: string[];
|
38 |
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 | modulePaths?: string[];
|
45 |
|
46 | |
47 |
|
48 |
|
49 |
|
50 |
|
51 | dedupe?: string[] | ((importee: string) => boolean);
|
52 |
|
53 | /**
|
54 | * Specifies the extensions of files that the plugin will operate on.
|
55 | * @default [ '.mjs', '.js', '.json', '.node' ]
|
56 | */
|
57 | extensions?: readonly string[];
|
58 |
|
59 | /**
|
60 | * Locks the module search within specified path (e.g. chroot). Modules defined
|
61 | * outside this path will be marked as external.
|
62 | * @default '/'
|
63 | */
|
64 | jail?: string;
|
65 |
|
66 | /**
|
67 | * Specifies the properties to scan within a `package.json`, used to determine the
|
68 | * bundle entry point.
|
69 | * @default ['module', 'main']
|
70 | */
|
71 | mainFields?: readonly string[];
|
72 |
|
73 | /**
|
74 | * If `true`, inspect resolved files to assert that they are ES2015 modules.
|
75 | * @default false
|
76 | */
|
77 | modulesOnly?: boolean;
|
78 |
|
79 | /**
|
80 | * If `true`, the plugin will prefer built-in modules (e.g. `fs`, `path`). If `false`,
|
81 | * the plugin will look for locally installed modules of the same name.
|
82 | *
|
83 | * If a function is provided, it will be called to determine whether to prefer built-ins.
|
84 | * @default true
|
85 | */
|
86 | preferBuiltins?: boolean | ((module: string) => boolean);
|
87 |
|
88 | /**
|
89 | * An `Array` which instructs the plugin to limit module resolution to those whose
|
90 | * names match patterns in the array.
|
91 | * @default []
|
92 | */
|
93 | resolveOnly?: ReadonlyArray<string | RegExp> | null | ((module: string) => boolean);
|
94 |
|
95 | /**
|
96 | * Specifies the root directory from which to resolve modules. Typically used when
|
97 | * resolving entry-point imports, and when resolving deduplicated modules.
|
98 | * @default process.cwd()
|
99 | */
|
100 | rootDir?: string;
|
101 |
|
102 | /**
|
103 | * Allow folder mappings in package exports (trailing /)
|
104 | * This was deprecated in Node 14 and removed with Node 17, see DEP0148.
|
105 | * So this option might be changed to default to `false` in a future release.
|
106 | * @default true
|
107 | */
|
108 | allowExportsFolderMapping?: boolean;
|
109 | }
|
110 |
|
111 | /**
|
112 | * Locate modules using the Node resolution algorithm, for using third party modules in node_modules
|
113 | */
|
114 | export function nodeResolve(options?: RollupNodeResolveOptions): Plugin;
|
115 | export default nodeResolve;
|
116 |
|
\ | No newline at end of file |