@mui/internal-babel-plugin-resolve-imports 2.0.7-canary.4 → 2.0.7-canary.40
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/LICENSE +1 -1
- package/index.js +8 -1
- package/index.test.js +13 -2
- package/package.json +16 -15
- package/resolve.d.ts +1 -1
- package/tsconfig.json +2 -2
package/LICENSE
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
|
|
2
3
|
/// <reference path="./resolve.d.ts" />
|
|
3
4
|
|
|
4
|
-
const nodePath = require('path');
|
|
5
|
+
const nodePath = require('node:path');
|
|
5
6
|
const resolve = require('resolve/sync');
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -50,6 +51,12 @@ module.exports = function plugin({ types: t }, { outExtension }) {
|
|
|
50
51
|
function doResolve(importSource, state) {
|
|
51
52
|
const importedPath = importSource.node.value;
|
|
52
53
|
|
|
54
|
+
const importExt = nodePath.extname(importedPath);
|
|
55
|
+
// ignore if the import already has a desired extension or if it is a css import.
|
|
56
|
+
if (extensionsSet.has(importExt) || importExt === '.css') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
if (!importedPath.startsWith('.')) {
|
|
54
61
|
// Only handle relative imports
|
|
55
62
|
return;
|
package/index.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
3
|
import { pluginTester } from 'babel-plugin-tester';
|
|
4
4
|
import plugin from './index';
|
|
5
5
|
|
|
@@ -107,5 +107,16 @@ pluginTester({
|
|
|
107
107
|
fixture: path.join(fixturePath, 'declaration-files', 'input.d.ts'),
|
|
108
108
|
output: readOutputFixtureSync('declaration-files', 'output.d.ts'),
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
title: 'Ignore imports with extensions',
|
|
112
|
+
pluginOptions: {
|
|
113
|
+
outExtension: '.js',
|
|
114
|
+
},
|
|
115
|
+
babelOptions: {
|
|
116
|
+
plugins: [['@babel/plugin-syntax-typescript', { dts: true }]],
|
|
117
|
+
},
|
|
118
|
+
fixture: path.join(fixturePath, 'ignore-imports-with-extensions', 'input.d.ts'),
|
|
119
|
+
output: readOutputFixtureSync('ignore-imports-with-extensions', 'output.d.ts'),
|
|
120
|
+
},
|
|
110
121
|
],
|
|
111
122
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-babel-plugin-resolve-imports",
|
|
3
|
-
"version": "2.0.7-canary.
|
|
3
|
+
"version": "2.0.7-canary.40",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Babel plugin that resolves import specifiers to their actual output file.",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"main": "./index.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./index.js"
|
|
@@ -12,27 +13,27 @@
|
|
|
12
13
|
"url": "git+https://github.com/mui/mui-public.git",
|
|
13
14
|
"directory": "packages/babel-plugin-resolve-imports"
|
|
14
15
|
},
|
|
15
|
-
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"resolve": "^1.22.
|
|
17
|
+
"resolve": "^1.22.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@babel/core": "
|
|
21
|
-
"@babel/plugin-syntax-typescript": "
|
|
22
|
-
"@babel/preset-typescript": "
|
|
23
|
-
"@types/babel__core": "
|
|
24
|
-
"@types/chai": "
|
|
25
|
-
"@types/node": "
|
|
26
|
-
"@types/resolve": "
|
|
27
|
-
"babel-plugin-tester": "
|
|
28
|
-
"chai": "^4.5.0"
|
|
20
|
+
"@babel/core": "7.29.7",
|
|
21
|
+
"@babel/plugin-syntax-typescript": "7.29.7",
|
|
22
|
+
"@babel/preset-typescript": "7.29.7",
|
|
23
|
+
"@types/babel__core": "7.20.5",
|
|
24
|
+
"@types/chai": "5.2.3",
|
|
25
|
+
"@types/node": "22.19.0",
|
|
26
|
+
"@types/resolve": "1.20.6",
|
|
27
|
+
"babel-plugin-tester": "12.0.0"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
31
|
-
"@babel/core": "7"
|
|
30
|
+
"@babel/core": "^7.0.0 || ^8.0.0"
|
|
32
31
|
},
|
|
33
32
|
"publishConfig": {
|
|
34
33
|
"access": "public"
|
|
35
34
|
},
|
|
36
|
-
"gitSha": "
|
|
37
|
-
"scripts": {
|
|
35
|
+
"gitSha": "99b7a28473d3224312225f058a0d2009147d718b",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"typescript": "tsgo -noEmit"
|
|
38
|
+
}
|
|
38
39
|
}
|
package/resolve.d.ts
CHANGED