@rollup/plugin-node-resolve 15.3.0 → 16.0.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/README.md +1 -1
- package/dist/cjs/index.js +14 -6
- package/dist/es/index.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
@@ -53,7 +53,7 @@ This plugin supports the package entrypoints feature from node js, specified in
|
|
53
53
|
Type: `Array[...String]`<br>
|
54
54
|
Default: `[]`
|
55
55
|
|
56
|
-
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.
|
56
|
+
Additional conditions of the package.json exports field to match when resolving modules. By default, this plugin looks for the `['default', 'module', 'import', 'development|production']` conditions when resolving imports. If neither the `development` or `production` conditions are provided it will default to `production` - or `development` if `NODE_ENV` is set to a value other than `production`.
|
57
57
|
|
58
58
|
When using `@rollup/plugin-commonjs` v16 or higher, this plugin will use the `['default', 'module', 'require']` conditions when resolving require statements.
|
59
59
|
|
package/dist/cjs/index.js
CHANGED
@@ -12,7 +12,7 @@ var url = require('url');
|
|
12
12
|
var resolve = require('resolve');
|
13
13
|
var pluginutils = require('@rollup/pluginutils');
|
14
14
|
|
15
|
-
var version = "
|
15
|
+
var version = "16.0.0";
|
16
16
|
var peerDependencies = {
|
17
17
|
rollup: "^2.78.0||^3.0.0||^4.0.0"
|
18
18
|
};
|
@@ -1067,8 +1067,17 @@ function nodeResolve(opts = {}) {
|
|
1067
1067
|
|
1068
1068
|
const options = { ...defaults, ...opts };
|
1069
1069
|
const { extensions, jail, moduleDirectories, modulePaths, ignoreSideEffectsForRoot } = options;
|
1070
|
-
const
|
1071
|
-
const
|
1070
|
+
const exportConditions = options.exportConditions || [];
|
1071
|
+
const devProdCondition =
|
1072
|
+
exportConditions.includes('development') || exportConditions.includes('production')
|
1073
|
+
? []
|
1074
|
+
: [
|
1075
|
+
process.env.NODE_ENV && process.env.NODE_ENV !== 'production'
|
1076
|
+
? 'development'
|
1077
|
+
: 'production'
|
1078
|
+
];
|
1079
|
+
const conditionsEsm = [...baseConditionsEsm, ...exportConditions, ...devProdCondition];
|
1080
|
+
const conditionsCjs = [...baseConditionsCjs, ...exportConditions, ...devProdCondition];
|
1072
1081
|
const packageInfoCache = new Map();
|
1073
1082
|
const idToPackageInfo = new Map();
|
1074
1083
|
const mainFields = getMainFields(options);
|
@@ -1186,7 +1195,6 @@ function nodeResolve(opts = {}) {
|
|
1186
1195
|
const warn = (...args) => context.warn(...args);
|
1187
1196
|
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1188
1197
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1189
|
-
|
1190
1198
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
1191
1199
|
exportConditions.push('browser');
|
1192
1200
|
|
@@ -1307,7 +1315,7 @@ function nodeResolve(opts = {}) {
|
|
1307
1315
|
return importee;
|
1308
1316
|
}
|
1309
1317
|
// ignore IDs with null character, these belong to other plugins
|
1310
|
-
if (
|
1318
|
+
if (importee && importee.includes('\0')) return null;
|
1311
1319
|
|
1312
1320
|
const { custom = {} } = resolveOptions;
|
1313
1321
|
const { 'node-resolve': { resolved: alreadyResolved } = {} } = custom;
|
@@ -1315,7 +1323,7 @@ function nodeResolve(opts = {}) {
|
|
1315
1323
|
return alreadyResolved;
|
1316
1324
|
}
|
1317
1325
|
|
1318
|
-
if (
|
1326
|
+
if (importer && importer.includes('\0')) {
|
1319
1327
|
importer = undefined;
|
1320
1328
|
}
|
1321
1329
|
|
package/dist/es/index.js
CHANGED
@@ -8,7 +8,7 @@ import { pathToFileURL, fileURLToPath } from 'url';
|
|
8
8
|
import resolve$1 from 'resolve';
|
9
9
|
import { createFilter } from '@rollup/pluginutils';
|
10
10
|
|
11
|
-
var version = "
|
11
|
+
var version = "16.0.0";
|
12
12
|
var peerDependencies = {
|
13
13
|
rollup: "^2.78.0||^3.0.0||^4.0.0"
|
14
14
|
};
|
@@ -1063,8 +1063,17 @@ function nodeResolve(opts = {}) {
|
|
1063
1063
|
|
1064
1064
|
const options = { ...defaults, ...opts };
|
1065
1065
|
const { extensions, jail, moduleDirectories, modulePaths, ignoreSideEffectsForRoot } = options;
|
1066
|
-
const
|
1067
|
-
const
|
1066
|
+
const exportConditions = options.exportConditions || [];
|
1067
|
+
const devProdCondition =
|
1068
|
+
exportConditions.includes('development') || exportConditions.includes('production')
|
1069
|
+
? []
|
1070
|
+
: [
|
1071
|
+
process.env.NODE_ENV && process.env.NODE_ENV !== 'production'
|
1072
|
+
? 'development'
|
1073
|
+
: 'production'
|
1074
|
+
];
|
1075
|
+
const conditionsEsm = [...baseConditionsEsm, ...exportConditions, ...devProdCondition];
|
1076
|
+
const conditionsCjs = [...baseConditionsCjs, ...exportConditions, ...devProdCondition];
|
1068
1077
|
const packageInfoCache = new Map();
|
1069
1078
|
const idToPackageInfo = new Map();
|
1070
1079
|
const mainFields = getMainFields(options);
|
@@ -1182,7 +1191,6 @@ function nodeResolve(opts = {}) {
|
|
1182
1191
|
const warn = (...args) => context.warn(...args);
|
1183
1192
|
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1184
1193
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1185
|
-
|
1186
1194
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
1187
1195
|
exportConditions.push('browser');
|
1188
1196
|
|
@@ -1303,7 +1311,7 @@ function nodeResolve(opts = {}) {
|
|
1303
1311
|
return importee;
|
1304
1312
|
}
|
1305
1313
|
// ignore IDs with null character, these belong to other plugins
|
1306
|
-
if (
|
1314
|
+
if (importee && importee.includes('\0')) return null;
|
1307
1315
|
|
1308
1316
|
const { custom = {} } = resolveOptions;
|
1309
1317
|
const { 'node-resolve': { resolved: alreadyResolved } = {} } = custom;
|
@@ -1311,7 +1319,7 @@ function nodeResolve(opts = {}) {
|
|
1311
1319
|
return alreadyResolved;
|
1312
1320
|
}
|
1313
1321
|
|
1314
|
-
if (
|
1322
|
+
if (importer && importer.includes('\0')) {
|
1315
1323
|
importer = undefined;
|
1316
1324
|
}
|
1317
1325
|
|