@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 +32 -0
- package/README.md +54 -66
- package/dist/index.es.js +441 -338
- package/dist/index.js +441 -338
- package/package.json +12 -12
- package/types/index.d.ts +37 -61
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
|
-
### `
|
47
|
+
### `browser`
|
48
48
|
|
49
|
-
Type: `
|
50
|
-
Default: `
|
51
|
-
Valid values: `['browser', 'jsnext', 'module', 'main']`
|
49
|
+
Type: `Boolean`<br>
|
50
|
+
Default: `false`
|
52
51
|
|
53
|
-
|
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
|
-
### `
|
54
|
+
### `customResolveOptions`
|
56
55
|
|
57
|
-
|
56
|
+
Type: `Object`<br>
|
57
|
+
Default: `null`
|
58
58
|
|
59
|
-
|
59
|
+
An `Object` that specifies additional options that should be passed through to [`resolve`](https://www.npmjs.com/package/resolve).
|
60
60
|
|
61
|
-
|
61
|
+
```
|
62
|
+
customResolveOptions: {
|
63
|
+
moduleDirectory: 'js_modules'
|
64
|
+
}
|
65
|
+
```
|
62
66
|
|
63
|
-
|
67
|
+
### `dedupe`
|
64
68
|
|
65
|
-
|
69
|
+
Type: `Array[...String]`<br>
|
70
|
+
Default: `[]`
|
66
71
|
|
67
|
-
|
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
|
-
|
74
|
+
```js
|
75
|
+
dedupe: ['my-package', '@namespace/my-package'];
|
76
|
+
```
|
70
77
|
|
71
|
-
|
78
|
+
This will deduplicate bare imports such as:
|
72
79
|
|
73
|
-
|
80
|
+
```js
|
81
|
+
import 'my-package';
|
82
|
+
import '@namespace/my-package';
|
83
|
+
```
|
74
84
|
|
75
|
-
|
76
|
-
Default: `false`
|
85
|
+
And it will deduplicate deep imports such as:
|
77
86
|
|
78
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
104
|
-
Default: `null`
|
105
|
-
|
106
|
-
Example: `only: ['some_module', /^@some_scope\/.*$/]`
|
107
|
-
|
108
|
-
### `modulesOnly`
|
106
|
+
### `mainFields`
|
109
107
|
|
110
|
-
Type: `
|
111
|
-
Default: `
|
108
|
+
Type: `Array[...String]`<br>
|
109
|
+
Default: `['module', 'main']`<br>
|
110
|
+
Valid values: `['browser', 'jsnext', 'module', 'main']`
|
112
111
|
|
113
|
-
|
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
|
-
### `
|
114
|
+
### `only`
|
116
115
|
|
117
|
-
|
118
|
-
Default: `[]`
|
116
|
+
DEPRECATED: use "resolveOnly" instead
|
119
117
|
|
120
|
-
|
118
|
+
### `preferBuiltins`
|
121
119
|
|
122
|
-
|
123
|
-
|
124
|
-
```
|
120
|
+
Type: `Boolean`<br>
|
121
|
+
Default: `true`
|
125
122
|
|
126
|
-
|
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
|
-
|
129
|
-
import 'my-package';
|
130
|
-
import '@namespace/my-package';
|
131
|
-
```
|
125
|
+
### `modulesOnly`
|
132
126
|
|
133
|
-
|
127
|
+
Type: `Boolean`<br>
|
128
|
+
Default: `false`
|
134
129
|
|
135
|
-
|
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
|
-
### `
|
132
|
+
### `resolveOnly`
|
141
133
|
|
142
|
-
Type: `
|
134
|
+
Type: `Array[...String|RegExp]`<br>
|
143
135
|
Default: `null`
|
144
136
|
|
145
|
-
|
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
|
-
|
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-
|
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
|
|