@rollup/plugin-node-resolve 13.0.6 → 13.1.3

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,37 @@
1
1
  # @rollup/plugin-node-resolve ChangeLog
2
2
 
3
+ ## v13.1.3
4
+
5
+ _2022-01-05_
6
+
7
+ ### Bugfixes
8
+
9
+ - fix: use correct version when published (#1063)
10
+
11
+ ## v13.1.2
12
+
13
+ _2021-12-31_
14
+
15
+ ### Bugfixes
16
+
17
+ - fix: forward meta-information from other plugins (#1062)
18
+
19
+ ## v13.1.1
20
+
21
+ _2021-12-13_
22
+
23
+ ### Updates
24
+
25
+ - test: add tests for mixing custom `exportConditions` with `browser: true` (#1043)
26
+
27
+ ## v13.1.0
28
+
29
+ _2021-12-13_
30
+
31
+ ### Features
32
+
33
+ - feat: expose plugin version (#1050)
34
+
3
35
  ## v13.0.6
4
36
 
5
37
  _2021-10-19_
package/dist/cjs/index.js CHANGED
@@ -21,6 +21,8 @@ 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.3";
25
+
24
26
  util.promisify(fs__default["default"].access);
25
27
  const readFile$1 = util.promisify(fs__default["default"].readFile);
26
28
  const realpath = util.promisify(fs__default["default"].realpath);
@@ -93,6 +95,53 @@ const isFileCached = makeCache(async (file) => {
93
95
 
94
96
  const readCachedFile = makeCache(readFile$1);
95
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
+
96
145
  // returns the imported package name for bare module imports
97
146
  function getPackageName(id) {
98
147
  if (id.startsWith('.') || id.startsWith('/')) {
@@ -861,53 +910,6 @@ async function resolveImportSpecifiers({
861
910
  });
862
911
  }
863
912
 
864
- function handleDeprecatedOptions(opts) {
865
- const warnings = [];
866
-
867
- if (opts.customResolveOptions) {
868
- const { customResolveOptions } = opts;
869
- if (customResolveOptions.moduleDirectory) {
870
- // eslint-disable-next-line no-param-reassign
871
- opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
872
- ? customResolveOptions.moduleDirectory
873
- : [customResolveOptions.moduleDirectory];
874
-
875
- warnings.push(
876
- 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
877
- );
878
- }
879
-
880
- if (customResolveOptions.preserveSymlinks) {
881
- throw new Error(
882
- 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
883
- );
884
- }
885
-
886
- [
887
- 'basedir',
888
- 'package',
889
- 'extensions',
890
- 'includeCoreModules',
891
- 'readFile',
892
- 'isFile',
893
- 'isDirectory',
894
- 'realpath',
895
- 'packageFilter',
896
- 'pathFilter',
897
- 'paths',
898
- 'packageIterator'
899
- ].forEach((resolveOption) => {
900
- if (customResolveOptions[resolveOption]) {
901
- throw new Error(
902
- `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
903
- );
904
- }
905
- });
906
- }
907
-
908
- return { warnings };
909
- }
910
-
911
913
  /* eslint-disable no-param-reassign, no-shadow, no-undefined */
912
914
 
913
915
  const builtins = new Set(builtinList__default["default"]);
@@ -1122,16 +1124,17 @@ function nodeResolve(opts = {}) {
1122
1124
  }
1123
1125
  return null;
1124
1126
  }
1125
- const result = {
1127
+ return {
1126
1128
  id: `${location}${importSuffix}`,
1127
1129
  moduleSideEffects: hasModuleSideEffects(location)
1128
1130
  };
1129
- return result;
1130
1131
  };
1131
1132
 
1132
1133
  return {
1133
1134
  name: 'node-resolve',
1134
1135
 
1136
+ version,
1137
+
1135
1138
  buildStart(options) {
1136
1139
  rollupOptions = options;
1137
1140
 
@@ -1166,9 +1169,13 @@ function nodeResolve(opts = {}) {
1166
1169
  importer,
1167
1170
  Object.assign({ skipSelf: true }, resolveOptions)
1168
1171
  );
1169
- const isExternal = !!(resolvedResolved && resolvedResolved.external);
1170
- if (isExternal) {
1171
- 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 };
1172
1179
  }
1173
1180
  }
1174
1181
  return resolved;
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.3";
12
+
11
13
  promisify(fs.access);
12
14
  const readFile$1 = promisify(fs.readFile);
13
15
  const realpath = promisify(fs.realpath);
@@ -80,6 +82,53 @@ const isFileCached = makeCache(async (file) => {
80
82
 
81
83
  const readCachedFile = makeCache(readFile$1);
82
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
+
83
132
  // returns the imported package name for bare module imports
84
133
  function getPackageName(id) {
85
134
  if (id.startsWith('.') || id.startsWith('/')) {
@@ -848,53 +897,6 @@ async function resolveImportSpecifiers({
848
897
  });
849
898
  }
850
899
 
851
- function handleDeprecatedOptions(opts) {
852
- const warnings = [];
853
-
854
- if (opts.customResolveOptions) {
855
- const { customResolveOptions } = opts;
856
- if (customResolveOptions.moduleDirectory) {
857
- // eslint-disable-next-line no-param-reassign
858
- opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory)
859
- ? customResolveOptions.moduleDirectory
860
- : [customResolveOptions.moduleDirectory];
861
-
862
- warnings.push(
863
- 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.'
864
- );
865
- }
866
-
867
- if (customResolveOptions.preserveSymlinks) {
868
- throw new Error(
869
- 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.'
870
- );
871
- }
872
-
873
- [
874
- 'basedir',
875
- 'package',
876
- 'extensions',
877
- 'includeCoreModules',
878
- 'readFile',
879
- 'isFile',
880
- 'isDirectory',
881
- 'realpath',
882
- 'packageFilter',
883
- 'pathFilter',
884
- 'paths',
885
- 'packageIterator'
886
- ].forEach((resolveOption) => {
887
- if (customResolveOptions[resolveOption]) {
888
- throw new Error(
889
- `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`
890
- );
891
- }
892
- });
893
- }
894
-
895
- return { warnings };
896
- }
897
-
898
900
  /* eslint-disable no-param-reassign, no-shadow, no-undefined */
899
901
 
900
902
  const builtins = new Set(builtinList);
@@ -1109,16 +1111,17 @@ function nodeResolve(opts = {}) {
1109
1111
  }
1110
1112
  return null;
1111
1113
  }
1112
- const result = {
1114
+ return {
1113
1115
  id: `${location}${importSuffix}`,
1114
1116
  moduleSideEffects: hasModuleSideEffects(location)
1115
1117
  };
1116
- return result;
1117
1118
  };
1118
1119
 
1119
1120
  return {
1120
1121
  name: 'node-resolve',
1121
1122
 
1123
+ version,
1124
+
1122
1125
  buildStart(options) {
1123
1126
  rollupOptions = options;
1124
1127
 
@@ -1153,9 +1156,13 @@ function nodeResolve(opts = {}) {
1153
1156
  importer,
1154
1157
  Object.assign({ skipSelf: true }, resolveOptions)
1155
1158
  );
1156
- const isExternal = !!(resolvedResolved && resolvedResolved.external);
1157
- if (isExternal) {
1158
- 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 };
1159
1166
  }
1160
1167
  }
1161
1168
  return resolved;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/plugin-node-resolve",
3
- "version": "13.0.6",
3
+ "version": "13.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,6 +31,7 @@
31
31
  "ci:test": "pnpm test -- --verbose && pnpm test:ts",
32
32
  "prebuild": "del-cli dist",
33
33
  "prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
34
+ "prepublishOnly": "pnpm build",
34
35
  "prerelease": "pnpm build",
35
36
  "pretest": "pnpm build",
36
37
  "release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",