@ms-cloudpack/package-utilities 2.1.1 → 2.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.json +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/findFileInPackage.js +15 -4
- package/lib/findFileInPackage.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/package-utilities",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 03 Dec 2022 08:10:22 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/package-utilities_v2.1.2",
|
|
7
|
+
"version": "2.1.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dake.3601@gmail.com",
|
|
12
|
+
"package": "@ms-cloudpack/package-utilities",
|
|
13
|
+
"commit": "9fae6cbdb788baac8236abc9eb44eb1d3296b7e0",
|
|
14
|
+
"comment": "Used async isFile to improve performance"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@ms-cloudpack/package-utilities",
|
|
19
|
+
"comment": "Bump @ms-cloudpack/path-utilities to v2.0.0",
|
|
20
|
+
"commit": "adb6e5b06d2100f33ff9975c2999b81f81b65616"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Thu, 01 Dec 2022 08:10:47 GMT",
|
|
6
27
|
"tag": "@ms-cloudpack/package-utilities_v2.1.1",
|
|
7
28
|
"version": "2.1.1",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/package-utilities
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 03 Dec 2022 08:10:22 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.1.2
|
|
8
|
+
|
|
9
|
+
Sat, 03 Dec 2022 08:10:22 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Used async isFile to improve performance (dake.3601@gmail.com)
|
|
14
|
+
- Bump @ms-cloudpack/path-utilities to v2.0.0
|
|
15
|
+
|
|
7
16
|
## 2.1.1
|
|
8
17
|
|
|
9
|
-
Thu, 01 Dec 2022 08:10:
|
|
18
|
+
Thu, 01 Dec 2022 08:10:47 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
package/lib/findFileInPackage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { intermediateToSourcePath,
|
|
2
|
+
import { intermediateToSourcePath, sourceToIntermediatePath, isFile } from '@ms-cloudpack/path-utilities';
|
|
3
3
|
import { isExternalPackage } from './isExternalPackage.js';
|
|
4
4
|
import { safeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
5
5
|
import { getExportsMap } from './getExportsMap.js';
|
|
@@ -26,11 +26,22 @@ export async function findFileInPackage(options) {
|
|
|
26
26
|
safeRelativePath(path.join(filePath, 'index.js')),
|
|
27
27
|
safeRelativePath(path.join(filePath, 'package.json')),
|
|
28
28
|
];
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
filePath = undefined;
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
if (await isFile(path.join(packagePath, candidate))) {
|
|
32
|
+
filePath = candidate;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
31
36
|
// For internal packages, try and find source/typings and convert to intermediate (which may be missing.)
|
|
32
37
|
if (isInternal) {
|
|
33
|
-
|
|
38
|
+
for (const candidate of candidates) {
|
|
39
|
+
const intermediateCandidate = intermediateToSourcePath(candidate, packagePath);
|
|
40
|
+
if (intermediateCandidate && (await isFile(path.join(packagePath, intermediateCandidate)))) {
|
|
41
|
+
sourcePath = intermediateCandidate;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
// If we couldn't find a unique source file, stick with the resolved intermediate file as the only known truth.
|
|
35
46
|
if (filePath && sourcePath === filePath) {
|
|
36
47
|
sourcePath = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;;;;;;;GASG;AAEH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAiC;IACvE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,IAAI,QAAQ,GAAuB,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,UAA8B,CAAC;IACnC,IAAI,SAA6B,CAAC;IAClC,MAAM,UAAU,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,UAAU,GAAG;QACjB,QAAQ;QACR,QAAQ,GAAG,KAAK;QAChB,gBAAgB,CAAC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3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Utilities for resolving/parsing packages and their imports.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@babel/traverse": "^7.16.10",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.0.4",
|
|
19
19
|
"@ms-cloudpack/package-overrides": "^0.2.0",
|
|
20
|
-
"@ms-cloudpack/path-utilities": "^
|
|
20
|
+
"@ms-cloudpack/path-utilities": "^2.0.0",
|
|
21
21
|
"@ms-cloudpack/path-string-parsing": "^1.0.0",
|
|
22
22
|
"merge": "^2.1.1",
|
|
23
23
|
"resolve": "^1.22.0"
|