@ms-cloudpack/package-utilities 2.3.0 → 2.3.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.
Files changed (46) hide show
  1. package/lib/testPaths.d.ts +0 -3
  2. package/lib/testPaths.js +0 -3
  3. package/lib/testPaths.js.map +1 -1
  4. package/lib/tsdoc-metadata.json +1 -1
  5. package/package.json +5 -5
  6. package/CHANGELOG.json +0 -1024
  7. package/CHANGELOG.md +0 -373
  8. package/lib/PackageDefinitions.test.d.ts +0 -1
  9. package/lib/PackageDefinitions.test.js +0 -89
  10. package/lib/PackageDefinitions.test.js.map +0 -1
  11. package/lib/addExportsMapEntry.test.d.ts +0 -1
  12. package/lib/addExportsMapEntry.test.js +0 -182
  13. package/lib/addExportsMapEntry.test.js.map +0 -1
  14. package/lib/createExportsMap.test.d.ts +0 -1
  15. package/lib/createExportsMap.test.js +0 -313
  16. package/lib/createExportsMap.test.js.map +0 -1
  17. package/lib/createImportMap.test.d.ts +0 -1
  18. package/lib/createImportMap.test.js +0 -155
  19. package/lib/createImportMap.test.js.map +0 -1
  20. package/lib/createResolveMap.test.d.ts +0 -1
  21. package/lib/createResolveMap.test.js +0 -263
  22. package/lib/createResolveMap.test.js.map +0 -1
  23. package/lib/detectModuleType.test.d.ts +0 -1
  24. package/lib/detectModuleType.test.js +0 -32
  25. package/lib/detectModuleType.test.js.map +0 -1
  26. package/lib/findFileInPackage.test.d.ts +0 -1
  27. package/lib/findFileInPackage.test.js +0 -112
  28. package/lib/findFileInPackage.test.js.map +0 -1
  29. package/lib/findResolveMapEntry.test.d.ts +0 -1
  30. package/lib/findResolveMapEntry.test.js +0 -68
  31. package/lib/findResolveMapEntry.test.js.map +0 -1
  32. package/lib/flattenExportsMap.test.d.ts +0 -1
  33. package/lib/flattenExportsMap.test.js +0 -207
  34. package/lib/flattenExportsMap.test.js.map +0 -1
  35. package/lib/getExportPathFromEntry.test.d.ts +0 -1
  36. package/lib/getExportPathFromEntry.test.js +0 -38
  37. package/lib/getExportPathFromEntry.test.js.map +0 -1
  38. package/lib/getExportsMap.test.d.ts +0 -1
  39. package/lib/getExportsMap.test.js +0 -30
  40. package/lib/getExportsMap.test.js.map +0 -1
  41. package/lib/isExternalPackage.test.d.ts +0 -1
  42. package/lib/isExternalPackage.test.js +0 -13
  43. package/lib/isExternalPackage.test.js.map +0 -1
  44. package/lib/resolve.test.d.ts +0 -1
  45. package/lib/resolve.test.js +0 -13
  46. package/lib/resolve.test.js.map +0 -1
package/CHANGELOG.md DELETED
@@ -1,373 +0,0 @@
1
- # Change Log - @ms-cloudpack/package-utilities
2
-
3
- This log was last generated on Wed, 25 Jan 2023 08:11:01 GMT and should not be manually modified.
4
-
5
- <!-- Start content -->
6
-
7
- ## 2.3.0
8
-
9
- Wed, 25 Jan 2023 08:11:01 GMT
10
-
11
- ### Minor changes
12
-
13
- - Replace `PackageJson` from `type-fest` with a version from `@ms-cloudpack/bundler-types` (elcraig@microsoft.com)
14
- - Bump @ms-cloudpack/package-overrides to v0.3.0
15
-
16
- ## 2.2.2
17
-
18
- Mon, 23 Jan 2023 21:06:01 GMT
19
-
20
- ### Patches
21
-
22
- - Update type-only references to PackageDefinitions to use PackageDefinitionsCache type instead. **Small break:** remove `PackageDefinitionTransform` export (import from `@ms-cloudpack/bundler-types` instead). (elcraig@microsoft.com)
23
- - Bump @ms-cloudpack/package-overrides to v0.2.2
24
-
25
- ## 2.2.0
26
-
27
- Thu, 08 Dec 2022 08:12:47 GMT
28
-
29
- ### Minor changes
30
-
31
- - Adding method to clear transforms (dake.3601@gmail.com)
32
-
33
- ## 2.1.2
34
-
35
- Sat, 03 Dec 2022 08:10:45 GMT
36
-
37
- ### Patches
38
-
39
- - Used async isFile to improve performance (dake.3601@gmail.com)
40
- - Bump @ms-cloudpack/path-utilities to v2.0.0
41
-
42
- ## 2.1.1
43
-
44
- Thu, 01 Dec 2022 08:10:47 GMT
45
-
46
- ### Patches
47
-
48
- - Adding individual task version to import map (dake.3601@gmail.com)
49
- - Package now exports findFileInPackage. (dake.3601@gmail.com)
50
-
51
- ## 2.1.0
52
-
53
- Sat, 19 Nov 2022 08:11:13 GMT
54
-
55
- ### Minor changes
56
-
57
- - When creating exports maps using createExportsMap, packages with no metadata but have src/index.*, src/main.*, or /index.* will still generate an entry point. (dzearing@microsoft.com)
58
-
59
- ## 2.0.0
60
-
61
- Wed, 16 Nov 2022 08:11:39 GMT
62
-
63
- ### Major changes
64
-
65
- - Added exclude scoped packages option to findResolveMapEntry function. (dake.3601@gmail.com)
66
-
67
- ## 1.2.1
68
-
69
- Tue, 15 Nov 2022 08:13:12 GMT
70
-
71
- ### Patches
72
-
73
- - When packages have browser/main/module entries which don't exist on disk, fall back to others that might exist. (dzearing@microsoft.com)
74
- - Bump @ms-cloudpack/path-utilities to v1.1.1
75
-
76
- ## 1.2.0
77
-
78
- Wed, 02 Nov 2022 08:11:20 GMT
79
-
80
- ### Minor changes
81
-
82
- - flattenExportsMap can now expand "..." in `conditions` option when wanting to use default conditions. (dzearing@microsoft.com)
83
-
84
- ## 1.1.0
85
-
86
- Thu, 20 Oct 2022 08:12:02 GMT
87
-
88
- ### Minor changes
89
-
90
- - Import map now has a refresh version in its path to allow cache busting. (dake.3601@gmail.com)
91
-
92
- ## 1.0.1
93
-
94
- Tue, 18 Oct 2022 08:16:24 GMT
95
-
96
- ### Patches
97
-
98
- - Bump @ms-cloudpack/path-utilities to v1.1.0
99
-
100
- ## 1.0.0
101
-
102
- Sat, 15 Oct 2022 08:11:31 GMT
103
-
104
- ### Major changes
105
-
106
- - Moving slash export to a different package. (dake.3601@gmail.com)
107
- - Bump @ms-cloudpack/path-utilities to v1.0.0
108
- - Bump @ms-cloudpack/path-string-parsing to v1.0.0
109
-
110
- ## 0.16.1
111
-
112
- Thu, 13 Oct 2022 08:12:52 GMT
113
-
114
- ### Patches
115
-
116
- - Add merge to package.json (altinokd@microsoft.com)
117
-
118
- ## 0.16.0
119
-
120
- Wed, 12 Oct 2022 21:49:54 GMT
121
-
122
- ### Minor changes
123
-
124
- - Tweaking how exports are generated for browser entries, fixing a variety of other issues. (dzearing@microsoft.com)
125
-
126
- ## 0.15.0
127
-
128
- Wed, 12 Oct 2022 08:10:43 GMT
129
-
130
- ### Minor changes
131
-
132
- - Overhauling import/export map utilities. (dzearing@microsoft.com)
133
-
134
- ## 0.14.0
135
-
136
- Wed, 05 Oct 2022 19:39:20 GMT
137
-
138
- ### Minor changes
139
-
140
- - Overhaul of import/export map utilities. We now have getExportsMap, createExportsMap, flattenExportsMap, and createImportMap. Also removing some of the deprecated apis. (dzearing@microsoft.com)
141
-
142
- ## 0.13.1
143
-
144
- Thu, 29 Sep 2022 17:46:30 GMT
145
-
146
- ### Patches
147
-
148
- - Bump @ms-cloudpack/json-utilities to v0.0.4
149
-
150
- ## 0.13.0
151
-
152
- Thu, 29 Sep 2022 08:13:15 GMT
153
-
154
- ### Minor changes
155
-
156
- - Updating a variety of edge cases in package utility exports parsing. (dzearing@microsoft.com)
157
- - Bump @ms-cloudpack/package-overrides to v0.2.0
158
-
159
- ## 0.12.3
160
-
161
- Wed, 28 Sep 2022 08:15:16 GMT
162
-
163
- ### Patches
164
-
165
- - Fix issues with undefined property checks (elcraig@microsoft.com)
166
- - Bump @ms-cloudpack/package-overrides to v0.1.2
167
-
168
- ## 0.12.2
169
-
170
- Sat, 24 Sep 2022 08:10:47 GMT
171
-
172
- ### Patches
173
-
174
- - Minor typescript change. (dzearing@microsoft.com)
175
-
176
- ## 0.12.1
177
-
178
- Fri, 23 Sep 2022 08:13:07 GMT
179
-
180
- ### Patches
181
-
182
- - Bump @ms-cloudpack/package-overrides to v0.1.1
183
-
184
- ## 0.12.0
185
-
186
- Thu, 22 Sep 2022 08:15:14 GMT
187
-
188
- ### Minor changes
189
-
190
- - Adding generateExportsMap api. (dzearing@microsoft.com)
191
-
192
- ## 0.11.0
193
-
194
- Wed, 21 Sep 2022 08:15:19 GMT
195
-
196
- ### Minor changes
197
-
198
- - Renaming `getExportsMap` to `getFlattenedExportsMap`. (dzearing@microsoft.com)
199
- - Bump @ms-cloudpack/path-utilities to v0.5.0
200
-
201
- ### Patches
202
-
203
- - Modules with "exports.foo =" are now correctly detected as cjs. (dzearing@microsoft.com)
204
-
205
- ## 0.10.0
206
-
207
- Tue, 06 Sep 2022 08:17:50 GMT
208
-
209
- ### Minor changes
210
-
211
- - Removing getPackageDefinition implementation. (dzearing@microsoft.com)
212
- - Bump @ms-cloudpack/path-utilities to v0.4.0
213
-
214
- ## 0.9.0
215
-
216
- Sun, 04 Sep 2022 08:14:55 GMT
217
-
218
- ### Minor changes
219
-
220
- - Adding PackageDefinitions implementation. (dzearing@microsoft.com)
221
-
222
- ## 0.8.1
223
-
224
- Sat, 03 Sep 2022 08:15:29 GMT
225
-
226
- ### Patches
227
-
228
- - Bump @ms-cloudpack/path-utilities to v0.3.2
229
-
230
- ## 0.8.0
231
-
232
- Wed, 24 Aug 2022 08:14:41 GMT
233
-
234
- ### Minor changes
235
-
236
- - Adding getExportsMap utility plus tests to update how importMaps are generated. Integrated into the workflow. (dzearing@microsoft.com)
237
- - Bump @ms-cloudpack/package-overrides to v0.1.0
238
-
239
- ## 0.7.0
240
-
241
- Tue, 16 Aug 2022 08:12:03 GMT
242
-
243
- ### Minor changes
244
-
245
- - Removing unused code. (dzearing@microsoft.com)
246
-
247
- ## 0.6.1
248
-
249
- Fri, 12 Aug 2022 08:12:39 GMT
250
-
251
- ### Patches
252
-
253
- - * evaluateImportsFromEntries: removing console logging
254
- * getExportPathFromEntry: adding "module" to the default list of conditions to use when deriving entry paths.
255
- * resolveImportFromPackagePath: removing console logging
256
- * resolvePackageEntries: if the browser entry is a string, resolve that over main or module. (dzearing@microsoft.com)
257
-
258
- ## 0.6.0
259
-
260
- Fri, 05 Aug 2022 08:12:21 GMT
261
-
262
- ### Minor changes
263
-
264
- - Tweaking a variety of API surface to prep for ori integration. Lots of improvements to how we resolve modules, lots of tests added. (dzearing@microsoft.com)
265
-
266
- ## 0.5.1
267
-
268
- Tue, 02 Aug 2022 20:04:16 GMT
269
-
270
- ### Patches
271
-
272
- - Update babel monorepo to v7.18.10 (renovate@whitesourcesoftware.com)
273
-
274
- ## 0.5.0
275
-
276
- Wed, 08 Jun 2022 20:07:00 GMT
277
-
278
- ### Minor changes
279
-
280
- - Moving to type-fest for package.json typings. Updated a number of APIs to reflect changes. (dzearing@microsoft.com)
281
- - Bump @ms-cloudpack/package-overrides to v0.0.2
282
- - Bump @ms-cloudpack/path-utilities to v0.3.1
283
-
284
- ## 0.4.1
285
-
286
- Thu, 26 May 2022 02:50:21 GMT
287
-
288
- ### Patches
289
-
290
- - Update babel monorepo to v7.18.2 (bot@renovateapp.com)
291
-
292
- ## 0.4.0
293
-
294
- Wed, 25 May 2022 21:40:45 GMT
295
-
296
- ### Minor changes
297
-
298
- - Updating the entry evaluation to prefer source files for intra-repo packages. (dzearing@microsoft.com)
299
- - Bump @ms-cloudpack/path-utilities to v0.3.0
300
-
301
- ## 0.3.0
302
-
303
- Sat, 21 May 2022 00:31:32 GMT
304
-
305
- ### Minor changes
306
-
307
- - Adding api to generate an import map based on a resolve map. (dzearing@microsoft.com)
308
-
309
- ## 0.2.0
310
-
311
- Fri, 20 May 2022 04:26:15 GMT
312
-
313
- ### Minor changes
314
-
315
- - Updating createResolveMap logic. (dzearing@microsoft.com)
316
- - Bump @ms-cloudpack/path-utilities to v0.2.0
317
-
318
- ## 0.1.7
319
-
320
- Thu, 19 May 2022 21:04:02 GMT
321
-
322
- ### Patches
323
-
324
- - Update babel monorepo to v7.18.0 (bot@renovateapp.com)
325
-
326
- ## 0.1.6
327
-
328
- Sat, 14 May 2022 04:36:11 GMT
329
-
330
- ### Patches
331
-
332
- - Fix issues found by eslint rules (elcraig@microsoft.com)
333
-
334
- ## 0.1.3
335
-
336
- Mon, 09 May 2022 23:39:35 GMT
337
-
338
- ### Patches
339
-
340
- - Cleaning up problems found with depcheck (bot@renovateapp.com)
341
-
342
- ## 0.1.2
343
-
344
- Wed, 04 May 2022 22:53:26 GMT
345
-
346
- ### Patches
347
-
348
- - Bump @ms-cloudpack/get-package to v0.0.2
349
-
350
- ## 0.1.1
351
-
352
- Tue, 29 Mar 2022 01:47:58 GMT
353
-
354
- ### Patches
355
-
356
- - Removing dev only typings. (dzearing@microsoft.com)
357
-
358
- ## 0.1.0
359
-
360
- Thu, 03 Mar 2022 23:26:03 GMT
361
-
362
- ### Minor changes
363
-
364
- - Removing isFile and isFolder methods from package utilities. (dzearing@microsoft.com)
365
- - Bump @ms-cloudpack/path-utilities to v0.1.0
366
-
367
- ## 0.0.4
368
-
369
- Sat, 19 Feb 2022 00:27:41 GMT
370
-
371
- ### Patches
372
-
373
- - Updating evaluateImportsFromEntries to respect async imports. (dzearing@microsoft.com)
@@ -1 +0,0 @@
1
- export {};
@@ -1,89 +0,0 @@
1
- import { PackageDefinitions } from './PackageDefinitions.js';
2
- import { testProject1Path } from './testPaths.js';
3
- import { describe, it, expect } from '@jest/globals';
4
- describe('PackageDefinitions', () => {
5
- it('can get a package definition', async () => {
6
- const definitions = new PackageDefinitions();
7
- expect(await definitions.get(testProject1Path)).toMatchInlineSnapshot(`
8
- {
9
- "dependencies": {
10
- "b": "^1.0.0",
11
- "c": "^1.0.0",
12
- },
13
- "exports": {
14
- ".": "./lib/index.js",
15
- "./foo": "./lib/foo.js",
16
- },
17
- "name": "test-project-1",
18
- "type": "module",
19
- "version": "0.0.1",
20
- }
21
- `);
22
- });
23
- it('can return undefined when the package definition is missing', async () => {
24
- const definitions = new PackageDefinitions();
25
- expect(await definitions.get('./missing')).toBeUndefined();
26
- });
27
- it('can get package definitions with transforms', async () => {
28
- const definitions = new PackageDefinitions();
29
- definitions.registerTransform((definition) => ({
30
- ...definition,
31
- name: 'transformed',
32
- }));
33
- expect(await definitions.get(testProject1Path)).toMatchInlineSnapshot(`
34
- {
35
- "dependencies": {
36
- "b": "^1.0.0",
37
- "c": "^1.0.0",
38
- },
39
- "exports": {
40
- ".": "./lib/index.js",
41
- "./foo": "./lib/foo.js",
42
- },
43
- "name": "transformed",
44
- "type": "module",
45
- "version": "0.0.1",
46
- }
47
- `);
48
- });
49
- it('can get package definitions with transforms and refresh', async () => {
50
- const definitions = new PackageDefinitions();
51
- let transformName = 'transformed';
52
- let definition = await definitions.get(testProject1Path);
53
- expect(definition?.name).toBe('test-project-1');
54
- definitions.registerTransform((definition) => ({
55
- ...definition,
56
- name: transformName,
57
- }));
58
- definition = await definitions.get(testProject1Path);
59
- expect(definition?.name).toBe('transformed');
60
- transformName = 'transformed2';
61
- // This should return a cached version.
62
- definition = await definitions.get(testProject1Path);
63
- expect(definition?.name).toBe('transformed');
64
- // Passing in refresh:true should reset.
65
- definition = await definitions.get(testProject1Path, { refresh: true });
66
- expect(definition?.name).toBe('transformed2');
67
- });
68
- it('can get package definitions with transforms and clear', async () => {
69
- const definitions = new PackageDefinitions();
70
- let transformName = 'transformed';
71
- let definition = await definitions.get(testProject1Path);
72
- expect(definition?.name).toBe('test-project-1');
73
- definitions.registerTransform((definition) => ({
74
- ...definition,
75
- name: transformName,
76
- }));
77
- definition = await definitions.get(testProject1Path);
78
- expect(definition?.name).toBe('transformed');
79
- transformName = 'transformed2';
80
- // This should return a cached version.
81
- definition = await definitions.get(testProject1Path);
82
- expect(definition?.name).toBe('transformed');
83
- // Clearing should reset.
84
- definitions.clear();
85
- definition = await definitions.get(testProject1Path);
86
- expect(definition?.name).toBe('transformed2');
87
- });
88
- });
89
- //# sourceMappingURL=PackageDefinitions.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PackageDefinitions.test.js","sourceRoot":"","sources":["../src/PackageDefinitions.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,QAAQ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E7C,aAAa,GAAG,cAAc,CAAC;QAE/B,uCAAuC;QACvC,UAAU,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACrD,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7C,yBAAyB;QACzB,WAAW,CAAC,KAAK,EAAE,CAAC;QACpB,UAAU,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACrD,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,182 +0,0 @@
1
- import { describe, expect, it, afterEach } from '@jest/globals';
2
- import { addExportsMapEntry } from './addExportsMapEntry.js';
3
- import { createTestFileStructure } from '@ms-cloudpack/test-utilities';
4
- import path from 'path';
5
- import fs from 'fs';
6
- const { rm } = fs.promises;
7
- describe('await addExportsMapEntry', () => {
8
- let testPath;
9
- afterEach(async () => {
10
- if (testPath) {
11
- await rm(testPath, { recursive: true });
12
- testPath = undefined;
13
- }
14
- });
15
- it('can ignore entries that have no physical file', async () => {
16
- const exportsMap = {};
17
- testPath = await createTestFileStructure({});
18
- await addExportsMapEntry({
19
- exports: exportsMap,
20
- packagePath: testPath,
21
- filePath: './lib/foo-sub1',
22
- });
23
- expect(exportsMap).toEqual({});
24
- });
25
- it('can add an entry with only an importPath', async () => {
26
- const exportsMap = {};
27
- testPath = await createTestFileStructure({
28
- 'lib/foo-sub1.js': '',
29
- });
30
- await addExportsMapEntry({
31
- exports: exportsMap,
32
- packagePath: testPath,
33
- importPath: './lib/foo-sub1',
34
- });
35
- expect(exportsMap).toMatchInlineSnapshot(`
36
- {
37
- "./lib/foo-sub1": {
38
- "default": "./lib/foo-sub1.js",
39
- },
40
- }
41
- `);
42
- });
43
- it('can add an entry with only a file path', async () => {
44
- const exportsMap = {};
45
- testPath = await createTestFileStructure({
46
- 'lib/foo-sub1.js': '',
47
- });
48
- await addExportsMapEntry({
49
- exports: exportsMap,
50
- packagePath: testPath,
51
- filePath: './lib/foo-sub1',
52
- });
53
- expect(exportsMap).toMatchInlineSnapshot(`
54
- {
55
- ".": {
56
- "default": "./lib/foo-sub1.js",
57
- },
58
- }
59
- `);
60
- });
61
- it('can add an entry with both import and file paths', async () => {
62
- const exportsMap = {};
63
- testPath = await createTestFileStructure({
64
- 'lib/foo-sub1.js': '',
65
- });
66
- await addExportsMapEntry({
67
- exports: exportsMap,
68
- packagePath: testPath,
69
- importPath: './foo',
70
- filePath: './lib/foo-sub1',
71
- });
72
- expect(exportsMap).toMatchInlineSnapshot(`
73
- {
74
- "./foo": {
75
- "default": "./lib/foo-sub1.js",
76
- },
77
- }
78
- `);
79
- });
80
- it('can add an entry that has source backing it', async () => {
81
- const exportsMap = {};
82
- testPath = await createTestFileStructure({
83
- 'src/foo-sub1.tsx': '',
84
- });
85
- await addExportsMapEntry({
86
- exports: exportsMap,
87
- packagePath: testPath,
88
- importPath: '.',
89
- filePath: './lib/foo-sub1',
90
- });
91
- expect(exportsMap).toMatchInlineSnapshot(`
92
- {
93
- ".": {
94
- "default": "./lib/foo-sub1.js",
95
- "source": "./src/foo-sub1.tsx",
96
- "types": "./lib/foo-sub1.d.ts",
97
- },
98
- }
99
- `);
100
- });
101
- it('can add an entry to an existing exports map', async () => {
102
- const exportsMap = {
103
- '.': './lib/index.js',
104
- };
105
- testPath = await createTestFileStructure({
106
- 'src/foo.tsx': '',
107
- });
108
- await addExportsMapEntry({
109
- exports: exportsMap,
110
- packagePath: testPath,
111
- importPath: './lib/foo',
112
- });
113
- expect(exportsMap).toMatchInlineSnapshot(`
114
- {
115
- ".": "./lib/index.js",
116
- "./lib/foo": {
117
- "default": "./lib/foo.js",
118
- "source": "./src/foo.tsx",
119
- "types": "./lib/foo.d.ts",
120
- },
121
- }
122
- `);
123
- });
124
- it('can add an entry to an external package like the "debug" package', async () => {
125
- const exportsMap = {};
126
- testPath = await createTestFileStructure({
127
- 'node_modules/debug/package.json': {
128
- name: 'debug',
129
- main: './src/index.js',
130
- browser: './src/browser.js',
131
- },
132
- 'node_modules/debug/src/index.js': '',
133
- 'node_modules/debug/src/browser.js': '',
134
- });
135
- const packagePath = path.join(testPath, 'node_modules/debug');
136
- await addExportsMapEntry({
137
- exports: exportsMap,
138
- packagePath,
139
- importPath: '.',
140
- filePath: './src/index.js',
141
- condition: 'require',
142
- });
143
- await addExportsMapEntry({
144
- exports: exportsMap,
145
- packagePath,
146
- importPath: '.',
147
- filePath: './src/browser.js',
148
- condition: 'browser',
149
- });
150
- expect(exportsMap).toMatchInlineSnapshot(`
151
- {
152
- ".": {
153
- "browser": "./src/browser.js",
154
- "require": "./src/index.js",
155
- },
156
- }
157
- `);
158
- });
159
- it('can add typings specified in input', async () => {
160
- const exportsMap = {};
161
- testPath = await createTestFileStructure({
162
- 'index.js': '',
163
- 'typings/index.d.ts': '',
164
- });
165
- await addExportsMapEntry({
166
- exports: exportsMap,
167
- packagePath: testPath,
168
- importPath: '.',
169
- filePath: './index.js',
170
- typesPath: './typings/index.d.ts',
171
- });
172
- expect(exportsMap).toMatchInlineSnapshot(`
173
- {
174
- ".": {
175
- "default": "./index.js",
176
- "types": "./typings/index.d.ts",
177
- },
178
- }
179
- `);
180
- });
181
- });
182
- //# sourceMappingURL=addExportsMapEntry.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addExportsMapEntry.test.js","sourceRoot":"","sources":["../src/addExportsMapEntry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,IAAI,MAAM,MAAM,C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