@putout/plugin-nodejs 19.2.1 → 20.0.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.
|
@@ -12,24 +12,18 @@ const {entries} = Object;
|
|
|
12
12
|
const {parse: parseJson} = JSON;
|
|
13
13
|
const isString = (a) => typeof a === 'string';
|
|
14
14
|
|
|
15
|
-
function insert(a, b, {importsEntries
|
|
16
|
-
if (aliasBased) {
|
|
17
|
-
importsEntries.set(b, a);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
15
|
+
function insert(a, b, {importsEntries}) {
|
|
21
16
|
importsEntries.set(a, b);
|
|
22
17
|
}
|
|
23
18
|
|
|
24
|
-
export const createGetPrivateImports = (importsCache = new Map(), emptyMap = new Map()) => (file
|
|
19
|
+
export const createGetPrivateImports = (importsCache = new Map(), emptyMap = new Map()) => (file) => {
|
|
25
20
|
const filename = getFilename(file);
|
|
26
21
|
const dir = dirname(filename);
|
|
27
|
-
const {aliasBased = false} = options;
|
|
28
22
|
|
|
29
23
|
if (importsCache.has(dir))
|
|
30
24
|
return importsCache.get(dir);
|
|
31
25
|
|
|
32
|
-
const
|
|
26
|
+
const packagePath = findFileUp(file, 'package.json');
|
|
33
27
|
|
|
34
28
|
if (!packagePath) {
|
|
35
29
|
importsCache.set(dir, emptyMap);
|
|
@@ -45,6 +39,8 @@ export const createGetPrivateImports = (importsCache = new Map(), emptyMap = new
|
|
|
45
39
|
return emptyMap;
|
|
46
40
|
}
|
|
47
41
|
|
|
42
|
+
const packageDirectory = dirname(getFilename(packagePath));
|
|
43
|
+
|
|
48
44
|
const {imports = {}} = packageJson;
|
|
49
45
|
const importsEntries = new Map();
|
|
50
46
|
|
|
@@ -58,7 +54,6 @@ export const createGetPrivateImports = (importsCache = new Map(), emptyMap = new
|
|
|
58
54
|
|
|
59
55
|
insert(resolvedPath, alias, {
|
|
60
56
|
importsEntries,
|
|
61
|
-
aliasBased,
|
|
62
57
|
});
|
|
63
58
|
}
|
|
64
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to transform code to new API of Node.js",
|