@rollup/plugin-node-resolve 8.1.0 → 8.4.0
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 +42 -0
- package/README.md +3 -3
- package/dist/cjs/index.js +66 -3
- package/dist/es/index.js +66 -3
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,47 @@
|
|
1
1
|
# @rollup/plugin-node-resolve ChangeLog
|
2
2
|
|
3
|
+
## v8.4.0
|
4
|
+
|
5
|
+
_2020-07-12_
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
- feat: preserve search params and hashes (#487)
|
10
|
+
- feat: support .js imports in TypeScript (#480)
|
11
|
+
|
12
|
+
### Updates
|
13
|
+
|
14
|
+
- docs: fix named export use in readme (#456)
|
15
|
+
- docs: correct mainFields valid values (#469)
|
16
|
+
|
17
|
+
## v8.3.0
|
18
|
+
|
19
|
+
_2020-07-12_
|
20
|
+
|
21
|
+
### Features
|
22
|
+
|
23
|
+
- feat: preserve search params and hashes (#487)
|
24
|
+
- feat: support .js imports in TypeScript (#480)
|
25
|
+
|
26
|
+
### Updates
|
27
|
+
|
28
|
+
- docs: fix named export use in readme (#456)
|
29
|
+
- docs: correct mainFields valid values (#469)
|
30
|
+
|
31
|
+
## v8.2.0
|
32
|
+
|
33
|
+
_2020-07-12_
|
34
|
+
|
35
|
+
### Features
|
36
|
+
|
37
|
+
- feat: preserve search params and hashes (#487)
|
38
|
+
- feat: support .js imports in TypeScript (#480)
|
39
|
+
|
40
|
+
### Updates
|
41
|
+
|
42
|
+
- docs: fix named export use in readme (#456)
|
43
|
+
- docs: correct mainFields valid values (#469)
|
44
|
+
|
3
45
|
## v8.1.0
|
4
46
|
|
5
47
|
_2020-06-22_
|
package/README.md
CHANGED
@@ -28,7 +28,7 @@ npm install @rollup/plugin-node-resolve --save-dev
|
|
28
28
|
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:
|
29
29
|
|
30
30
|
```js
|
31
|
-
import
|
31
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
32
32
|
|
33
33
|
export default {
|
34
34
|
input: 'src/index.js',
|
@@ -36,7 +36,7 @@ export default {
|
|
36
36
|
dir: 'output',
|
37
37
|
format: 'cjs'
|
38
38
|
},
|
39
|
-
plugins: [
|
39
|
+
plugins: [nodeResolve()]
|
40
40
|
};
|
41
41
|
```
|
42
42
|
|
@@ -107,7 +107,7 @@ Locks the module search within specified path (e.g. chroot). Modules defined out
|
|
107
107
|
|
108
108
|
Type: `Array[...String]`<br>
|
109
109
|
Default: `['module', 'main']`<br>
|
110
|
-
Valid values: `['browser', 'jsnext', 'module', 'main']`
|
110
|
+
Valid values: `['browser', 'jsnext:main', 'module', 'main']`
|
111
111
|
|
112
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.
|
113
113
|
|
package/dist/cjs/index.js
CHANGED
@@ -51,6 +51,41 @@ function _asyncToGenerator(fn) {
|
|
51
51
|
};
|
52
52
|
}
|
53
53
|
|
54
|
+
function _slicedToArray(arr, i) {
|
55
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
56
|
+
}
|
57
|
+
|
58
|
+
function _arrayWithHoles(arr) {
|
59
|
+
if (Array.isArray(arr)) return arr;
|
60
|
+
}
|
61
|
+
|
62
|
+
function _iterableToArrayLimit(arr, i) {
|
63
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
64
|
+
var _arr = [];
|
65
|
+
var _n = true;
|
66
|
+
var _d = false;
|
67
|
+
var _e = undefined;
|
68
|
+
|
69
|
+
try {
|
70
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
71
|
+
_arr.push(_s.value);
|
72
|
+
|
73
|
+
if (i && _arr.length === i) break;
|
74
|
+
}
|
75
|
+
} catch (err) {
|
76
|
+
_d = true;
|
77
|
+
_e = err;
|
78
|
+
} finally {
|
79
|
+
try {
|
80
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
81
|
+
} finally {
|
82
|
+
if (_d) throw _e;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
return _arr;
|
87
|
+
}
|
88
|
+
|
54
89
|
function _unsupportedIterableToArray(o, minLen) {
|
55
90
|
if (!o) return;
|
56
91
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
@@ -68,6 +103,10 @@ function _arrayLikeToArray(arr, len) {
|
|
68
103
|
return arr2;
|
69
104
|
}
|
70
105
|
|
106
|
+
function _nonIterableRest() {
|
107
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
108
|
+
}
|
109
|
+
|
71
110
|
function _createForOfIteratorHelper(o) {
|
72
111
|
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
73
112
|
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
|
@@ -468,7 +507,20 @@ function nodeResolve(opts = {}) {
|
|
468
507
|
} // ignore IDs with null character, these belong to other plugins
|
469
508
|
|
470
509
|
|
471
|
-
if (/\0/.test(importee)) return null;
|
510
|
+
if (/\0/.test(importee)) return null; // strip hash and query params from import
|
511
|
+
|
512
|
+
const _importee$split = importee.split('#'),
|
513
|
+
_importee$split2 = _slicedToArray(_importee$split, 2),
|
514
|
+
withoutHash = _importee$split2[0],
|
515
|
+
hash = _importee$split2[1];
|
516
|
+
|
517
|
+
const _withoutHash$split = withoutHash.split('?'),
|
518
|
+
_withoutHash$split2 = _slicedToArray(_withoutHash$split, 2),
|
519
|
+
importPath = _withoutHash$split2[0],
|
520
|
+
params = _withoutHash$split2[1];
|
521
|
+
|
522
|
+
const importSuffix = `${params ? `?${params}` : ''}${hash ? `#${hash}` : ''}`;
|
523
|
+
importee = importPath;
|
472
524
|
const basedir = !importer || dedupe(importee) ? rootDir : path.dirname(importer); // https://github.com/defunctzombie/package-browser-field-spec
|
473
525
|
|
474
526
|
const browser = browserMapCache.get(importer);
|
@@ -565,6 +617,17 @@ function nodeResolve(opts = {}) {
|
|
565
617
|
// find anything, we resolve the builtin which just returns back
|
566
618
|
// the built-in's name.
|
567
619
|
importSpecifierList.push(`${importee}/`);
|
620
|
+
} // TypeScript files may import '.js' to refer to either '.ts' or '.tsx'
|
621
|
+
|
622
|
+
|
623
|
+
if (importer && importee.endsWith('.js')) {
|
624
|
+
for (var _i = 0, _arr = ['.ts', '.tsx']; _i < _arr.length; _i++) {
|
625
|
+
const ext = _arr[_i];
|
626
|
+
|
627
|
+
if (importer.endsWith(ext) && extensions.includes(ext)) {
|
628
|
+
importSpecifierList.push(importee.replace(/.js$/, ext));
|
629
|
+
}
|
630
|
+
}
|
568
631
|
}
|
569
632
|
|
570
633
|
importSpecifierList.push(importee);
|
@@ -615,7 +678,7 @@ function nodeResolve(opts = {}) {
|
|
615
678
|
|
616
679
|
if (isModule(code)) {
|
617
680
|
return {
|
618
|
-
id: resolved
|
681
|
+
id: `${resolved}${importSuffix}`,
|
619
682
|
moduleSideEffects: hasModuleSideEffects(resolved)
|
620
683
|
};
|
621
684
|
}
|
@@ -624,7 +687,7 @@ function nodeResolve(opts = {}) {
|
|
624
687
|
}
|
625
688
|
|
626
689
|
const result = {
|
627
|
-
id: resolved
|
690
|
+
id: `${resolved}${importSuffix}`,
|
628
691
|
moduleSideEffects: hasModuleSideEffects(resolved)
|
629
692
|
};
|
630
693
|
return result;
|
package/dist/es/index.js
CHANGED
@@ -44,6 +44,41 @@ function _asyncToGenerator(fn) {
|
|
44
44
|
};
|
45
45
|
}
|
46
46
|
|
47
|
+
function _slicedToArray(arr, i) {
|
48
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
49
|
+
}
|
50
|
+
|
51
|
+
function _arrayWithHoles(arr) {
|
52
|
+
if (Array.isArray(arr)) return arr;
|
53
|
+
}
|
54
|
+
|
55
|
+
function _iterableToArrayLimit(arr, i) {
|
56
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
57
|
+
var _arr = [];
|
58
|
+
var _n = true;
|
59
|
+
var _d = false;
|
60
|
+
var _e = undefined;
|
61
|
+
|
62
|
+
try {
|
63
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
64
|
+
_arr.push(_s.value);
|
65
|
+
|
66
|
+
if (i && _arr.length === i) break;
|
67
|
+
}
|
68
|
+
} catch (err) {
|
69
|
+
_d = true;
|
70
|
+
_e = err;
|
71
|
+
} finally {
|
72
|
+
try {
|
73
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
74
|
+
} finally {
|
75
|
+
if (_d) throw _e;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
return _arr;
|
80
|
+
}
|
81
|
+
|
47
82
|
function _unsupportedIterableToArray(o, minLen) {
|
48
83
|
if (!o) return;
|
49
84
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
@@ -61,6 +96,10 @@ function _arrayLikeToArray(arr, len) {
|
|
61
96
|
return arr2;
|
62
97
|
}
|
63
98
|
|
99
|
+
function _nonIterableRest() {
|
100
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
101
|
+
}
|
102
|
+
|
64
103
|
function _createForOfIteratorHelper(o) {
|
65
104
|
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
66
105
|
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
|
@@ -461,7 +500,20 @@ function nodeResolve(opts = {}) {
|
|
461
500
|
} // ignore IDs with null character, these belong to other plugins
|
462
501
|
|
463
502
|
|
464
|
-
if (/\0/.test(importee)) return null;
|
503
|
+
if (/\0/.test(importee)) return null; // strip hash and query params from import
|
504
|
+
|
505
|
+
const _importee$split = importee.split('#'),
|
506
|
+
_importee$split2 = _slicedToArray(_importee$split, 2),
|
507
|
+
withoutHash = _importee$split2[0],
|
508
|
+
hash = _importee$split2[1];
|
509
|
+
|
510
|
+
const _withoutHash$split = withoutHash.split('?'),
|
511
|
+
_withoutHash$split2 = _slicedToArray(_withoutHash$split, 2),
|
512
|
+
importPath = _withoutHash$split2[0],
|
513
|
+
params = _withoutHash$split2[1];
|
514
|
+
|
515
|
+
const importSuffix = `${params ? `?${params}` : ''}${hash ? `#${hash}` : ''}`;
|
516
|
+
importee = importPath;
|
465
517
|
const basedir = !importer || dedupe(importee) ? rootDir : dirname(importer); // https://github.com/defunctzombie/package-browser-field-spec
|
466
518
|
|
467
519
|
const browser = browserMapCache.get(importer);
|
@@ -558,6 +610,17 @@ function nodeResolve(opts = {}) {
|
|
558
610
|
// find anything, we resolve the builtin which just returns back
|
559
611
|
// the built-in's name.
|
560
612
|
importSpecifierList.push(`${importee}/`);
|
613
|
+
} // TypeScript files may import '.js' to refer to either '.ts' or '.tsx'
|
614
|
+
|
615
|
+
|
616
|
+
if (importer && importee.endsWith('.js')) {
|
617
|
+
for (var _i = 0, _arr = ['.ts', '.tsx']; _i < _arr.length; _i++) {
|
618
|
+
const ext = _arr[_i];
|
619
|
+
|
620
|
+
if (importer.endsWith(ext) && extensions.includes(ext)) {
|
621
|
+
importSpecifierList.push(importee.replace(/.js$/, ext));
|
622
|
+
}
|
623
|
+
}
|
561
624
|
}
|
562
625
|
|
563
626
|
importSpecifierList.push(importee);
|
@@ -608,7 +671,7 @@ function nodeResolve(opts = {}) {
|
|
608
671
|
|
609
672
|
if (isModule(code)) {
|
610
673
|
return {
|
611
|
-
id: resolved
|
674
|
+
id: `${resolved}${importSuffix}`,
|
612
675
|
moduleSideEffects: hasModuleSideEffects(resolved)
|
613
676
|
};
|
614
677
|
}
|
@@ -617,7 +680,7 @@ function nodeResolve(opts = {}) {
|
|
617
680
|
}
|
618
681
|
|
619
682
|
const result = {
|
620
|
-
id: resolved
|
683
|
+
id: `${resolved}${importSuffix}`,
|
621
684
|
moduleSideEffects: hasModuleSideEffects(resolved)
|
622
685
|
};
|
623
686
|
return result;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rollup/plugin-node-resolve",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.4.0",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -48,22 +48,23 @@
|
|
48
48
|
"rollup": "^1.20.0||^2.0.0"
|
49
49
|
},
|
50
50
|
"dependencies": {
|
51
|
-
"@rollup/pluginutils": "^3.0
|
52
|
-
"@types/resolve": "
|
51
|
+
"@rollup/pluginutils": "^3.1.0",
|
52
|
+
"@types/resolve": "1.17.1",
|
53
53
|
"builtin-modules": "^3.1.0",
|
54
54
|
"deep-freeze": "^0.0.1",
|
55
55
|
"deepmerge": "^4.2.2",
|
56
56
|
"is-module": "^1.0.0",
|
57
|
-
"resolve": "^1.
|
57
|
+
"resolve": "^1.17.0"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
|
-
"@babel/core": "^7.
|
61
|
-
"@babel/
|
62
|
-
"@
|
60
|
+
"@babel/core": "^7.10.4",
|
61
|
+
"@babel/plugin-transform-typescript": "^7.10.4",
|
62
|
+
"@babel/preset-env": "^7.10.4",
|
63
|
+
"@rollup/plugin-babel": "^5.0.4",
|
64
|
+
"@rollup/plugin-commonjs": "^13.0.0",
|
65
|
+
"@rollup/plugin-json": "^4.1.0",
|
63
66
|
"es5-ext": "^0.10.53",
|
64
67
|
"rollup": "^2.12.0",
|
65
|
-
"rollup-plugin-babel": "^4.3.3",
|
66
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
67
68
|
"source-map": "^0.7.3",
|
68
69
|
"string-capitalize": "^1.0.1"
|
69
70
|
},
|