@rollup/plugin-node-resolve 13.1.1 → 13.1.2

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @rollup/plugin-node-resolve ChangeLog
2
2
 
3
+ ## v13.1.2
4
+
5
+ _2021-12-31_
6
+
7
+ ### Bugfixes
8
+
9
+ - fix: forward meta-information from other plugins (#1062)
10
+
3
11
  ## v13.1.1
4
12
 
5
13
  _2021-12-13_
package/dist/cjs/index.js CHANGED
@@ -21,7 +21,7 @@ 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
- var version = "13.1.0";
24
+ var version = "13.1.1";
25
25
 
26
26
  util.promisify(fs__default["default"].access);
27
27
  const readFile$1 = util.promisify(fs__default["default"].readFile);
@@ -95,6 +95,53 @@ const isFileCached = makeCache(async (file) => {
95
95
 
96
96
  const readCachedFile = makeCache(readFile$1);
97
97
 
98
+ function handleDeprecatedOptions(opts) {
99
+ const warnings = [];
100
+
101
+ if (opts.customResolveOptions) {
102
+ const { customResolveOptions } = opts;
103
+ if (customResolveOptions.moduleDirectory) {
104
+ // eslint-disable-next-line no-param-reassign
105
+ opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
106
+ ? customResolveOptions.moduleDirectory
107
+ : [customResolveOptions.moduleDirectory];
108
+
109
+ warnings.push(
110
+ 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
111
+ );
112
+ }
113
+
114
+ if (customResolveOptions.preserveSymlinks) {
115
+ throw new Error(
116
+ 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
117
+ );
118
+ }
119
+
120
+ [
121
+ 'basedir',
122
+ 'package',
123
+ 'extensions',
124
+ 'includeCoreModules',
125
+ 'readFile',
126
+ 'isFile',
127
+ 'isDirectory',
128
+ 'realpath',
129
+ 'packageFilter',
130
+ 'pathFilter',
131
+ 'paths',
132
+ 'packageIterator'
133
+ ].forEach((resolveOption) => {
134
+ if (customResolveOptions[resolveOption]) {
135
+ throw new Error(
136
+ `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
137
+ );
138
+ }
139
+ });
140
+ }
141
+
142
+ return { warnings };
143
+ }
144
+
98
145
  // returns the imported package name for bare module imports
99
146
  function getPackageName(id) {
100
147
  if (id.startsWith('.') || id.startsWith('/')) {
@@ -863,53 +910,6 @@ async function resolveImportSpecifiers({
863
910
  });
864
911
  }
865
912
 
866
- function handleDeprecatedOptions(opts) {
867
- const warnings = [];
868
-
869
- if (opts.customResolveOptions) {
870
- const { customResolveOptions } = opts;
871
- if (customResolveOptions.moduleDirectory) {
872
- // eslint-disable-next-line no-param-reassign
873
- opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
874
- ? customResolveOptions.moduleDirectory
875
- : [customResolveOptions.moduleDirectory];
876
-
877
- warnings.push(
878
- 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
879
- );
880
- }
881
-
882
- if (customResolveOptions.preserveSymlinks) {
883
- throw new Error(
884
- 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
885
- );
886
- }
887
-
888
- [
889
- 'basedir',
890
- 'package',
891
- 'extensions',
892
- 'includeCoreModules',
893
- 'readFile',
894
- 'isFile',
895
- 'isDirectory',
896
- 'realpath',
897
- 'packageFilter',
898
- 'pathFilter',
899
- 'paths',
900
- 'packageIterator'
901
- ].forEach((resolveOption) => {
902
- if (customResolveOptions[resolveOption]) {
903
- throw new Error(
904
- `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
905
- );
906
- }
907
- });
908
- }
909
-
910
- return { warnings };
911
- }
912
-
913
913
  /* eslint-disable no-param-reassign, no-shadow, no-undefined */
914
914
 
915
915
  const builtins = new Set(builtinList__default["default"]);
@@ -1124,11 +1124,10 @@ function nodeResolve(opts = {}) {
1124
1124
  }
1125
1125
  return null;
1126
1126
  }
1127
- const result = {
1127
+ return {
1128
1128
  id: `${location}${importSuffix}`,
1129
1129
  moduleSideEffects: hasModuleSideEffects(location)
1130
1130
  };
1131
- return result;
1132
1131
  };
1133
1132
 
1134
1133
  return {
@@ -1170,9 +1169,13 @@ function nodeResolve(opts = {}) {
1170
1169
  importer,
1171
1170
  Object.assign({ skipSelf: true }, resolveOptions)
1172
1171
  );
1173
- const isExternal = !!(resolvedResolved && resolvedResolved.external);
1174
- if (isExternal) {
1175
- return false;
1172
+ if (resolvedResolved) {
1173
+ // Handle plugins that manually make the result external
1174
+ if (resolvedResolved.external) {
1175
+ return false;
1176
+ }
1177
+ // Pass on meta information added by other plugins
1178
+ return { ...resolved, meta: resolvedResolved.meta };
1176
1179
  }
1177
1180
  }
1178
1181
  return resolved;
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 = "13.1.0";
11
+ var version = "13.1.1";
12
12
 
13
13
  promisify(fs.access);
14
14
  const readFile$1 = promisify(fs.readFile);
@@ -82,6 +82,53 @@ const isFileCached = makeCache(async (file) => {
82
82
 
83
83
  const readCachedFile = makeCache(readFile$1);
84
84
 
85
+ function handleDeprecatedOptions(opts) {
86
+ const warnings = [];
87
+
88
+ if (opts.customResolveOptions) {
89
+ const { customResolveOptions } = opts;
90
+ if (customResolveOptions.moduleDirectory) {
91
+ // eslint-disable-next-line no-param-reassign
92
+ opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
93
+ ? customResolveOptions.moduleDirectory
94
+ : [customResolveOptions.moduleDirectory];
95
+
96
+ warnings.push(
97
+ 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
98
+ );
99
+ }
100
+
101
+ if (customResolveOptions.preserveSymlinks) {
102
+ throw new Error(
103
+ 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
104
+ );
105
+ }
106
+
107
+ [
108
+ 'basedir',
109
+ 'package',
110
+ 'extensions',
111
+ 'includeCoreModules',
112
+ 'readFile',
113
+ 'isFile',
114
+ 'isDirectory',
115
+ 'realpath',
116
+ 'packageFilter',
117
+ 'pathFilter',
118
+ 'paths',
119
+ 'packageIterator'
120
+ ].forEach((resolveOption) => {
121
+ if (customResolveOptions[resolveOption]) {
122
+ throw new Error(
123
+ `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
124
+ );
125
+ }
126
+ });
127
+ }
128
+
129
+ return { warnings };
130
+ }
131
+
85
132
  // returns the imported package name for bare module imports
86
133
  function getPackageName(id) {
87
134
  if (id.startsWith('.') || id.startsWith('/')) {
@@ -850,53 +897,6 @@ async function resolveImportSpecifiers({
850
897
  });
851
898
  }
852
899
 
853
- function handleDeprecatedOptions(opts) {
854
- const warnings = [];
855
-
856
- if (opts.customResolveOptions) {
857
- const { customResolveOptions } = opts;
858
- if (customResolveOptions.moduleDirectory) {
859
- // eslint-disable-next-line no-param-reassign
860
- opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
861
- ? customResolveOptions.moduleDirectory
862
- : [customResolveOptions.moduleDirectory];
863
-
864
- warnings.push(
865
- 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
866
- );
867
- }
868
-
869
- if (customResolveOptions.preserveSymlinks) {
870
- throw new Error(
871
- 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
872
- );
873
- }
874
-
875
- [
876
- 'basedir',
877
- 'package',
878
- 'extensions',
879
- 'includeCoreModules',
880
- 'readFile',
881
- 'isFile',
882
- 'isDirectory',
883
- 'realpath',
884
- 'packageFilter',
885
- 'pathFilter',
886
- 'paths',
887
- 'packageIterator'
888
- ].forEach((resolveOption) => {
889
- if (customResolveOptions[resolveOption]) {
890
- throw new Error(
891
- `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
892
- );
893
- }
894
- });
895
- }
896
-
897
- return { warnings };
898
- }
899
-
900
900
  /* eslint-disable no-param-reassign, no-shadow, no-undefined */
901
901
 
902
902
  const builtins = new Set(builtinList);
@@ -1111,11 +1111,10 @@ function nodeResolve(opts = {}) {
1111
1111
  }
1112
1112
  return null;
1113
1113
  }
1114
- const result = {
1114
+ return {
1115
1115
  id: `${location}${importSuffix}`,
1116
1116
  moduleSideEffects: hasModuleSideEffects(location)
1117
1117
  };
1118
- return result;
1119
1118
  };
1120
1119
 
1121
1120
  return {
@@ -1157,9 +1156,13 @@ function nodeResolve(opts = {}) {
1157
1156
  importer,
1158
1157
  Object.assign({ skipSelf: true }, resolveOptions)
1159
1158
  );
1160
- const isExternal = !!(resolvedResolved && resolvedResolved.external);
1161
- if (isExternal) {
1162
- return false;
1159
+ if (resolvedResolved) {
1160
+ // Handle plugins that manually make the result external
1161
+ if (resolvedResolved.external) {
1162
+ return false;
1163
+ }
1164
+ // Pass on meta information added by other plugins
1165
+ return { ...resolved, meta: resolvedResolved.meta };
1163
1166
  }
1164
1167
  }
1165
1168
  return resolved;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/plugin-node-resolve",
3
- "version": "13.1.1",
3
+ "version": "13.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },