@pnpm/modules-yaml
Advanced tools
Comparing version 1.0.0 to 2.0.0-0
@@ -0,5 +1,15 @@ | ||
import { DependenciesField } from '@pnpm/types'; | ||
export declare type IncludedDependencies = { | ||
[dependenciesField in DependenciesField]: boolean; | ||
}; | ||
export interface Modules { | ||
hoistedAliases: { | ||
[depPath: string]: string[]; | ||
importers: { | ||
[id: string]: { | ||
hoistedAliases: { | ||
[depPath: string]: string[]; | ||
}; | ||
shamefullyFlatten: boolean; | ||
}; | ||
}; | ||
included: IncludedDependencies; | ||
independentLeaves: boolean; | ||
@@ -9,7 +19,6 @@ layoutVersion: number; | ||
pendingBuilds: string[]; | ||
shamefullyFlatten: boolean; | ||
skipped: string[]; | ||
store: string; | ||
} | ||
export declare function read(modulesPath: string): Promise<Modules | null>; | ||
export declare function write(modulesPath: string, modules: Modules): Promise<void>; | ||
export declare function read(virtualStoreDir: string): Promise<Modules | null>; | ||
export declare function write(virtualStoreDir: string, modules: Modules): Promise<void>; |
@@ -16,6 +16,6 @@ "use strict"; | ||
// thinks that it is an extraneous package. | ||
const modulesFileName = '.modules.yaml'; | ||
function read(modulesPath) { | ||
const MODULES_FILENAME = '.modules.yaml'; | ||
function read(virtualStoreDir) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const modulesYamlPath = path.join(modulesPath, modulesFileName); | ||
const modulesYamlPath = path.join(virtualStoreDir, MODULES_FILENAME); | ||
try { | ||
@@ -29,2 +29,12 @@ const m = yield loadYamlFile(modulesYamlPath); | ||
} | ||
if (!m.importers) { | ||
m.importers = { | ||
'.': { | ||
hoistedAliases: m['hoistedAliases'], | ||
shamefullyFlatten: m['shamefullyFlatten'], | ||
}, | ||
}; | ||
delete m['hoistedAliases']; | ||
delete m['shamefullyFlatten']; | ||
} | ||
// tslint:enable:no-string-literal | ||
@@ -42,9 +52,18 @@ return m; | ||
exports.read = read; | ||
function write(modulesPath, modules) { | ||
const modulesYamlPath = path.join(modulesPath, modulesFileName); | ||
if (modules.skipped) | ||
modules.skipped.sort(); | ||
return writeYamlFile(modulesYamlPath, modules, { sortKeys: true }); | ||
const YAML_OPTS = { sortKeys: true }; | ||
function write(virtualStoreDir, modules) { | ||
const modulesYamlPath = path.join(virtualStoreDir, MODULES_FILENAME); | ||
if (modules['skipped']) | ||
modules['skipped'].sort(); // tslint:disable-line:no-string-literal | ||
return writeYamlFile(modulesYamlPath, normalizeModules(modules), YAML_OPTS); | ||
} | ||
exports.write = write; | ||
function normalizeModules(m) { | ||
const normalized = Object.assign({}, m); | ||
if (Object.keys(m.importers).length === 1 && m.importers['.']) { | ||
Object.assign(normalized, m.importers['.']); | ||
delete normalized.importers; | ||
} | ||
return normalized; | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@pnpm/modules-yaml", | ||
"version": "1.0.0", | ||
"version": "2.0.0-0", | ||
"description": "Reads/writes `node_modules/.modules.yaml`", | ||
@@ -11,3 +11,3 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=6" | ||
}, | ||
@@ -22,6 +22,3 @@ "scripts": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/pnpm/modules-yaml.git" | ||
}, | ||
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/modules-yaml", | ||
"keywords": [ | ||
@@ -34,6 +31,7 @@ "pnpm", | ||
"bugs": { | ||
"url": "https://github.com/pnpm/modules-yaml/issues" | ||
"url": "https://github.com/pnpm/pnpm/issues" | ||
}, | ||
"homepage": "https://github.com/pnpm/modules-yaml#readme", | ||
"homepage": "https://github.com/pnpm/pnpm/blob/master/packages/modules-yaml#readme", | ||
"dependencies": { | ||
"@pnpm/types": "1.8.0", | ||
"load-yaml-file": "^0.1.0", | ||
@@ -44,2 +42,3 @@ "write-yaml-file": "^1.0.1" | ||
"@types/tape": "^4.2.31", | ||
"@types/tempy": "^0.1.0", | ||
"mos": "^2.0.0-alpha.3", | ||
@@ -51,5 +50,7 @@ "mos-plugin-readme": "^1.0.4", | ||
"tempy": "^0.2.1", | ||
"ts-node": "^5.0.0", | ||
"ts-node": "^7.0.0", | ||
"tslint": "^5.8.0", | ||
"typescript": "^2.6.1" | ||
"tslint-config-standard": "8.0.1", | ||
"tslint-eslint-rules": "5.4.0", | ||
"typescript": "^3.0.0" | ||
}, | ||
@@ -56,0 +57,0 @@ "mos": { |
@@ -5,4 +5,4 @@ # @pnpm/modules-yaml | ||
<!--@shields('npm', 'travis')--> | ||
[![npm version](https://img.shields.io/npm/v/@pnpm/modules-yaml.svg)](https://www.npmjs.com/package/@pnpm/modules-yaml) [![Build Status](https://img.shields.io/travis/pnpm/modules-yaml/master.svg)](https://travis-ci.org/pnpm/modules-yaml) | ||
<!--@shields('npm')--> | ||
[![npm version](https://img.shields.io/npm/v/@pnpm/modules-yaml.svg)](https://www.npmjs.com/package/@pnpm/modules-yaml) | ||
<!--/@--> | ||
@@ -9,0 +9,0 @@ |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
8603
17813
88
3
13
2
1
+ Added@pnpm/types@1.8.0
+ Added@pnpm/types@1.8.0(transitive)