@rollup/plugin-node-resolve 8.4.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,34 +1,62 @@
1
1
  # @rollup/plugin-node-resolve ChangeLog
2
2
 
3
- ## v8.4.0
3
+ ## v11.0.1
4
4
 
5
- _2020-07-12_
5
+ _2020-12-14_
6
6
 
7
- ### Features
7
+ ### Bugfixes
8
8
 
9
- - feat: preserve search params and hashes (#487)
10
- - feat: support .js imports in TypeScript (#480)
9
+ - fix: export map specificity (#675)
10
+ - fix: add missing type import (#668)
11
11
 
12
12
  ### Updates
13
13
 
14
- - docs: fix named export use in readme (#456)
15
- - docs: correct mainFields valid values (#469)
14
+ - docs: corrected word "yse" to "use" (#723)
16
15
 
17
- ## v8.3.0
16
+ ## v11.0.0
18
17
 
19
- _2020-07-12_
18
+ _2020-11-30_
20
19
 
21
- ### Features
20
+ ### Breaking Changes
22
21
 
23
- - feat: preserve search params and hashes (#487)
24
- - feat: support .js imports in TypeScript (#480)
22
+ - refactor!: simplify builtins and remove `customResolveOptions` (#656)
23
+ - feat!: Mark built-ins as external (#627)
24
+ - feat!: support package entry points (#540)
25
+
26
+ ### Bugfixes
27
+
28
+ - fix: refactor handling builtins, do not log warning if no local version (#637)
25
29
 
26
30
  ### Updates
27
31
 
28
- - docs: fix named export use in readme (#456)
29
- - docs: correct mainFields valid values (#469)
32
+ - docs: fix import statements in examples in README.md (#646)
30
33
 
31
- ## v8.2.0
34
+ ## v10.0.0
35
+
36
+ _2020-10-27_
37
+
38
+ ### Breaking Changes
39
+
40
+ - fix!: resolve hash in path (#588)
41
+
42
+ ### Bugfixes
43
+
44
+ - fix: do not ignore exceptions (#564)
45
+
46
+ ## v9.0.0
47
+
48
+ _2020-08-13_
49
+
50
+ ### Breaking Changes
51
+
52
+ - chore: update dependencies (e632469)
53
+
54
+ ### Updates
55
+
56
+ - refactor: remove deep-freeze from dependencies (#529)
57
+ - chore: clean up changelog (84dfddb)
58
+
59
+ ## v8.4.0
32
60
 
33
61
  _2020-07-12_
34
62
 
package/README.md CHANGED
@@ -44,6 +44,17 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma
44
44
 
45
45
  ## Options
46
46
 
47
+ ### `exportConditions`
48
+
49
+ Type: `Array[...String]`<br>
50
+ Default: `[]`
51
+
52
+ Additional conditions of the package.json exports field to match when resolving modules. By default, this plugin looks for the `['default', 'module', 'import']` conditions when resolving imports.
53
+
54
+ When using `@rollup/plugin-commonjs` v16 or higher, this plugin will use the `['default', 'module', 'require']` conditions when resolving require statements.
55
+
56
+ Setting this option will add extra conditions on top of the default conditions. See https://nodejs.org/api/packages.html#packages_conditional_exports for more information.
57
+
47
58
  ### `browser`
48
59
 
49
60
  Type: `Boolean`<br>
@@ -51,18 +62,12 @@ Default: `false`
51
62
 
52
63
  If `true`, instructs the plugin to use the `"browser"` property in `package.json` files to specify alternative files to load for bundling. This is useful when bundling for a browser environment. Alternatively, a value of `'browser'` can be added to the `mainFields` option. If `false`, any `"browser"` properties in package files will be ignored. This option takes precedence over `mainFields`.
53
64
 
54
- ### `customResolveOptions`
65
+ ### `moduleDirectories`
55
66
 
56
- Type: `Object`<br>
57
- Default: `null`
58
-
59
- An `Object` that specifies additional options that should be passed through to [`resolve`](https://www.npmjs.com/package/resolve).
67
+ Type: `Array[...String]`<br>
68
+ Default: `['node_modules']`
60
69
 
61
- ```
62
- customResolveOptions: {
63
- moduleDirectory: 'js_modules'
64
- }
65
- ```
70
+ One or more directories in which to recursively look for modules.
66
71
 
67
72
  ### `dedupe`
68
73
 
@@ -101,7 +106,7 @@ Specifies the extensions of files that the plugin will operate on.
101
106
  Type: `String`<br>
102
107
  Default: `'/'`
103
108
 
104
- Locks the module search within specified path (e.g. chroot). Modules defined outside this path will be marked as external.
109
+ Locks the module search within specified path (e.g. chroot). Modules defined outside this path will be ignored by this plugin.
105
110
 
106
111
  ### `mainFields`
107
112
 
@@ -111,14 +116,10 @@ Valid values: `['browser', 'jsnext:main', 'module', 'main']`
111
116
 
112
117
  Specifies the properties to scan within a `package.json`, used to determine the bundle entry point. The order of property names is significant, as the first-found property is used as the resolved entry point. If the array contains `'browser'`, key/values specified in the `package.json` `browser` property will be used.
113
118
 
114
- ### `only`
115
-
116
- DEPRECATED: use "resolveOnly" instead
117
-
118
119
  ### `preferBuiltins`
119
120
 
120
121
  Type: `Boolean`<br>
121
- Default: `true`
122
+ Default: `true` (with warnings if a builtin module is used over a local version. Set to `true` to disable warning.)
122
123
 
123
124
  If `true`, the plugin will prefer built-in modules (e.g. `fs`, `path`). If `false`, the plugin will look for locally installed modules of the same name.
124
125
 
@@ -150,13 +151,17 @@ Specifies the root directory from which to resolve modules. Typically used when
150
151
  rootDir: path.join(process.cwd(), '..')
151
152
  ```
152
153
 
154
+ ## Preserving symlinks
155
+
156
+ This plugin honours the rollup [`preserveSymlinks`](https://rollupjs.org/guide/en/#preservesymlinks) option.
157
+
153
158
  ## Using with @rollup/plugin-commonjs
154
159
 
155
160
  Since most packages in your node_modules folder are probably legacy CommonJS rather than JavaScript modules, you may need to use [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/master/packages/commonjs):
156
161
 
157
162
  ```js
158
163
  // rollup.config.js
159
- import resolve from '@rollup/plugin-node-resolve';
164
+ import { nodeResolve } from '@rollup/plugin-node-resolve';
160
165
  import commonjs from '@rollup/plugin-commonjs';
161
166
 
162
167
  export default {
@@ -166,27 +171,42 @@ export default {
166
171
  format: 'iife',
167
172
  name: 'MyModule'
168
173
  },
169
- plugins: [resolve(), commonjs()]
174
+ plugins: [nodeResolve(), commonjs()]
170
175
  };
171
176
  ```
172
177
 
173
178
  ## Resolving Built-Ins (like `fs`)
174
179
 
175
- This plugin won't resolve any builtins (e.g. `fs`). If you need to resolve builtins you can install local modules and set `preferBuiltins` to `false`, or install a plugin like [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills) which provides stubbed versions of these methods.
180
+ By default this plugin will prefer built-ins over local modules, marking them as external.
181
+
182
+ See [`preferBuiltins`](#preferbuiltins).
176
183
 
177
- If you want to silence warnings about builtins, you can add the list of builtins to the `externals` option; like so:
184
+ To provide stubbed versions of Node built-ins, use a plugin like [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills) or use [`builtin-modules`](https://github.com/sindresorhus/builtin-modules) with `external`, and set `preferBuiltins` to `false`. e.g.
178
185
 
179
186
  ```js
180
- import resolve from '@rollup/plugin-node-resolve';
187
+ import { nodeResolve } from '@rollup/plugin-node-resolve';
181
188
  import builtins from 'builtin-modules'
182
189
  export default ({
183
190
  input: ...,
184
- plugins: [resolve()],
191
+ plugins: [nodeResolve()],
185
192
  external: builtins,
186
193
  output: ...
187
194
  })
188
195
  ```
189
196
 
197
+ ## Resolving require statements
198
+
199
+ According to [NodeJS module resolution](https://nodejs.org/api/packages.html#packages_package_entry_points) `require` statements should resolve using the `require` condition in the package exports field, while es modules should use the `import` condition.
200
+
201
+ The node resolve plugin uses `import` by default, you can opt into using the `require` semantics by passing an extra option to the resolve function:
202
+
203
+ ```js
204
+ this.resolve(importee, importer, {
205
+ skipSelf: true,
206
+ custom: { 'node-resolve': { isRequire: true } }
207
+ });
208
+ ```
209
+
190
210
  ## Meta
191
211
 
192
212
  [CONTRIBUTING](/.github/CONTRIBUTING.md)