@ms-cloudpack/package-utilities
Advanced tools
Comparing version 7.4.8 to 7.4.9
@@ -6,2 +6,3 @@ import path from 'path'; | ||
import { getCloudpackTransform } from './getCloudpackTransform.js'; | ||
import { slash } from '@ms-cloudpack/path-string-parsing'; | ||
/** | ||
@@ -28,4 +29,6 @@ * `nonSemverTransform` has state defined when the function is called, so we need a wrapper function | ||
async get(packagePath, options = {}) { | ||
let definition = this._definitions[packagePath]; | ||
let transformedDefinition = this._transformedDefinitions[packagePath]; | ||
// Normalize the path to ensure consistency and avoid duplicates. | ||
const normalizedPath = slash(packagePath); | ||
let definition = this._definitions[normalizedPath]; | ||
let transformedDefinition = this._transformedDefinitions[normalizedPath]; | ||
const { refresh, disableTransforms, importerContext } = options; | ||
@@ -43,7 +46,7 @@ // If we already have the answer they need, return immediately. | ||
if (!definition || refresh) { | ||
definition = await readJson(path.join(packagePath, 'package.json')); | ||
definition = await readJson(path.join(normalizedPath, 'package.json')); | ||
if (!definition) { | ||
return undefined; | ||
} | ||
this._definitions[packagePath] = definition; | ||
this._definitions[normalizedPath] = definition; | ||
} | ||
@@ -58,6 +61,10 @@ if (disableTransforms) { | ||
transformedDefinition = | ||
(await transform({ definition: transformedDefinition, packagePath, packages: this, importerContext })) || | ||
transformedDefinition; | ||
(await transform({ | ||
definition: transformedDefinition, | ||
packagePath: normalizedPath, | ||
packages: this, | ||
importerContext, | ||
})) || transformedDefinition; | ||
} | ||
this._transformedDefinitions[packagePath] = transformedDefinition; | ||
this._transformedDefinitions[normalizedPath] = transformedDefinition; | ||
} | ||
@@ -99,6 +106,7 @@ return transformedDefinition; | ||
resetPackage(packagePath) { | ||
delete this._definitions[packagePath]; | ||
delete this._transformedDefinitions[packagePath]; | ||
const normalizedPath = slash(packagePath); | ||
delete this._definitions[normalizedPath]; | ||
delete this._transformedDefinitions[normalizedPath]; | ||
} | ||
} | ||
//# sourceMappingURL=PackageDefinitions.js.map |
{ | ||
"name": "@ms-cloudpack/package-utilities", | ||
"version": "7.4.8", | ||
"version": "7.4.9", | ||
"description": "Utilities for resolving/parsing packages and their imports.", | ||
@@ -17,7 +17,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@ms-cloudpack/common-types": "^0.5.4", | ||
"@ms-cloudpack/common-types": "^0.6.0", | ||
"@ms-cloudpack/json-utilities": "^0.1.4", | ||
"@ms-cloudpack/package-overrides": "^0.8.6", | ||
"@ms-cloudpack/package-overrides": "^0.8.7", | ||
"@ms-cloudpack/path-string-parsing": "^1.2.2", | ||
"@ms-cloudpack/path-utilities": "^2.7.11", | ||
"@ms-cloudpack/path-utilities": "^2.7.12", | ||
"@ms-cloudpack/task-reporter": "^0.14.1", | ||
@@ -24,0 +24,0 @@ "acorn": "^8.11.2", |
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
277419
2361
+ Added@ms-cloudpack/common-types@0.6.2(transitive)
- Removed@ms-cloudpack/common-types@0.5.4(transitive)