@ms-cloudpack/package-utilities 0.13.1 → 0.15.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/CHANGELOG.json +46 -1
- package/CHANGELOG.md +18 -2
- package/lib/PackageDefinitions.d.ts +1 -0
- package/lib/PackageDefinitions.js +2 -1
- package/lib/PackageDefinitions.js.map +1 -1
- package/lib/addExportsMapEntry.d.ts +13 -0
- package/lib/addExportsMapEntry.js +41 -0
- package/lib/addExportsMapEntry.js.map +1 -0
- package/lib/{evaluateImportsFromEntries.test.d.ts → addExportsMapEntry.test.d.ts} +0 -0
- package/lib/addExportsMapEntry.test.js +55 -0
- package/lib/addExportsMapEntry.test.js.map +1 -0
- package/lib/createExportsMap.d.ts +8 -0
- package/lib/createExportsMap.js +74 -0
- package/lib/createExportsMap.js.map +1 -0
- package/lib/{generateExportsMap.test.d.ts → createExportsMap.test.d.ts} +0 -0
- package/lib/createExportsMap.test.js +145 -0
- package/lib/createExportsMap.test.js.map +1 -0
- package/lib/createImportMap.d.ts +7 -2
- package/lib/createImportMap.js +49 -29
- package/lib/createImportMap.js.map +1 -1
- package/lib/createImportMap.test.js +44 -157
- package/lib/createImportMap.test.js.map +1 -1
- package/lib/createResolveMap.d.ts +2 -0
- package/lib/createResolveMap.js +4 -5
- package/lib/createResolveMap.js.map +1 -1
- package/lib/createResolveMap.test.js +6 -5
- package/lib/createResolveMap.test.js.map +1 -1
- package/lib/findResolveMapEntry.d.ts +6 -0
- package/lib/findResolveMapEntry.js +12 -0
- package/lib/findResolveMapEntry.js.map +1 -0
- package/lib/{getFlattenedExportsMap.test.d.ts → findResolveMapEntry.test.d.ts} +0 -0
- package/lib/findResolveMapEntry.test.js +52 -0
- package/lib/findResolveMapEntry.test.js.map +1 -0
- package/lib/{getFlattenedExportsMap.d.ts → flattenExportsMap.d.ts} +4 -1
- package/lib/flattenExportsMap.js +67 -0
- package/lib/flattenExportsMap.js.map +1 -0
- package/lib/flattenExportsMap.test.d.ts +1 -0
- package/lib/flattenExportsMap.test.js +185 -0
- package/lib/flattenExportsMap.test.js.map +1 -0
- package/lib/getExportPathFromEntry.js +2 -1
- package/lib/getExportPathFromEntry.js.map +1 -1
- package/lib/getExportPathFromEntry.test.js +0 -8
- package/lib/getExportPathFromEntry.test.js.map +1 -1
- package/lib/getExportsMap.d.ts +5 -0
- package/lib/getExportsMap.js +11 -0
- package/lib/getExportsMap.js.map +1 -0
- package/lib/index.d.ts +10 -7
- package/lib/index.js +15 -6
- package/lib/index.js.map +1 -1
- package/lib/parseImportString.d.ts +3 -3
- package/lib/parseImportString.js +4 -4
- package/lib/parseImportString.js.map +1 -1
- package/lib/parseImportString.test.js +21 -3
- package/lib/parseImportString.test.js.map +1 -1
- package/lib/resolveImportFromPackage.test.js +7 -18
- package/lib/resolveImportFromPackage.test.js.map +1 -1
- package/lib/resolveImportFromPackagePath.d.ts +10 -5
- package/lib/resolveImportFromPackagePath.js +58 -47
- package/lib/resolveImportFromPackagePath.js.map +1 -1
- package/lib/resolvePackageEntries.d.ts +8 -2
- package/lib/resolvePackageEntries.js +8 -37
- package/lib/resolvePackageEntries.js.map +1 -1
- package/lib/resolvePackageEntries.test.js +76 -77
- package/lib/resolvePackageEntries.test.js.map +1 -1
- package/lib/safeRelativePath.d.ts +4 -0
- package/lib/safeRelativePath.js +19 -0
- package/lib/safeRelativePath.js.map +1 -0
- package/lib/safeRelativePath.test.d.ts +1 -0
- package/lib/safeRelativePath.test.js +17 -0
- package/lib/safeRelativePath.test.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
- package/lib/evaluateImportsFromEntries.d.ts +0 -31
- package/lib/evaluateImportsFromEntries.js +0 -151
- package/lib/evaluateImportsFromEntries.js.map +0 -1
- package/lib/evaluateImportsFromEntries.test.js +0 -39
- package/lib/evaluateImportsFromEntries.test.js.map +0 -1
- package/lib/generateExportsMap.d.ts +0 -9
- package/lib/generateExportsMap.js +0 -80
- package/lib/generateExportsMap.js.map +0 -1
- package/lib/generateExportsMap.test.js +0 -100
- package/lib/generateExportsMap.test.js.map +0 -1
- package/lib/getFlattenedExportsMap.js +0 -77
- package/lib/getFlattenedExportsMap.js.map +0 -1
- package/lib/getFlattenedExportsMap.test.js +0 -270
- package/lib/getFlattenedExportsMap.test.js.map +0 -1
|
@@ -3,88 +3,96 @@ import { intermediateToSourcePath, isFile, isFolder, slash } from '@ms-cloudpack
|
|
|
3
3
|
import { PackageDefinitions } from './PackageDefinitions.js';
|
|
4
4
|
import { getExportPathFromEntry } from './getExportPathFromEntry.js';
|
|
5
5
|
import { isExternalPackage } from './isExternalPackage.js';
|
|
6
|
-
|
|
6
|
+
import { safeRelativePath } from './safeRelativePath.js';
|
|
7
|
+
const defaultIndexPath = './index.js';
|
|
7
8
|
/**
|
|
8
|
-
* Resolves a requested import path from a package located at the given path
|
|
9
|
-
* to
|
|
10
|
-
* to source paths (lib to src translation) if the option is provided.
|
|
9
|
+
* Resolves a requested import path from a package located at the given path, returns a path relative
|
|
10
|
+
* to the package, or undefined if no match was found.
|
|
11
11
|
*/
|
|
12
12
|
export async function resolveImportFromPackagePath(packagePath, requestedPath, options = {}) {
|
|
13
|
-
const
|
|
13
|
+
const { packages = PackageDefinitions.getInstance() } = options;
|
|
14
|
+
const packageDefinition = await packages.get(packagePath);
|
|
14
15
|
if (!packageDefinition) {
|
|
15
16
|
return requestedPath;
|
|
16
17
|
}
|
|
17
18
|
return resolveImportFromPackage(packagePath, packageDefinition, requestedPath, options);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Resolves a requested import path from a package
|
|
21
|
-
* to
|
|
21
|
+
* Resolves a requested import path from a package. Note that this is not a full import path, but rather
|
|
22
|
+
* a path relative to the package. This is used to resolve the path to a file within a package.
|
|
22
23
|
*/
|
|
23
24
|
export async function resolveImportFromPackage(packagePath, packageDefinition, importPath, options = {}) {
|
|
24
|
-
//
|
|
25
|
-
if (importPath
|
|
25
|
+
// Normalize import path
|
|
26
|
+
if (importPath && importPath !== '.') {
|
|
27
|
+
importPath = safeRelativePath(importPath);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
26
30
|
importPath = undefined;
|
|
27
31
|
}
|
|
32
|
+
const { packages = PackageDefinitions.getInstance() } = options;
|
|
28
33
|
const originalPackagePath = packagePath;
|
|
29
34
|
const fullRequestedPath = path.join(packagePath, importPath || '');
|
|
30
|
-
// If the requested subfolder has a package.json, treat it as a sub-package.
|
|
35
|
+
// If the requested subfolder has a package.json, treat it as a sub-package.
|
|
36
|
+
// (some npm packages have nested package.json files!)
|
|
31
37
|
if (importPath && isFolder(fullRequestedPath)) {
|
|
32
|
-
const subPackageDefinition = await
|
|
38
|
+
const subPackageDefinition = await packages.get(fullRequestedPath);
|
|
33
39
|
if (subPackageDefinition) {
|
|
34
40
|
packageDefinition = subPackageDefinition;
|
|
35
41
|
packagePath = fullRequestedPath;
|
|
36
42
|
importPath = undefined;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
|
-
// Normalize path
|
|
40
|
-
if (importPath) {
|
|
41
|
-
importPath = './' + slash(path.normalize(importPath || ''));
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
importPath = undefined;
|
|
45
|
-
}
|
|
46
45
|
// Build a list of intermediate file candidates.
|
|
47
46
|
let candidates = [];
|
|
48
47
|
const { exports } = packageDefinition;
|
|
49
48
|
// If we have an exports map, this takes priority in resolution.
|
|
50
|
-
if (exports) {
|
|
51
|
-
|
|
49
|
+
if (exports && !options.ignoreExportsMap) {
|
|
50
|
+
let exportPath;
|
|
51
|
+
if (!exportPath) {
|
|
52
|
+
exportPath = getExportPathFromEntry(exports, importPath);
|
|
53
|
+
}
|
|
52
54
|
if (exportPath) {
|
|
53
55
|
candidates.push(exportPath);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
if (!importPath) {
|
|
57
|
-
candidates.push(packageDefinition.module);
|
|
58
|
-
candidates.push(packageDefinition.main);
|
|
59
|
-
}
|
|
60
58
|
else {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!packageDefinition.main && !packageDefinition.module && !importPath) {
|
|
65
|
-
candidates.push('index.js');
|
|
66
|
-
}
|
|
67
|
-
// If the package has browser re-mappings, respect them.
|
|
68
|
-
let { browser } = packageDefinition;
|
|
69
|
-
// If the browser entry is a string, convert it into an object.
|
|
70
|
-
if (typeof browser === 'string') {
|
|
71
|
-
const mainOrModule = packageDefinition.module || packageDefinition.main;
|
|
72
|
-
if (mainOrModule) {
|
|
73
|
-
browser = { [mainOrModule]: browser };
|
|
59
|
+
// We don't have an exports map. Consider main entries.
|
|
60
|
+
if (!importPath) {
|
|
61
|
+
candidates.push(packageDefinition.module, packageDefinition.main, defaultIndexPath);
|
|
74
62
|
}
|
|
75
63
|
else {
|
|
76
|
-
candidates.push(
|
|
64
|
+
candidates.push(importPath);
|
|
77
65
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
const { browser } = packageDefinition;
|
|
67
|
+
if (browser) {
|
|
68
|
+
// If the package has browser re-mappings, respect them.
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
70
|
+
let safeBrowser = {};
|
|
71
|
+
if (typeof browser === 'object') {
|
|
72
|
+
safeBrowser = Object.keys(browser || {}).reduce((acc, key) => {
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
74
|
+
acc[safeRelativePath(key)] = safeRelativePath(browser[key]);
|
|
75
|
+
return acc;
|
|
76
|
+
}, {});
|
|
87
77
|
}
|
|
78
|
+
else if (typeof browser === 'string') {
|
|
79
|
+
safeBrowser = {
|
|
80
|
+
[safeRelativePath(packageDefinition.module || packageDefinition.main || defaultIndexPath)]: safeRelativePath(browser),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Push browser overrides into candidates.
|
|
84
|
+
candidates = candidates.reduce((p, n) => {
|
|
85
|
+
if (n) {
|
|
86
|
+
const candidate = safeRelativePath(n);
|
|
87
|
+
if (safeBrowser[candidate]) {
|
|
88
|
+
p.push(safeBrowser[candidate]);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
p.push(candidate);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return p;
|
|
95
|
+
}, []);
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
98
|
// Ensure we can handle missing extensions and fall back to js
|
|
@@ -110,6 +118,9 @@ export async function resolveImportFromPackage(packagePath, packageDefinition, i
|
|
|
110
118
|
.map((c) => ` "${c}"`)
|
|
111
119
|
.join('\n')}`);
|
|
112
120
|
}
|
|
121
|
+
if (!foundPath) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
113
124
|
return './' + slash(path.relative(originalPackagePath, path.join(packagePath, foundPath || importPath || '')));
|
|
114
125
|
}
|
|
115
126
|
//# sourceMappingURL=resolveImportFromPackagePath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveImportFromPackagePath.js","sourceRoot":"","sources":["../src/resolveImportFromPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveImportFromPackagePath.js","sourceRoot":"","sources":["../src/resolveImportFromPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE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|
+
* Given a package path, reads the exports from the package.json and returns a flattened array of entry files
|
|
4
|
+
* for bundling.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolvePackageEntries(packagePath: string, options?: {
|
|
7
|
+
packages?: PackageDefinitions;
|
|
8
|
+
}): Promise<string[]>;
|
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (const [key, entry] of Object.entries(exports)) {
|
|
10
|
-
if (key.indexOf('*') < 0) {
|
|
11
|
-
const entryPath = getExportPathFromEntry(entry);
|
|
12
|
-
if (entryPath) {
|
|
13
|
-
entries.add(cleanEntry(entryPath));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else if (typeof exports === 'string') {
|
|
19
|
-
entries.add(cleanEntry(exports));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else if (typeof browser === 'string') {
|
|
23
|
-
entries.add(browser);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const defaultEntryPath = packageDefinition.module || packageDefinition.main || './index.js';
|
|
27
|
-
if (defaultEntryPath) {
|
|
28
|
-
entries.add(cleanEntry(defaultEntryPath));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (typeof browser === 'object') {
|
|
32
|
-
for (const [fromPath, toPath] of Object.entries(browser)) {
|
|
33
|
-
if (entries.has(fromPath) && toPath) {
|
|
34
|
-
entries.add(cleanEntry(toPath));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
import { getExportsMap } from './getExportsMap.js';
|
|
2
|
+
import { flattenExportsMap } from './flattenExportsMap.js';
|
|
3
|
+
/**
|
|
4
|
+
* Given a package path, reads the exports from the package.json and returns a flattened array of entry files
|
|
5
|
+
* for bundling.
|
|
6
|
+
*/
|
|
7
|
+
export async function resolvePackageEntries(packagePath, options = {}) {
|
|
8
|
+
const entries = new Set(Object.values(flattenExportsMap(await getExportsMap(packagePath, options))));
|
|
38
9
|
return Array.from(entries);
|
|
39
10
|
}
|
|
40
11
|
//# sourceMappingURL=resolvePackageEntries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePackageEntries.js","sourceRoot":"","sources":["../src/resolvePackageEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resolvePackageEntries.js","sourceRoot":"","sources":["../src/resolvePackageEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,WAAmB,EACnB,UAEI,EAAE;IAEN,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7G,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,102 +1,101 @@
|
|
|
1
1
|
import { describe, it, expect } from '@jest/globals';
|
|
2
2
|
import { PackageDefinitions } from './PackageDefinitions.js';
|
|
3
3
|
import { resolvePackageEntries } from './resolvePackageEntries.js';
|
|
4
|
-
import { testNodeFetchPath } from './testPaths.js';
|
|
5
|
-
const defaultPackage = {
|
|
6
|
-
name: 'default',
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
};
|
|
9
4
|
describe('resolvePackageEntries', () => {
|
|
10
|
-
it('can resolve an exports map (default)', () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
it('can resolve an exports map (default)', async () => {
|
|
6
|
+
const packages = new PackageDefinitions({
|
|
7
|
+
'node_modules/default': {
|
|
8
|
+
exports: {
|
|
9
|
+
'.': {
|
|
10
|
+
default: './lib/index.js',
|
|
11
|
+
},
|
|
16
12
|
},
|
|
17
13
|
},
|
|
18
|
-
})
|
|
14
|
+
});
|
|
15
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./lib/index.js']);
|
|
19
16
|
});
|
|
20
|
-
it('can resolve an exports map (import)', () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
it('can resolve an exports map (import)', async () => {
|
|
18
|
+
const packages = new PackageDefinitions({
|
|
19
|
+
'node_modules/default': {
|
|
20
|
+
exports: {
|
|
21
|
+
'.': {
|
|
22
|
+
import: './lib/index.js',
|
|
23
|
+
},
|
|
26
24
|
},
|
|
27
25
|
},
|
|
28
|
-
})
|
|
26
|
+
});
|
|
27
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./lib/index.js']);
|
|
29
28
|
});
|
|
30
|
-
it('can resolve an exports map (string)', () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
it('can resolve an exports map (string)', async () => {
|
|
30
|
+
const packages = new PackageDefinitions({
|
|
31
|
+
'node_modules/default': {
|
|
32
|
+
exports: {
|
|
33
|
+
'.': './lib/index.js',
|
|
34
|
+
},
|
|
35
35
|
},
|
|
36
|
-
})
|
|
36
|
+
});
|
|
37
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./lib/index.js']);
|
|
37
38
|
});
|
|
38
|
-
it('can resolve an exports map (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
source: './lib/index.ts',
|
|
39
|
+
it('can resolve an exports map (multiple)', async () => {
|
|
40
|
+
const packages = new PackageDefinitions({
|
|
41
|
+
'node_modules/default': {
|
|
42
|
+
exports: {
|
|
43
|
+
'.': './lib/index.js',
|
|
44
|
+
'./foo': './lib/foo.js',
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
|
-
})
|
|
47
|
+
});
|
|
48
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual([
|
|
49
|
+
'./lib/index.js',
|
|
50
|
+
'./lib/foo.js',
|
|
51
|
+
]);
|
|
48
52
|
});
|
|
49
|
-
it('can
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'./foo': './lib/foo.js',
|
|
53
|
+
it('can prefer module over main', async () => {
|
|
54
|
+
const packages = new PackageDefinitions({
|
|
55
|
+
'node_modules/default': {
|
|
56
|
+
main: 'main.js',
|
|
57
|
+
module: 'module.js',
|
|
55
58
|
},
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('can prefer module over main', () => {
|
|
59
|
-
expect(resolvePackageEntries({
|
|
60
|
-
...defaultPackage,
|
|
61
|
-
module: './lib/module.js',
|
|
62
|
-
main: './lib/main.js',
|
|
63
|
-
})).toEqual(['./lib/module.js']);
|
|
59
|
+
});
|
|
60
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./module.js']);
|
|
64
61
|
});
|
|
65
|
-
it('can fall back to main', () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
})).toEqual(['./lib/main.js']);
|
|
70
|
-
});
|
|
71
|
-
it('can dedupe redundant entries', () => {
|
|
72
|
-
expect(resolvePackageEntries({
|
|
73
|
-
...defaultPackage,
|
|
74
|
-
exports: {
|
|
75
|
-
'.': './lib/index.js',
|
|
76
|
-
'./foo': './lib/index.js',
|
|
62
|
+
it('can fall back to main', async () => {
|
|
63
|
+
const packages = new PackageDefinitions({
|
|
64
|
+
'node_modules/default': {
|
|
65
|
+
main: 'main.js',
|
|
77
66
|
},
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('can resolve node-fetch entries', async () => {
|
|
81
|
-
expect(resolvePackageEntries((await PackageDefinitions.getInstance().get(testNodeFetchPath)))).toEqual(['./browser.js']);
|
|
67
|
+
});
|
|
68
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./main.js']);
|
|
82
69
|
});
|
|
83
|
-
it('can
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
it('can dedupe redundant entries', async () => {
|
|
71
|
+
const packages = new PackageDefinitions({
|
|
72
|
+
'node_modules/default': {
|
|
73
|
+
exports: {
|
|
74
|
+
'.': './lib/index.js',
|
|
75
|
+
'./foo': './lib/index.js',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./lib/index.js']);
|
|
87
80
|
});
|
|
88
|
-
it('
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
'./foo/*': './lib/foo.js',
|
|
81
|
+
it('can resolve an entry without an extension', async () => {
|
|
82
|
+
const packages = new PackageDefinitions({
|
|
83
|
+
'node_modules/default': {
|
|
84
|
+
main: 'main',
|
|
93
85
|
},
|
|
94
|
-
})
|
|
86
|
+
});
|
|
87
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./main.js']);
|
|
95
88
|
});
|
|
96
|
-
it('
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
it('ignores entries with trailing slashes', async () => {
|
|
90
|
+
const packages = new PackageDefinitions({
|
|
91
|
+
'node_modules/default': {
|
|
92
|
+
exports: {
|
|
93
|
+
'.': './lib/index.js',
|
|
94
|
+
'./': './',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
expect(await resolvePackageEntries('node_modules/default', { packages })).toEqual(['./lib/index.js']);
|
|
100
99
|
});
|
|
101
100
|
});
|
|
102
101
|
//# sourceMappingURL=resolvePackageEntries.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePackageEntries.test.js","sourceRoot":"","sources":["../src/resolvePackageEntries.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolvePackageEntries.test.js","sourceRoot":"","sources":["../src/resolvePackageEntries.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC;YACtC,sBAAsB,EAAE;gBACtB,OAAO,EAAE;oBACP,GAAG,EAAE;wBACH,OAAO,EAAE,gBAAgB;qBAC1B;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,qBAAqB,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC;YACtC,sBAAsB,EAAE;gBACtB,OAAO,EAAE;oBACP,GAAG,EAAE;wBACH,MAAM,EAAE,gBAAgB;qBACzB;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,qBAAqB,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO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C,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { slash } from '@ms-cloudpack/path-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures the give relative path starts with a ./
|
|
4
|
+
*/
|
|
5
|
+
export function safeRelativePath(originalPath) {
|
|
6
|
+
if (!originalPath) {
|
|
7
|
+
return '.';
|
|
8
|
+
}
|
|
9
|
+
// Ensure we have the right slashes.
|
|
10
|
+
originalPath = slash(originalPath);
|
|
11
|
+
if (originalPath.startsWith('/')) {
|
|
12
|
+
return '.' + originalPath;
|
|
13
|
+
}
|
|
14
|
+
else if (originalPath.startsWith('./')) {
|
|
15
|
+
return originalPath;
|
|
16
|
+
}
|
|
17
|
+
return `./${originalPath}`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=safeRelativePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeRelativePath.js","sourceRoot":"","sources":["../src/safeRelativePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAgC;IAC/D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,GAAG,CAAC;KACZ;IAED,oCAAoC;IACpC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IAEnC,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAChC,OAAO,GAAG,GAAG,YAAY,CAAC;KAC3B;SAAM,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACxC,OAAO,YAAY,CAAC;KACrB;IAED,OAAO,KAAK,YAAY,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { safeRelativePath } from './safeRelativePath.js';
|
|
3
|
+
describe('safeRelativePath', () => {
|
|
4
|
+
it('can handle undefined', () => {
|
|
5
|
+
expect(safeRelativePath(undefined)).toEqual('.');
|
|
6
|
+
});
|
|
7
|
+
it('can handle an absolute path', () => {
|
|
8
|
+
expect(safeRelativePath('/foo/bar')).toEqual('./foo/bar');
|
|
9
|
+
});
|
|
10
|
+
it('can handle a relative path', () => {
|
|
11
|
+
expect(safeRelativePath('./foo/bar')).toEqual('./foo/bar');
|
|
12
|
+
});
|
|
13
|
+
it('can handle a relative path without a leading slash', () => {
|
|
14
|
+
expect(safeRelativePath('foo/bar')).toEqual('./foo/bar');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=safeRelativePath.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeRelativePath.test.js","sourceRoot":"","sources":["../src/safeRelativePath.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/package-utilities",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Utilities for resolving/parsing packages and their imports.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@ms-cloudpack/scripts": "*",
|
|
25
25
|
"@ms-cloudpack/eslint-config-base": "*",
|
|
26
26
|
"@types/resolve": "1.20.2",
|
|
27
|
-
"@babel/types": "7.19.
|
|
27
|
+
"@babel/types": "7.19.4"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"api:update": "cloudpack-scripts api-update",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ResolveMap } from './createResolveMap.js';
|
|
2
|
-
declare type PackageExports = {
|
|
3
|
-
[packageName: string]: {
|
|
4
|
-
[version: string]: {
|
|
5
|
-
[importPath: string]: {
|
|
6
|
-
count: number;
|
|
7
|
-
import: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export interface EvaluateImportsFromEntriesStats {
|
|
13
|
-
parsedSourceFiles: number;
|
|
14
|
-
parseErrors: string[];
|
|
15
|
-
uniqueImports: number;
|
|
16
|
-
uniquePackages: number;
|
|
17
|
-
unresolvedPackages: {
|
|
18
|
-
name: string;
|
|
19
|
-
from: string;
|
|
20
|
-
}[];
|
|
21
|
-
unresolvedPackageImports: {
|
|
22
|
-
name: string;
|
|
23
|
-
path: string;
|
|
24
|
-
from: string;
|
|
25
|
-
}[];
|
|
26
|
-
}
|
|
27
|
-
export declare function evaluateImportsFromEntries(entries: string[], resolveMap?: ResolveMap, allExports?: PackageExports): Promise<{
|
|
28
|
-
exports: PackageExports;
|
|
29
|
-
stats: EvaluateImportsFromEntriesStats;
|
|
30
|
-
}>;
|
|
31
|
-
export {};
|