@ms-cloudpack/package-utilities 1.2.0 → 2.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.
Files changed (34) hide show
  1. package/CHANGELOG.json +52 -1
  2. package/CHANGELOG.md +19 -2
  3. package/lib/addExportsMapEntry.d.ts +37 -7
  4. package/lib/addExportsMapEntry.js +35 -50
  5. package/lib/addExportsMapEntry.js.map +1 -1
  6. package/lib/addExportsMapEntry.test.js +107 -20
  7. package/lib/addExportsMapEntry.test.js.map +1 -1
  8. package/lib/createExportsMap.js +29 -47
  9. package/lib/createExportsMap.js.map +1 -1
  10. package/lib/createExportsMap.test.js +158 -46
  11. package/lib/createExportsMap.test.js.map +1 -1
  12. package/lib/createImportMap.test.js +27 -25
  13. package/lib/createImportMap.test.js.map +1 -1
  14. package/lib/findFileInPackage.d.ts +20 -0
  15. package/lib/findFileInPackage.js +71 -0
  16. package/lib/findFileInPackage.js.map +1 -0
  17. package/lib/{resolveImportFromPackage.test.d.ts → findFileInPackage.test.d.ts} +0 -0
  18. package/lib/findFileInPackage.test.js +95 -0
  19. package/lib/findFileInPackage.test.js.map +1 -0
  20. package/lib/findResolveMapEntry.d.ts +5 -1
  21. package/lib/findResolveMapEntry.js +4 -1
  22. package/lib/findResolveMapEntry.js.map +1 -1
  23. package/lib/findResolveMapEntry.test.js +19 -3
  24. package/lib/findResolveMapEntry.test.js.map +1 -1
  25. package/lib/index.d.ts +1 -2
  26. package/lib/index.js +0 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib/tsdoc-metadata.json +1 -1
  29. package/package.json +3 -3
  30. package/lib/resolveImportFromPackage.test.js +0 -163
  31. package/lib/resolveImportFromPackage.test.js.map +0 -1
  32. package/lib/resolveImportFromPackagePath.d.ts +0 -27
  33. package/lib/resolveImportFromPackagePath.js +0 -126
  34. package/lib/resolveImportFromPackagePath.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,58 @@
2
2
  "name": "@ms-cloudpack/package-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 02 Nov 2022 08:10:59 GMT",
5
+ "date": "Wed, 16 Nov 2022 08:11:17 GMT",
6
+ "tag": "@ms-cloudpack/package-utilities_v2.0.0",
7
+ "version": "2.0.0",
8
+ "comments": {
9
+ "major": [
10
+ {
11
+ "author": "dake.3601@gmail.com",
12
+ "package": "@ms-cloudpack/package-utilities",
13
+ "commit": "589b4c2a5b784aa17faf8078e31f24e4e27b3e84",
14
+ "comment": "Added exclude scoped packages option to findResolveMapEntry function."
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 15 Nov 2022 08:13:12 GMT",
21
+ "tag": "@ms-cloudpack/package-utilities_v1.2.1",
22
+ "version": "1.2.1",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "dzearing@microsoft.com",
27
+ "package": "@ms-cloudpack/package-utilities",
28
+ "commit": "a71972309b615d683a5a3bac7a85c981fb6e89af",
29
+ "comment": "When packages have browser/main/module entries which don't exist on disk, fall back to others that might exist."
30
+ },
31
+ {
32
+ "author": "beachball",
33
+ "package": "@ms-cloudpack/package-utilities",
34
+ "comment": "Bump @ms-cloudpack/path-utilities to v1.1.1",
35
+ "commit": "a71972309b615d683a5a3bac7a85c981fb6e89af"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Sat, 05 Nov 2022 08:11:41 GMT",
42
+ "tag": "@ms-cloudpack/package-utilities_v1.2.0",
43
+ "version": "1.2.0",
44
+ "comments": {
45
+ "none": [
46
+ {
47
+ "author": "email not defined",
48
+ "package": "@ms-cloudpack/package-utilities",
49
+ "commit": "12e604f31bccd24b3826c9e7390580a97dd6e4ce",
50
+ "comment": "Update devDependency @babel/types to v7.20.2"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Wed, 02 Nov 2022 08:11:20 GMT",
6
57
  "tag": "@ms-cloudpack/package-utilities_v1.2.0",
7
58
  "version": "1.2.0",
8
59
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # Change Log - @ms-cloudpack/package-utilities
2
2
 
3
- This log was last generated on Wed, 02 Nov 2022 08:10:59 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 16 Nov 2022 08:11:17 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0
8
+
9
+ Wed, 16 Nov 2022 08:11:17 GMT
10
+
11
+ ### Major changes
12
+
13
+ - Added exclude scoped packages option to findResolveMapEntry function. (dake.3601@gmail.com)
14
+
15
+ ## 1.2.1
16
+
17
+ Tue, 15 Nov 2022 08:13:12 GMT
18
+
19
+ ### Patches
20
+
21
+ - When packages have browser/main/module entries which don't exist on disk, fall back to others that might exist. (dzearing@microsoft.com)
22
+ - Bump @ms-cloudpack/path-utilities to v1.1.1
23
+
7
24
  ## 1.2.0
8
25
 
9
- Wed, 02 Nov 2022 08:10:59 GMT
26
+ Wed, 02 Nov 2022 08:11:20 GMT
10
27
 
11
28
  ### Minor changes
12
29
 
@@ -1,13 +1,43 @@
1
1
  import type { PackageDefinitions } from './PackageDefinitions.js';
2
+ import type { PackageJson } from 'type-fest';
2
3
  /**
3
- * Given an exports map and details about an import path, adds the entry.
4
+ * Options fo addExportsMapEntry.
4
5
  */
5
- export declare function addExportsMapEntry(options: {
6
- exports: Record<string, Record<string, string>>;
6
+ export interface AddExportsMapEntryOptions {
7
+ /**
8
+ * The exports map to add the entry to.
9
+ */
10
+ exports: PackageJson.Exports;
11
+ /**
12
+ * The package path to add the entry for. This is used to resolve relative paths.
13
+ */
7
14
  packagePath: string;
8
- importPath: string;
9
- entryPath?: string;
10
- condition?: string;
15
+ /**
16
+ * The import path to add the entry for. This is used as the key in the exports map. Defaults
17
+ * to "." being the package import.
18
+ */
19
+ importPath?: string;
20
+ /**
21
+ * The relative path to the physical file location, representing the "key" in the exports map. Can be a partial
22
+ * location, in which case we will attempt to search for the file and associated source/d.ts files. Defaults to
23
+ * assuming `index.js`.
24
+ */
25
+ filePath?: string;
26
+ /**
27
+ * Optional types path. If not provided, types will be discovered for internal packages that have source files.
28
+ * This is useful mainly when converting the default import from a package.json that has explicit typings listed.
29
+ */
11
30
  typesPath?: string;
31
+ /**
32
+ * The condition to add the entry for. (Example: "import", "require", "browser", "types") Defaults to "default"
33
+ */
34
+ condition?: string;
35
+ /**
36
+ * The package definitions cache to use to resolve the file path.
37
+ */
12
38
  packages?: PackageDefinitions;
13
- }): Promise<void>;
39
+ }
40
+ /**
41
+ * Given an exports map and details about an import path, adds the entry.
42
+ */
43
+ export declare function addExportsMapEntry(options: AddExportsMapEntryOptions): Promise<void>;
@@ -1,62 +1,47 @@
1
- import path from 'path';
2
- import { isFile, sourceToIntermediatePath } from '@ms-cloudpack/path-utilities';
3
- import { isExternalPackage } from './isExternalPackage.js';
4
- import { resolveImportFromPackagePath } from './resolveImportFromPackagePath.js';
1
+ import { findFileInPackage } from './findFileInPackage.js';
5
2
  import { safeRelativePath } from '@ms-cloudpack/path-string-parsing';
6
3
  /**
7
4
  * Given an exports map and details about an import path, adds the entry.
8
5
  */
9
6
  export async function addExportsMapEntry(options) {
10
- const { exports, packages, packagePath, importPath, entryPath, typesPath, condition = 'default' } = options;
11
- const isInternal = !isExternalPackage(packagePath);
12
- let sourcePath;
13
- let intermediatePath;
14
- let resolvedTypesPath = typesPath;
15
- if (isInternal) {
16
- sourcePath = await resolveImportFromPackagePath(packagePath, entryPath || importPath, {
17
- packages,
18
- preferSource: isInternal,
19
- ignoreExportsMap: true,
20
- });
21
- intermediatePath = sourcePath && sourceToIntermediatePath(sourcePath);
22
- }
23
- else {
24
- intermediatePath = await resolveImportFromPackagePath(packagePath, entryPath || importPath, {
25
- packages,
26
- preferSource: false,
27
- ignoreExportsMap: true,
28
- });
29
- }
30
- // If at this point we haven't found what we're looking for, don't change anything.
31
- if (!intermediatePath) {
32
- return;
33
- }
34
- // Discover d.ts if available.
35
- if (!resolvedTypesPath) {
36
- const isTypeScriptSource = sourcePath && ['.ts', '.tsx', '.mts', '.cts'].indexOf(path.extname(sourcePath)) >= 0;
37
- const potentialTypesPath = path.extname(intermediatePath) === '.js' && intermediatePath.replace('.js', '.d.ts');
38
- if (potentialTypesPath &&
39
- ((isInternal && isTypeScriptSource) || (!isInternal && isFile(path.join(packagePath, potentialTypesPath))))) {
40
- resolvedTypesPath = potentialTypesPath;
7
+ const { exports, packagePath, condition = 'default' } = options;
8
+ const importPath = makeSafeImportKey(options.importPath || '.');
9
+ const { filePath, sourcePath, typesPath = options.typesPath ? safeRelativePath(options.typesPath) : undefined, } = await findFileInPackage({
10
+ packagePath,
11
+ filePath: options.filePath || options.importPath || '',
12
+ });
13
+ // Create a local for casting.
14
+ const localExports = exports;
15
+ // Only do work if a file path was provided.
16
+ if (filePath) {
17
+ let exportsEntry = (localExports[importPath] || (localExports[importPath] = {}));
18
+ // Promote string-based exports into objects with default conditions.
19
+ if (typeof exportsEntry === 'string') {
20
+ exportsEntry = exports[importPath] = { default: exportsEntry };
41
21
  }
22
+ if (typesPath) {
23
+ exportsEntry['types'] = typesPath;
24
+ }
25
+ if (sourcePath) {
26
+ exportsEntry['source'] = sourcePath;
27
+ }
28
+ // Add the entry for the condition.
29
+ exportsEntry[condition] = filePath;
42
30
  }
43
- const safeImportPath = safeRelativePath(importPath || '.');
44
- let exportSet = exports[safeImportPath];
45
- // If the value of this path is a string, convert it to an object.
46
- if (typeof exportSet === 'string') {
47
- exportSet = exports[safeImportPath] = {
48
- default: exportSet,
49
- };
50
- }
51
- else if (!exportSet) {
52
- exportSet = exports[safeImportPath] = {};
31
+ }
32
+ function makeSafeImportKey(key) {
33
+ if (!key || key === '' || key === '.') {
34
+ return '.';
53
35
  }
54
- if (resolvedTypesPath) {
55
- exportSet.types = safeRelativePath(resolvedTypesPath);
36
+ // if the key starts with a slash, add a dot
37
+ if (key.startsWith('/')) {
38
+ key = '.' + key;
56
39
  }
57
- exportSet[condition] = intermediatePath;
58
- if (sourcePath && sourcePath !== intermediatePath) {
59
- exportSet.source = safeRelativePath(sourcePath);
40
+ // if the key doesn't start with "./", add it
41
+ if (!key.startsWith('./')) {
42
+ key = './' + key;
60
43
  }
44
+ // Remove the .js extension.
45
+ return key.replace(/\.js$/, '');
61
46
  }
62
47
  //# sourceMappingURL=addExportsMapEntry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addExportsMapEntry.js","sourceRoot":"","sources":["../src/addExportsMapEntry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAQxC;IACC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC;IAC5G,MAAM,UAAU,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACnD,IAAI,UAA8B,CAAC;IACnC,IAAI,gBAAoC,CAAC;IACzC,IAAI,iBAAiB,GAAuB,SAAS,CAAC;IAEtD,IAAI,UAAU,EAAE;QACd,UAAU,GAAG,MAAM,4BAA4B,CAAC,WAAW,EAAE,SAAS,IAAI,UAAU,EAAE;YACpF,QAAQ;YACR,YAAY,EAAE,UAAU;YACxB,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;QACH,gBAAgB,GAAG,UAAU,IAAI,wBAAwB,CAAC,UAAU,CAAC,CAAC;KACvE;SAAM;QACL,gBAAgB,GAAG,MAAM,4BAA4B,CAAC,WAAW,EAAE,SA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AS,EAAE;YACb,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;SACnC;QAED,IAAI,UAAU,EAAE;YACd,YAAY,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;SACrC;QAED,mCAAmC;QACnC,YAAY,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;KACpC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG,EAAE;QACrC,OAAO,GAAG,CAAC;KACZ;IAED,4CAA4C;IAC5C,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KACjB;IAED,6CAA6C;IAC7C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACzB,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;KAClB;IAED,4BAA4B;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC"}
@@ -1,38 +1,89 @@
1
1
  import { describe, expect, it } from '@jest/globals';
2
2
  import { addExportsMapEntry } from './addExportsMapEntry.js';
3
- import { testProject1Path } from './testPaths.js';
4
3
  import { createTestFileStructure } from '@ms-cloudpack/test-utilities';
5
4
  import path from 'path';
6
- describe('addExportsMapEntry', () => {
7
- it('can add an entry to an empty exports map', async () => {
5
+ describe('await addExportsMapEntry', () => {
6
+ it('can ignore entries that have no physical file', async () => {
8
7
  const exportsMap = {};
8
+ const packagePath = await createTestFileStructure({});
9
9
  await addExportsMapEntry({
10
10
  exports: exportsMap,
11
- packagePath: testProject1Path,
11
+ packagePath,
12
+ filePath: './lib/foo-sub1',
13
+ });
14
+ expect(exportsMap).toEqual({});
15
+ });
16
+ it('can add an entry with only an importPath', async () => {
17
+ const exportsMap = {};
18
+ const packagePath = await createTestFileStructure({
19
+ 'lib/foo-sub1.js': '',
20
+ });
21
+ await addExportsMapEntry({
22
+ exports: exportsMap,
23
+ packagePath,
12
24
  importPath: './lib/foo-sub1',
13
25
  });
14
26
  expect(exportsMap).toMatchInlineSnapshot(`
15
27
  {
16
28
  "./lib/foo-sub1": {
17
29
  "default": "./lib/foo-sub1.js",
18
- "source": "./src/foo-sub1.ts",
19
- "types": "./lib/foo-sub1.d.ts",
20
30
  },
21
31
  }
22
32
  `);
23
33
  });
24
- it('can add a non-safe import path', async () => {
34
+ it('can add an entry with only a file path', async () => {
25
35
  const exportsMap = {};
36
+ const packagePath = await createTestFileStructure({
37
+ 'lib/foo-sub1.js': '',
38
+ });
26
39
  await addExportsMapEntry({
27
40
  exports: exportsMap,
28
- packagePath: testProject1Path,
29
- importPath: 'lib/foo-sub1',
41
+ packagePath,
42
+ filePath: './lib/foo-sub1',
30
43
  });
31
44
  expect(exportsMap).toMatchInlineSnapshot(`
32
45
  {
33
- "./lib/foo-sub1": {
46
+ ".": {
47
+ "default": "./lib/foo-sub1.js",
48
+ },
49
+ }
50
+ `);
51
+ });
52
+ it('can add an entry with both import and file paths', async () => {
53
+ const exportsMap = {};
54
+ const packagePath = await createTestFileStructure({
55
+ 'lib/foo-sub1.js': '',
56
+ });
57
+ await addExportsMapEntry({
58
+ exports: exportsMap,
59
+ packagePath,
60
+ importPath: './foo',
61
+ filePath: './lib/foo-sub1',
62
+ });
63
+ expect(exportsMap).toMatchInlineSnapshot(`
64
+ {
65
+ "./foo": {
66
+ "default": "./lib/foo-sub1.js",
67
+ },
68
+ }
69
+ `);
70
+ });
71
+ it('can add an entry that has source backing it', async () => {
72
+ const exportsMap = {};
73
+ const packagePath = await createTestFileStructure({
74
+ 'src/foo-sub1.tsx': '',
75
+ });
76
+ await addExportsMapEntry({
77
+ exports: exportsMap,
78
+ packagePath,
79
+ importPath: '.',
80
+ filePath: './lib/foo-sub1',
81
+ });
82
+ expect(exportsMap).toMatchInlineSnapshot(`
83
+ {
84
+ ".": {
34
85
  "default": "./lib/foo-sub1.js",
35
- "source": "./src/foo-sub1.ts",
86
+ "source": "./src/foo-sub1.tsx",
36
87
  "types": "./lib/foo-sub1.d.ts",
37
88
  },
38
89
  }
@@ -42,25 +93,28 @@ describe('addExportsMapEntry', () => {
42
93
  const exportsMap = {
43
94
  '.': './lib/index.js',
44
95
  };
96
+ const packagePath = await createTestFileStructure({
97
+ 'src/foo.tsx': '',
98
+ });
45
99
  await addExportsMapEntry({
46
100
  exports: exportsMap,
47
- packagePath: testProject1Path,
48
- importPath: './lib/foo-sub1',
101
+ packagePath,
102
+ importPath: './lib/foo',
49
103
  });
50
104
  expect(exportsMap).toMatchInlineSnapshot(`
51
105
  {
52
106
  ".": "./lib/index.js",
53
- "./lib/foo-sub1": {
54
- "default": "./lib/foo-sub1.js",
55
- "source": "./src/foo-sub1.ts",
56
- "types": "./lib/foo-sub1.d.ts",
107
+ "./lib/foo": {
108
+ "default": "./lib/foo.js",
109
+ "source": "./src/foo.tsx",
110
+ "types": "./lib/foo.d.ts",
57
111
  },
58
112
  }
59
113
  `);
60
114
  });
61
115
  it('can add an entry to an external package like the "debug" package', async () => {
62
116
  const exportsMap = {};
63
- const testPath = await createTestFileStructure({
117
+ const repoPath = await createTestFileStructure({
64
118
  'node_modules/debug/package.json': {
65
119
  name: 'debug',
66
120
  main: './src/index.js',
@@ -69,15 +123,48 @@ describe('addExportsMapEntry', () => {
69
123
  'node_modules/debug/src/index.js': '',
70
124
  'node_modules/debug/src/browser.js': '',
71
125
  });
126
+ const packagePath = path.join(repoPath, 'node_modules/debug');
127
+ await addExportsMapEntry({
128
+ exports: exportsMap,
129
+ packagePath,
130
+ importPath: '.',
131
+ filePath: './src/index.js',
132
+ condition: 'require',
133
+ });
134
+ await addExportsMapEntry({
135
+ exports: exportsMap,
136
+ packagePath,
137
+ importPath: '.',
138
+ filePath: './src/browser.js',
139
+ condition: 'browser',
140
+ });
141
+ expect(exportsMap).toMatchInlineSnapshot(`
142
+ {
143
+ ".": {
144
+ "browser": "./src/browser.js",
145
+ "require": "./src/index.js",
146
+ },
147
+ }
148
+ `);
149
+ });
150
+ it('can add typings specified in input', async () => {
151
+ const exportsMap = {};
152
+ const packagePath = await createTestFileStructure({
153
+ 'index.js': '',
154
+ 'typings/index.d.ts': '',
155
+ });
72
156
  await addExportsMapEntry({
73
157
  exports: exportsMap,
74
- packagePath: path.join(testPath, 'node_modules/debug'),
158
+ packagePath,
75
159
  importPath: '.',
160
+ filePath: './index.js',
161
+ typesPath: './typings/index.d.ts',
76
162
  });
77
163
  expect(exportsMap).toMatchInlineSnapshot(`
78
164
  {
79
165
  ".": {
80
- "default": "./src/browser.js",
166
+ "default": "./index.js",
167
+ "types": "./typings/index.d.ts",
81
168
  },
82
169
  }
83
170
  `);
@@ -1 +1 @@
1
- {"version":3,"file":"addExportsMapEntry.test.js","sourceRoot":"","sources":["../src/addExportsMapEntry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,UAAU,GAAG,EAAE,CAAC;QAEtB,MAAM,kBAAkB,CAAC;YACvB,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,gBAAgB;YAC7B,UAAU,EAAE,gBAAgB;SAC7B,CAAC,CAAC;QAEH,MAAM,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQxC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,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kB,CAAC;YACvB,OAAO,EAAE,UAAU;YACnB,WAAW;YACX,UAAU,EAAE,GAAG;YACf,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,sBAAsB;SAClC,CAAC,CAAC;QAEH,MAAM,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC;;;;;;;KAOxC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
- import path from 'path';
2
- import { isFile } from '@ms-cloudpack/path-utilities';
3
1
  import { PackageDefinitions } from './PackageDefinitions.js';
4
2
  import { addExportsMapEntry } from './addExportsMapEntry.js';
3
+ import { safeRelativePath } from '@ms-cloudpack/path-string-parsing';
5
4
  /**
6
5
  * Given a package path, generates an export map for the package.
7
6
  */
@@ -15,60 +14,43 @@ export async function createExportsMap(packagePath, options = {}) {
15
14
  if (definition.exports) {
16
15
  return definition.exports;
17
16
  }
18
- const { main, module, browser } = definition;
19
- const browserString = typeof browser === 'string' ? browser : undefined;
20
- const rootIndex = isFile(path.join(packagePath, 'index.js')) ? './index.js' : undefined;
17
+ const { browser, main, module, types, typings, type } = definition;
21
18
  const exports = {};
22
- const typesPath = definition.types || definition.typings;
23
- const hasPackageEntry = browserString || module || main || rootIndex;
24
- if (!hasPackageEntry) {
25
- if (!browser) {
26
- return exports;
27
- }
28
- }
29
- else {
30
- await addExportsMapEntry({
19
+ const typesPath = types || typings;
20
+ await addExportsMapEntry({
21
+ exports,
22
+ packagePath,
23
+ filePath: 'index.js',
24
+ typesPath,
25
+ condition: type === 'module' ? 'import' : 'default',
26
+ });
27
+ main &&
28
+ (await addExportsMapEntry({
31
29
  exports,
32
- importPath: '.',
33
30
  packagePath,
34
- condition: 'default',
35
- entryPath: browserString || module || main || rootIndex,
31
+ filePath: main,
36
32
  typesPath,
37
- });
38
- }
39
- if (typeof browser === 'object') {
40
- // If we have an entry defined in the package, iterate through exports and update things.
41
- if (hasPackageEntry) {
42
- for (const mapValue of Object.values(exports)) {
43
- const exportUrl = mapValue.import || mapValue.default;
44
- if (browser[exportUrl]) {
45
- mapValue['browser'] = browser[exportUrl] || '';
46
- }
47
- }
33
+ condition: type === 'module' ? 'import' : 'default',
34
+ }));
35
+ module && (await addExportsMapEntry({ exports, packagePath, filePath: module, typesPath, condition: 'import' }));
36
+ if (browser) {
37
+ if (typeof definition.browser === 'string') {
38
+ await addExportsMapEntry({ exports, packagePath, filePath: definition.browser, condition: 'browser' });
48
39
  }
49
- else {
50
- // When all we have are browser entries, attempt to make exports out of them.
51
- for (const [key, value] of Object.entries(browser)) {
52
- if (typeof value === 'string' && path.extname(value) === '.js') {
53
- exports[makeSafeImportKey(key)] = {
54
- browser: value,
55
- };
40
+ else if (typeof definition.browser === 'object') {
41
+ for (const [key, value] of Object.entries(definition.browser)) {
42
+ if (value) {
43
+ await addExportsMapEntry({
44
+ exports,
45
+ packagePath,
46
+ importPath: safeRelativePath(module || main) === safeRelativePath(key) ? '.' : key,
47
+ filePath: value,
48
+ condition: 'browser',
49
+ });
56
50
  }
57
51
  }
58
52
  }
59
53
  }
60
54
  return exports;
61
55
  }
62
- function makeSafeImportKey(key) {
63
- // if the key starts with a slash, add a dot
64
- if (key.startsWith('/')) {
65
- key = '.' + key;
66
- }
67
- // if the key doesn't start with "./", add it
68
- if (!key.startsWith('./')) {
69
- key = './' + key;
70
- }
71
- // Remove the .js extension.
72
- return key.replace(/\.js$/, '');
73
- }
74
56
  //# sourceMappingURL=createExportsMap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createExportsMap.js","sourceRoot":"","sources":["../src/createExportsMap.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,MAAM,CAA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