@rollup/plugin-node-resolve 7.0.0 → 7.1.3

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,5 +1,37 @@
1
1
  # @rollup/plugin-node-resolve ChangeLog
2
2
 
3
+ ## v7.1.3
4
+
5
+ _2020-04-12_
6
+
7
+ ### Bugfixes
8
+
9
+ - fix: resolve symlinked entry point properly (#291)
10
+
11
+ ## v7.1.2
12
+
13
+ _2020-04-12_
14
+
15
+ ### Updates
16
+
17
+ - docs: fix url (#289)
18
+
19
+ ## v7.1.1
20
+
21
+ _2020-02-03_
22
+
23
+ ### Bugfixes
24
+
25
+ - fix: main fields regression (#196)
26
+
27
+ ## v7.1.0
28
+
29
+ _2020-02-01_
30
+
31
+ ### Updates
32
+
33
+ - refactor: clean codebase and fix external warnings (#155)
34
+
3
35
  ## v7.0.0
4
36
 
5
37
  _2020-01-07_
package/README.md CHANGED
@@ -44,118 +44,106 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma
44
44
 
45
45
  ## Options
46
46
 
47
- ### `mainFields`
47
+ ### `browser`
48
48
 
49
- Type: `Array[...String]`<br>
50
- Default: `['module', 'main']`<br>
51
- Valid values: `['browser', 'jsnext', 'module', 'main']`
49
+ Type: `Boolean`<br>
50
+ Default: `false`
52
51
 
53
- 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.
52
+ 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`.
54
53
 
55
- ### `module`
54
+ ### `customResolveOptions`
56
55
 
57
- DEPRECATED: use "mainFields" instead
56
+ Type: `Object`<br>
57
+ Default: `null`
58
58
 
59
- Use `pkg.module` field for ES6 module if possible. This option takes precedence over both "jsnext" and "main" in the list if such are present.
59
+ An `Object` that specifies additional options that should be passed through to [`resolve`](https://www.npmjs.com/package/resolve).
60
60
 
61
- ### `jsnext`
61
+ ```
62
+ customResolveOptions: {
63
+ moduleDirectory: 'js_modules'
64
+ }
65
+ ```
62
66
 
63
- DEPRECATED: use "mainFields" instead
67
+ ### `dedupe`
64
68
 
65
- Use `pkg['jsnext:main']` if possible, legacy field pointing to ES6 module in third-party libraries, deprecated in favor of `pkg.module`, see: https://github.com/rollup/rollup/wiki/pkg.module. This option takes precedence over "main" in the list if such is present.
69
+ Type: `Array[...String]`<br>
70
+ Default: `[]`
66
71
 
67
- ### `main`
72
+ An `Array` of modules names, which instructs the plugin to force resolving for the specified modules to the root `node_modules`. Helps to prevent bundling the same package multiple times if package is imported from dependencies.
68
73
 
69
- DEPRECATED: use "mainFields" instead
74
+ ```js
75
+ dedupe: ['my-package', '@namespace/my-package'];
76
+ ```
70
77
 
71
- Use `pkg.main` field or index.js, even if it's not an ES6 module (needs to be converted from CommonJS to ES6), see https://github.com/rollup/rollup-plugin-commonjs.
78
+ This will deduplicate bare imports such as:
72
79
 
73
- ### `browser`
80
+ ```js
81
+ import 'my-package';
82
+ import '@namespace/my-package';
83
+ ```
74
84
 
75
- Type: `Boolean`<br>
76
- Default: `false`
85
+ And it will deduplicate deep imports such as:
77
86
 
78
- 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`.
87
+ ```js
88
+ import 'my-package/foo.js';
89
+ import '@namespace/my-package/bar.js';
90
+ ```
79
91
 
80
92
  ### `extensions`
81
93
 
82
94
  Type: `Array[...String]`<br>
83
95
  Default: `['.mjs', '.js', '.json', '.node']`
84
96
 
85
- Resolve extensions other than .js in the order specified.
86
-
87
- ### `preferBuiltins`
88
-
89
- Type: `Boolean`<br>
90
- Default: `true`
91
-
92
- Whether to prefer built-in modules (e.g. `fs`, `path`) or local ones with the same names
97
+ Specifies the extensions of files that the plugin will operate on.
93
98
 
94
99
  ### `jail`
95
100
 
96
101
  Type: `String`<br>
97
102
  Default: `'/'`
98
103
 
99
- Lock the module search in this path (like a chroot). Modules defined outside this path will be marked as external.
100
-
101
- ### `only`
104
+ Locks the module search within specified path (e.g. chroot). Modules defined outside this path will be marked as external.
102
105
 
103
- Type: `Array[...String|RegExp]`<br>
104
- Default: `null`
105
-
106
- Example: `only: ['some_module', /^@some_scope\/.*$/]`
107
-
108
- ### `modulesOnly`
106
+ ### `mainFields`
109
107
 
110
- Type: `Boolean`<br>
111
- Default: `false`
108
+ Type: `Array[...String]`<br>
109
+ Default: `['module', 'main']`<br>
110
+ Valid values: `['browser', 'jsnext', 'module', 'main']`
112
111
 
113
- If true, inspect resolved files to check that they are ES2015 modules.
112
+ 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.
114
113
 
115
- ### `dedupe`
114
+ ### `only`
116
115
 
117
- Type: `Array[...String]`<br>
118
- Default: `[]`
116
+ DEPRECATED: use "resolveOnly" instead
119
117
 
120
- 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.
118
+ ### `preferBuiltins`
121
119
 
122
- ```
123
- dedupe: [ 'my-package', '@namespace/my-package' ]
124
- ```
120
+ Type: `Boolean`<br>
121
+ Default: `true`
125
122
 
126
- This will deduplicate bare imports such as:
123
+ 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.
127
124
 
128
- ```js
129
- import 'my-package';
130
- import '@namespace/my-package';
131
- ```
125
+ ### `modulesOnly`
132
126
 
133
- And it will deduplicate deep imports such as:
127
+ Type: `Boolean`<br>
128
+ Default: `false`
134
129
 
135
- ```js
136
- import 'my-package/foo.js';
137
- import '@namespace/my-package/bar.js';
138
- ```
130
+ If `true`, inspect resolved files to assert that they are ES2015 modules.
139
131
 
140
- ### `customResolveOptions`
132
+ ### `resolveOnly`
141
133
 
142
- Type: `Boolean`<br>
134
+ Type: `Array[...String|RegExp]`<br>
143
135
  Default: `null`
144
136
 
145
- Any additional options that should be passed through to node-resolve.
137
+ An `Array` which instructs the plugin to limit module resolution to those whose names match patterns in the array. _Note: Modules not matching any patterns will be marked as external._
146
138
 
147
- ```
148
- customResolveOptions: {
149
- moduleDirectory: 'js_modules'
150
- }
151
- ```
139
+ Example: `resolveOnly: ['batman', /^@batcave\/.*$/]`
152
140
 
153
141
  ### `rootDir`
154
142
 
155
143
  Type: `String`<br>
156
144
  Default: `process.cwd()`
157
145
 
158
- Root directory to resolve modules from. Used when resolving entrypoint imports, and when resolving deduplicated modules. Useful when executing rollup in a package of a monorepository.
146
+ Specifies the root directory from which to resolve modules. Typically used when resolving entry-point imports, and when resolving deduplicated modules. Useful when executing rollup in a package of a mono-repository.
159
147
 
160
148
  ```
161
149
  // Set the root directory to be the parent folder
@@ -164,7 +152,7 @@ rootDir: path.join(process.cwd(), '..')
164
152
 
165
153
  ## Using with @rollup/plugin-commonjs
166
154
 
167
- 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/packages/commonjs):
155
+ 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):
168
156
 
169
157
  ```js
170
158
  // rollup.config.js
@@ -184,7 +172,7 @@ export default {
184
172
 
185
173
  ## Resolving Built-Ins (like `fs`)
186
174
 
187
- 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-builtins](https://github.com/calvinmetcalf/rollup-plugin-node-builtins) which provides stubbed versions of these methods.
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.
188
176
 
189
177
  If you want to silence warnings about builtins, you can add the list of builtins to the `externals` option; like so:
190
178