@rollup/plugin-node-resolve 13.0.5 → 13.0.6
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 +8 -0
- package/dist/cjs/index.js +23 -20
- package/dist/es/index.js +10 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
@@ -21,10 +21,10 @@ 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
|
-
util.promisify(fs__default[
|
25
|
-
const readFile$1 = util.promisify(fs__default[
|
26
|
-
const realpath = util.promisify(fs__default[
|
27
|
-
const stat = util.promisify(fs__default[
|
24
|
+
util.promisify(fs__default["default"].access);
|
25
|
+
const readFile$1 = util.promisify(fs__default["default"].readFile);
|
26
|
+
const realpath = util.promisify(fs__default["default"].realpath);
|
27
|
+
const stat = util.promisify(fs__default["default"].stat);
|
28
28
|
|
29
29
|
async function fileExists(filePath) {
|
30
30
|
try {
|
@@ -261,16 +261,16 @@ function isModuleDir(current, moduleDirs) {
|
|
261
261
|
}
|
262
262
|
|
263
263
|
async function findPackageJson(base, moduleDirs) {
|
264
|
-
const { root } = path__default[
|
264
|
+
const { root } = path__default["default"].parse(base);
|
265
265
|
let current = base;
|
266
266
|
|
267
267
|
while (current !== root && !isModuleDir(current, moduleDirs)) {
|
268
|
-
const pkgJsonPath = path__default[
|
268
|
+
const pkgJsonPath = path__default["default"].join(current, 'package.json');
|
269
269
|
if (await fileExists(pkgJsonPath)) {
|
270
|
-
const pkgJsonString = fs__default[
|
270
|
+
const pkgJsonString = fs__default["default"].readFileSync(pkgJsonPath, 'utf-8');
|
271
271
|
return { pkgJson: JSON.parse(pkgJsonString), pkgPath: current, pkgJsonPath };
|
272
272
|
}
|
273
|
-
current = path__default[
|
273
|
+
current = path__default["default"].resolve(current, '..');
|
274
274
|
}
|
275
275
|
return null;
|
276
276
|
}
|
@@ -554,8 +554,8 @@ async function resolvePackageImports({
|
|
554
554
|
});
|
555
555
|
}
|
556
556
|
|
557
|
-
const resolveImportPath = util.promisify(resolve__default[
|
558
|
-
const readFile = util.promisify(fs__default[
|
557
|
+
const resolveImportPath = util.promisify(resolve__default["default"]);
|
558
|
+
const readFile = util.promisify(fs__default["default"].readFile);
|
559
559
|
|
560
560
|
async function getPackageJson(importer, pkgName, resolveOptions, moduleDirectories) {
|
561
561
|
if (importer) {
|
@@ -910,7 +910,7 @@ function handleDeprecatedOptions(opts) {
|
|
910
910
|
|
911
911
|
/* eslint-disable no-param-reassign, no-shadow, no-undefined */
|
912
912
|
|
913
|
-
const builtins = new Set(builtinList__default[
|
913
|
+
const builtins = new Set(builtinList__default["default"]);
|
914
914
|
const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js';
|
915
915
|
const deepFreeze = (object) => {
|
916
916
|
Object.freeze(object);
|
@@ -936,7 +936,7 @@ const defaults = {
|
|
936
936
|
moduleDirectories: ['node_modules'],
|
937
937
|
ignoreSideEffectsForRoot: false
|
938
938
|
};
|
939
|
-
const DEFAULTS = deepFreeze(deepMerge__default[
|
939
|
+
const DEFAULTS = deepFreeze(deepMerge__default["default"]({}, defaults));
|
940
940
|
|
941
941
|
function nodeResolve(opts = {}) {
|
942
942
|
const { warnings } = handleDeprecatedOptions(opts);
|
@@ -971,7 +971,7 @@ function nodeResolve(opts = {}) {
|
|
971
971
|
const browserMapCache = new Map();
|
972
972
|
let preserveSymlinks;
|
973
973
|
|
974
|
-
const doResolveId = async (context, importee, importer,
|
974
|
+
const doResolveId = async (context, importee, importer, custom) => {
|
975
975
|
// strip query params from import
|
976
976
|
const [importPath, params] = importee.split('?');
|
977
977
|
const importSuffix = `${params ? `?${params}` : ''}`;
|
@@ -1041,8 +1041,7 @@ function nodeResolve(opts = {}) {
|
|
1041
1041
|
}
|
1042
1042
|
|
1043
1043
|
const warn = (...args) => context.warn(...args);
|
1044
|
-
const isRequire =
|
1045
|
-
opts && opts.custom && opts.custom['node-resolve'] && opts.custom['node-resolve'].isRequire;
|
1044
|
+
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1046
1045
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1047
1046
|
|
1048
1047
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
@@ -1115,7 +1114,7 @@ function nodeResolve(opts = {}) {
|
|
1115
1114
|
|
1116
1115
|
if (options.modulesOnly && (await fileExists(location))) {
|
1117
1116
|
const code = await readFile$1(location, 'utf-8');
|
1118
|
-
if (isModule__default[
|
1117
|
+
if (isModule__default["default"](code)) {
|
1119
1118
|
return {
|
1120
1119
|
id: `${location}${importSuffix}`,
|
1121
1120
|
moduleSideEffects: hasModuleSideEffects(location)
|
@@ -1149,7 +1148,7 @@ function nodeResolve(opts = {}) {
|
|
1149
1148
|
isDirCached.clear();
|
1150
1149
|
},
|
1151
1150
|
|
1152
|
-
async resolveId(importee, importer,
|
1151
|
+
async resolveId(importee, importer, resolveOptions) {
|
1153
1152
|
if (importee === ES6_BROWSER_EMPTY) {
|
1154
1153
|
return importee;
|
1155
1154
|
}
|
@@ -1160,9 +1159,13 @@ function nodeResolve(opts = {}) {
|
|
1160
1159
|
importer = undefined;
|
1161
1160
|
}
|
1162
1161
|
|
1163
|
-
const resolved = await doResolveId(this, importee, importer,
|
1162
|
+
const resolved = await doResolveId(this, importee, importer, resolveOptions.custom);
|
1164
1163
|
if (resolved) {
|
1165
|
-
const resolvedResolved = await this.resolve(
|
1164
|
+
const resolvedResolved = await this.resolve(
|
1165
|
+
resolved.id,
|
1166
|
+
importer,
|
1167
|
+
Object.assign({ skipSelf: true }, resolveOptions)
|
1168
|
+
);
|
1166
1169
|
const isExternal = !!(resolvedResolved && resolvedResolved.external);
|
1167
1170
|
if (isExternal) {
|
1168
1171
|
return false;
|
@@ -1185,5 +1188,5 @@ function nodeResolve(opts = {}) {
|
|
1185
1188
|
}
|
1186
1189
|
|
1187
1190
|
exports.DEFAULTS = DEFAULTS;
|
1188
|
-
exports
|
1191
|
+
exports["default"] = nodeResolve;
|
1189
1192
|
exports.nodeResolve = nodeResolve;
|
package/dist/es/index.js
CHANGED
@@ -958,7 +958,7 @@ function nodeResolve(opts = {}) {
|
|
958
958
|
const browserMapCache = new Map();
|
959
959
|
let preserveSymlinks;
|
960
960
|
|
961
|
-
const doResolveId = async (context, importee, importer,
|
961
|
+
const doResolveId = async (context, importee, importer, custom) => {
|
962
962
|
// strip query params from import
|
963
963
|
const [importPath, params] = importee.split('?');
|
964
964
|
const importSuffix = `${params ? `?${params}` : ''}`;
|
@@ -1028,8 +1028,7 @@ function nodeResolve(opts = {}) {
|
|
1028
1028
|
}
|
1029
1029
|
|
1030
1030
|
const warn = (...args) => context.warn(...args);
|
1031
|
-
const isRequire =
|
1032
|
-
opts && opts.custom && opts.custom['node-resolve'] && opts.custom['node-resolve'].isRequire;
|
1031
|
+
const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire;
|
1033
1032
|
const exportConditions = isRequire ? conditionsCjs : conditionsEsm;
|
1034
1033
|
|
1035
1034
|
if (useBrowserOverrides && !exportConditions.includes('browser'))
|
@@ -1136,7 +1135,7 @@ function nodeResolve(opts = {}) {
|
|
1136
1135
|
isDirCached.clear();
|
1137
1136
|
},
|
1138
1137
|
|
1139
|
-
async resolveId(importee, importer,
|
1138
|
+
async resolveId(importee, importer, resolveOptions) {
|
1140
1139
|
if (importee === ES6_BROWSER_EMPTY) {
|
1141
1140
|
return importee;
|
1142
1141
|
}
|
@@ -1147,9 +1146,13 @@ function nodeResolve(opts = {}) {
|
|
1147
1146
|
importer = undefined;
|
1148
1147
|
}
|
1149
1148
|
|
1150
|
-
const resolved = await doResolveId(this, importee, importer,
|
1149
|
+
const resolved = await doResolveId(this, importee, importer, resolveOptions.custom);
|
1151
1150
|
if (resolved) {
|
1152
|
-
const resolvedResolved = await this.resolve(
|
1151
|
+
const resolvedResolved = await this.resolve(
|
1152
|
+
resolved.id,
|
1153
|
+
importer,
|
1154
|
+
Object.assign({ skipSelf: true }, resolveOptions)
|
1155
|
+
);
|
1153
1156
|
const isExternal = !!(resolvedResolved && resolvedResolved.external);
|
1154
1157
|
if (isExternal) {
|
1155
1158
|
return false;
|
@@ -1171,5 +1174,4 @@ function nodeResolve(opts = {}) {
|
|
1171
1174
|
};
|
1172
1175
|
}
|
1173
1176
|
|
1174
|
-
export default nodeResolve;
|
1175
|
-
export { DEFAULTS, nodeResolve };
|
1177
|
+
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.0.
|
3
|
+
"version": "13.0.6",
|
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
|
},
|