@rollup/plugin-node-resolve 15.0.2 → 15.1.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/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.0.2";
15
+ var version = "15.1.0";
16
16
  var peerDependencies = {
17
17
  rollup: "^2.78.0||^3.0.0"
18
18
  };
@@ -1090,11 +1090,18 @@ function nodeResolve(opts = {}) {
1090
1090
  importSpecifierList.push(`./${importee}`);
1091
1091
  }
1092
1092
 
1093
- // TypeScript files may import '.js' to refer to either '.ts' or '.tsx'
1094
- if (importer && importee.endsWith('.js')) {
1095
- for (const ext of ['.ts', '.tsx']) {
1096
- if (importer.endsWith(ext) && extensions.includes(ext)) {
1097
- importSpecifierList.push(importee.replace(/.js$/, ext));
1093
+ // TypeScript files may import '.mjs' or '.cjs' to refer to either '.mts' or '.cts'.
1094
+ // They may also import .js to refer to either .ts or .tsx, and .jsx to refer to .tsx.
1095
+ if (importer && /\.(ts|mts|cts|tsx)$/.test(importer)) {
1096
+ for (const [importeeExt, resolvedExt] of [
1097
+ ['.js', '.ts'],
1098
+ ['.js', '.tsx'],
1099
+ ['.jsx', '.tsx'],
1100
+ ['.mjs', '.mts'],
1101
+ ['.cjs', '.cts']
1102
+ ]) {
1103
+ if (importee.endsWith(importeeExt) && extensions.includes(resolvedExt)) {
1104
+ importSpecifierList.push(importee.slice(0, -importeeExt.length) + resolvedExt);
1098
1105
  }
1099
1106
  }
1100
1107
  }
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 = "15.0.2";
11
+ var version = "15.1.0";
12
12
  var peerDependencies = {
13
13
  rollup: "^2.78.0||^3.0.0"
14
14
  };
@@ -1086,11 +1086,18 @@ function nodeResolve(opts = {}) {
1086
1086
  importSpecifierList.push(`./${importee}`);
1087
1087
  }
1088
1088
 
1089
- // TypeScript files may import '.js' to refer to either '.ts' or '.tsx'
1090
- if (importer && importee.endsWith('.js')) {
1091
- for (const ext of ['.ts', '.tsx']) {
1092
- if (importer.endsWith(ext) && extensions.includes(ext)) {
1093
- importSpecifierList.push(importee.replace(/.js$/, ext));
1089
+ // TypeScript files may import '.mjs' or '.cjs' to refer to either '.mts' or '.cts'.
1090
+ // They may also import .js to refer to either .ts or .tsx, and .jsx to refer to .tsx.
1091
+ if (importer && /\.(ts|mts|cts|tsx)$/.test(importer)) {
1092
+ for (const [importeeExt, resolvedExt] of [
1093
+ ['.js', '.ts'],
1094
+ ['.js', '.tsx'],
1095
+ ['.jsx', '.tsx'],
1096
+ ['.mjs', '.mts'],
1097
+ ['.cjs', '.cts']
1098
+ ]) {
1099
+ if (importee.endsWith(importeeExt) && extensions.includes(resolvedExt)) {
1100
+ importSpecifierList.push(importee.slice(0, -importeeExt.length) + resolvedExt);
1094
1101
  }
1095
1102
  }
1096
1103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/plugin-node-resolve",
3
- "version": "15.0.2",
3
+ "version": "15.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },