@ms-cloudpack/package-utilities
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,3 +5,26 @@ { | ||
{ | ||
"date": "Thu, 20 Oct 2022 08:11:43 GMT", | ||
"date": "Wed, 02 Nov 2022 08:10:59 GMT", | ||
"tag": "@ms-cloudpack/package-utilities_v1.2.0", | ||
"version": "1.2.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"author": "dzearing@microsoft.com", | ||
"package": "@ms-cloudpack/package-utilities", | ||
"commit": "3439c51ff4eb7cb624cf84fb2881a781eabca83f", | ||
"comment": "flattenExportsMap can now expand \"...\" in `conditions` option when wanting to use default conditions." | ||
} | ||
], | ||
"none": [ | ||
{ | ||
"author": "renovate@whitesourcesoftware.com", | ||
"package": "@ms-cloudpack/package-utilities", | ||
"commit": "de70246a89e8ea18b5aaf1fc6e3fa55a493fa439", | ||
"comment": "Update devDependency @babel/types to v7.20.0" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 20 Oct 2022 08:12:02 GMT", | ||
"tag": "@ms-cloudpack/package-utilities_v1.1.0", | ||
@@ -8,0 +31,0 @@ "version": "1.1.0", |
# Change Log - @ms-cloudpack/package-utilities | ||
This log was last generated on Thu, 20 Oct 2022 08:11:43 GMT and should not be manually modified. | ||
This log was last generated on Wed, 02 Nov 2022 08:10:59 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 1.2.0 | ||
Wed, 02 Nov 2022 08:10:59 GMT | ||
### Minor changes | ||
- flattenExportsMap can now expand "..." in `conditions` option when wanting to use default conditions. (dzearing@microsoft.com) | ||
## 1.1.0 | ||
Thu, 20 Oct 2022 08:11:43 GMT | ||
Thu, 20 Oct 2022 08:12:02 GMT | ||
@@ -11,0 +19,0 @@ ### Minor changes |
@@ -9,3 +9,13 @@ import path from 'path'; | ||
export function flattenExportsMap(exportsMap, options = {}) { | ||
const { conditions = defaultConditions, requiredConditions } = options; | ||
const { requiredConditions } = options; | ||
let { conditions } = options; | ||
if (conditions) { | ||
const defaultIndex = conditions.indexOf('...'); | ||
if (defaultIndex !== -1) { | ||
conditions = [...conditions.slice(0, defaultIndex), ...defaultConditions, ...conditions.slice(defaultIndex + 1)]; | ||
} | ||
} | ||
else { | ||
conditions = defaultConditions; | ||
} | ||
if (typeof exportsMap === 'string' && conditions.includes('default')) { | ||
@@ -12,0 +22,0 @@ return { |
@@ -184,3 +184,25 @@ import { describe, it, expect } from '@jest/globals'; | ||
}); | ||
it('can expand ... in conditions to the default set of conditions', () => { | ||
const exportsMap = { | ||
'.': { | ||
default: './default.js', | ||
source: './source.js', | ||
}, | ||
'./foo': { | ||
default: './foo.js', | ||
}, | ||
}; | ||
expect(flattenExportsMap(exportsMap, { conditions: ['source'] })).toMatchInlineSnapshot(` | ||
{ | ||
".": "./source.js", | ||
} | ||
`); | ||
expect(flattenExportsMap(exportsMap, { conditions: ['source', '...'] })).toMatchInlineSnapshot(` | ||
{ | ||
".": "./source.js", | ||
"./foo": "./foo.js", | ||
} | ||
`); | ||
}); | ||
}); | ||
//# sourceMappingURL=flattenExportsMap.test.js.map |
@@ -12,4 +12,3 @@ export { PackageDefinitions, type PackageDefinitionTransform } from './PackageDefinitions.js'; | ||
export { resolveImportFromPackage, resolveImportFromPackagePath, type ResolveImportFromPackageOptions, } from './resolveImportFromPackagePath.js'; | ||
export { getPackageEntries } from './getPackageEntries.js'; | ||
export { detectModuleType, type ModuleType } from './detectModuleType.js'; | ||
export { isExternalPackage } from './isExternalPackage.js'; |
@@ -16,3 +16,2 @@ // Package definition parsing | ||
export { resolveImportFromPackage, resolveImportFromPackagePath, } from './resolveImportFromPackagePath.js'; | ||
export { getPackageEntries } from './getPackageEntries.js'; | ||
// Other package utilities | ||
@@ -19,0 +18,0 @@ export { detectModuleType } from './detectModuleType.js'; |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.33.1" | ||
"packageVersion": "7.33.5" | ||
} | ||
] | ||
} |
{ | ||
"name": "@ms-cloudpack/package-utilities", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Utilities for resolving/parsing packages and their imports.", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
"@types/resolve": "1.20.2", | ||
"@babel/types": "7.19.4" | ||
"@babel/types": "7.20.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
182832
98
3022