@rollup/plugin-node-resolve 13.0.4 → 13.1.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 +36 -4
- package/README.md +1 -1
- package/dist/cjs/index.js +27 -20
- package/dist/es/index.js +14 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,44 @@
|
|
1
1
|
# @rollup/plugin-node-resolve ChangeLog
|
2
2
|
|
3
|
+
## v13.1.1
|
4
|
+
|
5
|
+
_2021-12-13_
|
6
|
+
|
7
|
+
### Updates
|
8
|
+
|
9
|
+
- test: add tests for mixing custom `exportConditions` with `browser: true` (#1043)
|
10
|
+
|
11
|
+
## v13.1.0
|
12
|
+
|
13
|
+
_2021-12-13_
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
- feat: expose plugin version (#1050)
|
18
|
+
|
19
|
+
## v13.0.6
|
20
|
+
|
21
|
+
_2021-10-19_
|
22
|
+
|
23
|
+
### Bugfixes
|
24
|
+
|
25
|
+
- fix: pass on isEntry flag (#1016)
|
26
|
+
|
27
|
+
## v13.0.5
|
28
|
+
|
29
|
+
_2021-09-21_
|
30
|
+
|
31
|
+
### Updates
|
32
|
+
|
33
|
+
- docs: fix readme heading depth (#999)
|
34
|
+
|
3
35
|
## v13.0.4
|
4
36
|
|
5
37
|
_2021-07-24_
|
6
38
|
|
7
39
|
### Bugfixes
|
8
40
|
|
9
|
-
- fix
|
41
|
+
- fix: Fix bug where JS import was converted to a TS import, resulting in an error when using export maps (#921)
|
10
42
|
|
11
43
|
## v13.0.3
|
12
44
|
|
@@ -14,7 +46,7 @@ _2021-07-24_
|
|
14
46
|
|
15
47
|
### Bugfixes
|
16
48
|
|
17
|
-
- fix
|
49
|
+
- fix: handle browser-mapped paths correctly in nested contexts (#920)
|
18
50
|
|
19
51
|
## v13.0.2
|
20
52
|
|
@@ -22,7 +54,7 @@ _2021-07-15_
|
|
22
54
|
|
23
55
|
### Bugfixes
|
24
56
|
|
25
|
-
- fix
|
57
|
+
- fix: handle "package.json" being in path (#927)
|
26
58
|
|
27
59
|
## v13.0.1
|
28
60
|
|
@@ -467,4 +499,4 @@ This release caches reading/statting of files, to improve speed.
|
|
467
499
|
|
468
500
|
## 0.1.0
|
469
501
|
|
470
|
-
- First release
|
502
|
+
- First release
|
package/README.md
CHANGED
@@ -159,7 +159,7 @@ Specifies the root directory from which to resolve modules. Typically used when
|
|
159
159
|
rootDir: path.join(process.cwd(), '..')
|
160
160
|
```
|
161
161
|
|
162
|
-
|
162
|
+
### `ignoreSideEffectsForRoot`
|
163
163
|
|
164
164
|
If you use the `sideEffects` property in the package.json, by default this is respected for files in the root package. Set to `true` to ignore the `sideEffects` configuration for the root package.
|
165
165
|
|
package/dist/cjs/index.js
CHANGED
@@ -21,10 +21,12 @@ var isModule__default = /*#__PURE__*/_interopDefaultLegacy(isModule);
|
|
21
21
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
22
22
|
var resolve__default = /*#__PURE__*/_interopDefaultLegacy(resolve);
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
const
|
24
|
+
var version = "13.1.0";
|
25
|
+
|
26
|
+
util.promisify(fs__default["default"].access);
|
27
|
+
const readFile$1 = util.promisify(fs__default["default"].readFile);
|
28
|
+
const realpath = util.promisify(fs__default["default"].realpath);
|
29
|
+
const stat = util.promisify(fs__default["default"].stat);
|
28
30
|
|
29
31
|
async function fileExists(filePath) {
|
30
32
|
try {
|
@@ -261,16 +263,16 @@ function isModuleDir(current, moduleDirs) {
|
|
261
263
|
}
|
262
264
|
|
263
265
|
async function findPackageJson(base, moduleDirs) {
|
264
|
-
const { root } = path__default[
|
266
|
+
const { root } = path__default["default"].parse(base);
|
265
267
|
let current = base;
|
266
268
|
|
267
269
|
while (current !== root && !isModuleDir(current, moduleDirs)) {
|
268
|
-
const pkgJsonPath = path__default[
|
270
|
+
const pkgJsonPath = path__default["default"].join(current, 'package.json');
|
269
271
|
if (await fileExists(pkgJsonPath)) {
|
270
|
-
const pkgJsonString = fs__default[
|
272
|
+
const pkgJsonString = fs__default["default"].readFileSync(pkgJsonPath, 'utf-8');
|
271
273
|
return { pkgJson: JSON.parse(pkgJsonString), pkgPath: current, pkgJsonPath };
|
272
274
|
}
|
273
|
-
current = path__default[
|
275
|
+
current = path__default["default"].resolve(current, '..');
|
274
276
|
}
|
275
277
|
return null;
|
276
278
|
}
|
@@ -554,8 +556,8 @@ async function resolvePackageImports({
|
|
554
556
|
});
|
555
557
|
}
|
556
558
|
|
557
|
-
const resolveImportPath = util.promisify(resolve__default[
|
558
|
-
const readFile = util.promisify(fs__default[
|
559
|
+
const resolveImportPath = util.promisify(resolve__default["default"]);
|
560
|
+
const readFile = util.promisify(fs__default["default"].readFile);
|
559
561
|
|
560
562
|
async function getPackageJson(importer, pkgName, resolveOptions, moduleDirectories) {
|
561
563
|
if (importer) {
|
@@ -910,7 +912,7 @@ function handleDeprecatedOptions(opts) {
|
|
910
912
|
|
911
913
|
/* eslint-disable no-param-reassign, no-shadow, no-undefined */
|
912
914
|
|
913
|
-
const builtins = new Set(builtinList__default[
|
915
|
+
const builtins = new Set(builtinList__default["default"]);
|
914
916
|
const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js';
|
915
917
|
const deepFreeze = (object) => {
|
916
918
|
Object.freeze(object);
|
@@ -936,7 +938,7 @@ const defaults = {
|
|
936
938
|
moduleDirectories: ['node_modules'],
|
937
939
|
ignoreSideEffectsForRoot: false
|
938
940
|
};
|
939
|
-
const DEFAULTS = deepFreeze(deepMerge__default[
|
941
|
+
const DEFAULTS = deepFreeze(deepMerge__default["default"]({}, defaults));
|
940
942
|
|
941
943
|
function nodeResolve(opts = {}) {
|
942
944
|
const { warnings } = handleDeprecatedOptions(opts);
|
@@ -971,7 +973,7 @@ function nodeResolve(opts = {}) {
|
|
971
973
|
const browserMapCache = new Map();
|
972
974
|
let preserveSymlinks;
|
973
975
|
|
974
|
-
const doResolveId = async (context, importee, importer,
|
976
|
+
const doResolveId = async (context, importee, importer, custom) => {
|
975
977
|
// strip query params from import
|
976
978
|
const [importPath, params] = importee.split('?');
|
977
979
|
const importSuffix = `${params ? `?${params}` : ''}`;
|
@@ -1041,8 +1043,7 @@ function nodeResolve(opts = {}) {
|
|
1041
1043
|
}
|
1042
1044
|
|
1043
1045
|
const warn = (...args) => context.warn(...args);
|
1044
|
-
const isRequire =
|
1045
|
-
opts && opts.custom && opts.custom['node-resolve'] && opts.custom['node-resolve'].isRequire;
|
1046
|
+
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1046
1047
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1047
1048
|
|
1048
1049
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
@@ -1115,7 +1116,7 @@ function nodeResolve(opts = {}) {
|
|
1115
1116
|
|
1116
1117
|
if (options.modulesOnly && (await fileExists(location))) {
|
1117
1118
|
const code = await readFile$1(location, 'utf-8');
|
1118
|
-
if (isModule__default[
|
1119
|
+
if (isModule__default["default"](code)) {
|
1119
1120
|
return {
|
1120
1121
|
id: `${location}${importSuffix}`,
|
1121
1122
|
moduleSideEffects: hasModuleSideEffects(location)
|
@@ -1133,6 +1134,8 @@ function nodeResolve(opts = {}) {
|
|
1133
1134
|
return {
|
1134
1135
|
name: 'node-resolve',
|
1135
1136
|
|
1137
|
+
version,
|
1138
|
+
|
1136
1139
|
buildStart(options) {
|
1137
1140
|
rollupOptions = options;
|
1138
1141
|
|
@@ -1149,7 +1152,7 @@ function nodeResolve(opts = {}) {
|
|
1149
1152
|
isDirCached.clear();
|
1150
1153
|
},
|
1151
1154
|
|
1152
|
-
async resolveId(importee, importer,
|
1155
|
+
async resolveId(importee, importer, resolveOptions) {
|
1153
1156
|
if (importee === ES6_BROWSER_EMPTY) {
|
1154
1157
|
return importee;
|
1155
1158
|
}
|
@@ -1160,9 +1163,13 @@ function nodeResolve(opts = {}) {
|
|
1160
1163
|
importer = undefined;
|
1161
1164
|
}
|
1162
1165
|
|
1163
|
-
const resolved = await doResolveId(this, importee, importer,
|
1166
|
+
const resolved = await doResolveId(this, importee, importer, resolveOptions.custom);
|
1164
1167
|
if (resolved) {
|
1165
|
-
const resolvedResolved = await this.resolve(
|
1168
|
+
const resolvedResolved = await this.resolve(
|
1169
|
+
resolved.id,
|
1170
|
+
importer,
|
1171
|
+
Object.assign({ skipSelf: true }, resolveOptions)
|
1172
|
+
);
|
1166
1173
|
const isExternal = !!(resolvedResolved && resolvedResolved.external);
|
1167
1174
|
if (isExternal) {
|
1168
1175
|
return false;
|
@@ -1185,5 +1192,5 @@ function nodeResolve(opts = {}) {
|
|
1185
1192
|
}
|
1186
1193
|
|
1187
1194
|
exports.DEFAULTS = DEFAULTS;
|
1188
|
-
exports
|
1195
|
+
exports["default"] = nodeResolve;
|
1189
1196
|
exports.nodeResolve = nodeResolve;
|
package/dist/es/index.js
CHANGED
@@ -8,6 +8,8 @@ import { pathToFileURL, fileURLToPath } from 'url';
|
|
8
8
|
import resolve$1 from 'resolve';
|
9
9
|
import { createFilter } from '@rollup/pluginutils';
|
10
10
|
|
11
|
+
var version = "13.1.0";
|
12
|
+
|
11
13
|
promisify(fs.access);
|
12
14
|
const readFile$1 = promisify(fs.readFile);
|
13
15
|
const realpath = promisify(fs.realpath);
|
@@ -958,7 +960,7 @@ function nodeResolve(opts = {}) {
|
|
958
960
|
const browserMapCache = new Map();
|
959
961
|
let preserveSymlinks;
|
960
962
|
|
961
|
-
const doResolveId = async (context, importee, importer,
|
963
|
+
const doResolveId = async (context, importee, importer, custom) => {
|
962
964
|
// strip query params from import
|
963
965
|
const [importPath, params] = importee.split('?');
|
964
966
|
const importSuffix = `${params ? `?${params}` : ''}`;
|
@@ -1028,8 +1030,7 @@ function nodeResolve(opts = {}) {
|
|
1028
1030
|
}
|
1029
1031
|
|
1030
1032
|
const warn = (...args) => context.warn(...args);
|
1031
|
-
const isRequire =
|
1032
|
-
opts && opts.custom && opts.custom['node-resolve'] && opts.custom['node-resolve'].isRequire;
|
1033
|
+
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1033
1034
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1034
1035
|
|
1035
1036
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
@@ -1120,6 +1121,8 @@ function nodeResolve(opts = {}) {
|
|
1120
1121
|
return {
|
1121
1122
|
name: 'node-resolve',
|
1122
1123
|
|
1124
|
+
version,
|
1125
|
+
|
1123
1126
|
buildStart(options) {
|
1124
1127
|
rollupOptions = options;
|
1125
1128
|
|
@@ -1136,7 +1139,7 @@ function nodeResolve(opts = {}) {
|
|
1136
1139
|
isDirCached.clear();
|
1137
1140
|
},
|
1138
1141
|
|
1139
|
-
async resolveId(importee, importer,
|
1142
|
+
async resolveId(importee, importer, resolveOptions) {
|
1140
1143
|
if (importee === ES6_BROWSER_EMPTY) {
|
1141
1144
|
return importee;
|
1142
1145
|
}
|
@@ -1147,9 +1150,13 @@ function nodeResolve(opts = {}) {
|
|
1147
1150
|
importer = undefined;
|
1148
1151
|
}
|
1149
1152
|
|
1150
|
-
const resolved = await doResolveId(this, importee, importer,
|
1153
|
+
const resolved = await doResolveId(this, importee, importer, resolveOptions.custom);
|
1151
1154
|
if (resolved) {
|
1152
|
-
const resolvedResolved = await this.resolve(
|
1155
|
+
const resolvedResolved = await this.resolve(
|
1156
|
+
resolved.id,
|
1157
|
+
importer,
|
1158
|
+
Object.assign({ skipSelf: true }, resolveOptions)
|
1159
|
+
);
|
1153
1160
|
const isExternal = !!(resolvedResolved && resolvedResolved.external);
|
1154
1161
|
if (isExternal) {
|
1155
1162
|
return false;
|
@@ -1171,5 +1178,4 @@ function nodeResolve(opts = {}) {
|
|
1171
1178
|
};
|
1172
1179
|
}
|
1173
1180
|
|
1174
|
-
export default nodeResolve;
|
1175
|
-
export { DEFAULTS, nodeResolve };
|
1181
|
+
export { DEFAULTS, nodeResolve as default, nodeResolve };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rollup/plugin-node-resolve",
|
3
|
-
"version": "13.
|
3
|
+
"version": "13.1.1",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"@rollup/plugin-commonjs": "^16.0.0",
|
69
69
|
"@rollup/plugin-json": "^4.1.0",
|
70
70
|
"es5-ext": "^0.10.53",
|
71
|
-
"rollup": "^2.
|
71
|
+
"rollup": "^2.58.0",
|
72
72
|
"source-map": "^0.7.3",
|
73
73
|
"string-capitalize": "^1.0.1"
|
74
74
|
},
|