@pnpm/modules-yaml
Advanced tools
Comparing version 7.0.0 to 8.0.0
# @pnpm/modules-yaml | ||
## 8.0.0 | ||
### Major Changes | ||
- 71a8c8ce3: Breaking changes to the `node_modules/.modules.yaml` file: | ||
- `hoistedAliases` replaced with `hoistedDependencies`. | ||
- `shamefullyHoist` replaced with `publicHoistPattern`. | ||
### Patch Changes | ||
- Updated dependencies [71a8c8ce3] | ||
- @pnpm/types@6.1.0 | ||
## 7.0.0 | ||
@@ -4,0 +17,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { DependenciesField, Registries } from '@pnpm/types'; | ||
import { DependenciesField, HoistedDependencies, Registries } from '@pnpm/types'; | ||
export declare type IncludedDependencies = { | ||
@@ -6,5 +6,6 @@ [dependenciesField in DependenciesField]: boolean; | ||
export interface Modules { | ||
hoistedAliases: { | ||
hoistedAliases?: { | ||
[depPath: string]: string[]; | ||
}; | ||
hoistedDependencies: HoistedDependencies; | ||
hoistPattern?: string[]; | ||
@@ -16,3 +17,4 @@ included: IncludedDependencies; | ||
registries?: Registries; | ||
shamefullyHoist: boolean; | ||
shamefullyHoist?: boolean; | ||
publicHoistPattern?: string[]; | ||
skipped: string[]; | ||
@@ -19,0 +21,0 @@ storeDir: string; |
@@ -13,11 +13,5 @@ "use strict"; | ||
const modulesYamlPath = path.join(modulesDir, MODULES_FILENAME); | ||
let modules; | ||
try { | ||
const modules = await read_yaml_file_1.default(modulesYamlPath); | ||
if (!modules.virtualStoreDir) { | ||
modules.virtualStoreDir = path.join(modulesDir, '.pnpm'); | ||
} | ||
else if (!path.isAbsolute(modules.virtualStoreDir)) { | ||
modules.virtualStoreDir = path.join(modulesDir, modules.virtualStoreDir); | ||
} | ||
return modules; | ||
modules = await read_yaml_file_1.default(modulesYamlPath); | ||
} | ||
@@ -30,5 +24,46 @@ catch (err) { | ||
} | ||
if (!modules.virtualStoreDir) { | ||
modules.virtualStoreDir = path.join(modulesDir, '.pnpm'); | ||
} | ||
else if (!path.isAbsolute(modules.virtualStoreDir)) { | ||
modules.virtualStoreDir = path.join(modulesDir, modules.virtualStoreDir); | ||
} | ||
switch (modules.shamefullyHoist) { | ||
case true: | ||
if (!modules.publicHoistPattern) { | ||
modules.publicHoistPattern = ['*']; | ||
} | ||
if (modules.hoistedAliases && !modules.hoistedDependencies) { | ||
modules.hoistedDependencies = {}; | ||
for (const depPath of Object.keys(modules.hoistedAliases)) { | ||
modules.hoistedDependencies[depPath] = {}; | ||
for (const alias of modules.hoistedAliases[depPath]) { | ||
modules.hoistedDependencies[depPath][alias] = 'public'; | ||
} | ||
} | ||
} | ||
break; | ||
case false: | ||
if (!modules.publicHoistPattern) { | ||
modules.publicHoistPattern = []; | ||
} | ||
if (modules.hoistedAliases && !modules.hoistedDependencies) { | ||
modules.hoistedDependencies = {}; | ||
for (const depPath of Object.keys(modules.hoistedAliases)) { | ||
modules.hoistedDependencies[depPath] = {}; | ||
for (const alias of modules.hoistedAliases[depPath]) { | ||
modules.hoistedDependencies[depPath][alias] = 'private'; | ||
} | ||
} | ||
} | ||
break; | ||
} | ||
return modules; | ||
} | ||
exports.read = read; | ||
const YAML_OPTS = { sortKeys: true }; | ||
const YAML_OPTS = { | ||
noCompatMode: true, | ||
noRefs: true, | ||
sortKeys: true, | ||
}; | ||
function write(modulesDir, modules) { | ||
@@ -42,2 +77,7 @@ const modulesYamlPath = path.join(modulesDir, MODULES_FILENAME); | ||
delete saveModules.hoistPattern; | ||
} | ||
if (!saveModules.publicHoistPattern) { | ||
delete saveModules.publicHoistPattern; | ||
} | ||
if (!saveModules.hoistedAliases || !saveModules.hoistPattern && !saveModules.publicHoistPattern) { | ||
delete saveModules.hoistedAliases; | ||
@@ -44,0 +84,0 @@ } |
{ | ||
"name": "@pnpm/modules-yaml", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Reads/writes `node_modules/.modules.yaml`", | ||
@@ -34,3 +34,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@pnpm/types": "6.0.0", | ||
"@pnpm/types": "6.1.0", | ||
"is-windows": "1.0.2", | ||
@@ -37,0 +37,0 @@ "read-yaml-file": "2.0.0", |
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
8566
116
16082
+ Added@pnpm/types@6.1.0(transitive)
- Removed@pnpm/types@6.0.0(transitive)
Updated@pnpm/types@6.1.0