pnpm-shrinkwrap
Advanced tools
Comparing version 4.0.1 to 5.0.0
@@ -1,2 +0,3 @@ | ||
declare const _default: any; | ||
import { Logger } from '@pnpm/logger'; | ||
declare const _default: Logger<{}>; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const pnpm_logger_1 = require("pnpm-logger"); | ||
exports.default = pnpm_logger_1.default('shrinkwrap'); | ||
const logger_1 = require("@pnpm/logger"); | ||
exports.default = logger_1.default('shrinkwrap'); | ||
//# sourceMappingURL=logger.js.map |
@@ -1,2 +0,2 @@ | ||
import { Shrinkwrap, Package } from './types'; | ||
import { Package, Shrinkwrap } from './types'; | ||
export default function prune(shr: Shrinkwrap, pkg: Package): Shrinkwrap; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const logger_1 = require("@pnpm/logger"); | ||
const dependency_path_1 = require("dependency-path"); | ||
const R = require("ramda"); | ||
const pnpm_logger_1 = require("pnpm-logger"); | ||
const dependency_path_1 = require("dependency-path"); | ||
const constants_1 = require("./constants"); | ||
@@ -18,3 +18,3 @@ function prune(shr, pkg) { | ||
const nonOptional = new Set(); | ||
R.keys(shr.specifiers).forEach(depName => { | ||
R.keys(shr.specifiers).forEach((depName) => { | ||
if (allDeps.indexOf(depName) === -1) | ||
@@ -34,3 +34,3 @@ return; | ||
if (shrOptionalDependencies) { | ||
let optionalPkgIds = R.keys(shrOptionalDependencies) | ||
const optionalPkgIds = R.keys(shrOptionalDependencies) | ||
.map((pkgName) => dependency_path_1.refToRelative(shrOptionalDependencies[pkgName], pkgName)); | ||
@@ -40,16 +40,16 @@ copyDependencySubTree(packages, optionalPkgIds, shr, [], { registry: shr.registry, nonOptional, optional: true }); | ||
if (shrDevDependencies) { | ||
let devPkgIds = R.keys(shrDevDependencies) | ||
const devPkgIds = R.keys(shrDevDependencies) | ||
.map((pkgName) => dependency_path_1.refToRelative(shrDevDependencies[pkgName], pkgName)); | ||
copyDependencySubTree(packages, devPkgIds, shr, [], { registry: shr.registry, nonOptional, dev: true }); | ||
} | ||
let pkgIds = R.keys(shrDependencies) | ||
const pkgIds = R.keys(shrDependencies) | ||
.map((pkgName) => dependency_path_1.refToRelative(shrDependencies[pkgName], pkgName)); | ||
copyDependencySubTree(packages, pkgIds, shr, [], { | ||
nonOptional, | ||
registry: shr.registry, | ||
nonOptional, | ||
}); | ||
const result = { | ||
registry: shr.registry, | ||
shrinkwrapVersion: constants_1.SHRINKWRAP_VERSION, | ||
specifiers, | ||
registry: shr.registry, | ||
}; | ||
@@ -75,3 +75,3 @@ if (typeof shr.shrinkwrapMinorVersion === 'number') { | ||
function copyDependencySubTree(resolvedPackages, pkgIds, shr, keypath, opts) { | ||
for (let pkgId of pkgIds) { | ||
for (const pkgId of pkgIds) { | ||
if (keypath.indexOf(pkgId) !== -1) | ||
@@ -84,3 +84,3 @@ continue; | ||
continue; | ||
pnpm_logger_1.default.warn(`Cannot find resolution of ${pkgId} in shrinkwrap file`); | ||
logger_1.default.warn(`Cannot find resolution of ${pkgId} in shrinkwrap file`); | ||
continue; | ||
@@ -87,0 +87,0 @@ } |
@@ -11,8 +11,8 @@ import { Shrinkwrap } from './types'; | ||
export declare function create(registry: string): { | ||
shrinkwrapVersion: number; | ||
shrinkwrapMinorVersion: number; | ||
specifiers: {}; | ||
dependencies: {}; | ||
packages: {}; | ||
registry: string; | ||
shrinkwrapMinorVersion: number; | ||
shrinkwrapVersion: number; | ||
specifiers: {}; | ||
}; |
@@ -11,19 +11,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const loadYamlFile = require("load-yaml-file"); | ||
const path = require("path"); | ||
const logger_1 = require("./logger"); | ||
const constants_1 = require("./constants"); | ||
const loadYamlFile = require("load-yaml-file"); | ||
const constants_2 = require("./constants"); | ||
class PnpmError extends Error { | ||
constructor(code, message) { | ||
super(message); | ||
this.code = code; | ||
} | ||
} | ||
class ShrinkwrapBreakingChangeError extends PnpmError { | ||
constructor(filename) { | ||
super('SHRINKWRAP_BREAKING_CHANGE', `Shrinkwrap file ${filename} not compatible with current pnpm`); | ||
this.filename = filename; | ||
} | ||
} | ||
const errors_1 = require("./errors"); | ||
const logger_1 = require("./logger"); | ||
exports.readPrivate = readCurrent; | ||
@@ -58,2 +47,3 @@ function readCurrent(pkgPath, opts) { | ||
// for backward compatibility | ||
// tslint:disable:no-string-literal | ||
if (shrinkwrap && shrinkwrap['version'] && !shrinkwrap.shrinkwrapVersion) { | ||
@@ -63,2 +53,3 @@ shrinkwrap.shrinkwrapVersion = shrinkwrap['version']; | ||
} | ||
// tslint:enable:no-string-literal | ||
if (shrinkwrap && Math.floor(shrinkwrap.shrinkwrapVersion) === Math.floor(constants_2.SHRINKWRAP_VERSION)) { | ||
@@ -75,3 +66,3 @@ if (shrinkwrap.shrinkwrapVersion > constants_2.SHRINKWRAP_VERSION) { | ||
} | ||
throw new ShrinkwrapBreakingChangeError(shrinkwrapPath); | ||
throw new errors_1.ShrinkwrapBreakingChangeError(shrinkwrapPath); | ||
}); | ||
@@ -81,8 +72,8 @@ } | ||
return { | ||
shrinkwrapVersion: constants_2.SHRINKWRAP_VERSION, | ||
shrinkwrapMinorVersion: constants_2.SHRINKWRAP_MINOR_VERSION, | ||
specifiers: {}, | ||
dependencies: {}, | ||
packages: {}, | ||
registry, | ||
shrinkwrapMinorVersion: constants_2.SHRINKWRAP_MINOR_VERSION, | ||
shrinkwrapVersion: constants_2.SHRINKWRAP_VERSION, | ||
specifiers: {}, | ||
}; | ||
@@ -89,0 +80,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare type Shrinkwrap = { | ||
export interface Shrinkwrap { | ||
shrinkwrapVersion: number; | ||
@@ -10,11 +10,11 @@ shrinkwrapMinorVersion?: number; | ||
registry: string; | ||
}; | ||
} | ||
export declare type ResolvedPackages = PackageSnapshots; | ||
export declare type PackageSnapshots = { | ||
export interface PackageSnapshots { | ||
[packagePath: string]: PackageSnapshot; | ||
}; | ||
} | ||
/** | ||
* tarball hosted remotely | ||
*/ | ||
export declare type TarballResolution = { | ||
export interface TarballResolution { | ||
type?: undefined; | ||
@@ -24,18 +24,18 @@ tarball: string; | ||
registry?: string; | ||
}; | ||
} | ||
/** | ||
* directory on a file system | ||
*/ | ||
export declare type DirectoryResolution = { | ||
export interface DirectoryResolution { | ||
type: 'directory'; | ||
directory: string; | ||
}; | ||
} | ||
/** | ||
* Git repository | ||
*/ | ||
export declare type GitRepositoryResolution = { | ||
export interface GitRepositoryResolution { | ||
type: 'git'; | ||
repo: string; | ||
commit: string; | ||
}; | ||
} | ||
export declare type Resolution = TarballResolution | GitRepositoryResolution | DirectoryResolution; | ||
@@ -46,3 +46,3 @@ export declare type ShrinkwrapResolution = Resolution | { | ||
export declare type DependencyShrinkwrap = PackageSnapshot; | ||
export declare type PackageSnapshot = { | ||
export interface PackageSnapshot { | ||
id?: string; | ||
@@ -68,10 +68,10 @@ dev?: true | false; | ||
deprecated?: string; | ||
}; | ||
export declare type Dependencies = { | ||
} | ||
export interface Dependencies { | ||
[name: string]: string; | ||
}; | ||
} | ||
export declare type PackageBin = string | { | ||
[name: string]: string; | ||
}; | ||
export declare type Package = { | ||
export interface Package { | ||
name: string; | ||
@@ -93,4 +93,4 @@ version: string; | ||
}; | ||
config?: Object; | ||
}; | ||
config?: object; | ||
} | ||
/*** @example | ||
@@ -101,4 +101,4 @@ * { | ||
*/ | ||
export declare type ResolvedDependencies = { | ||
export interface ResolvedDependencies { | ||
[pkgName: string]: string; | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const yaml = require("js-yaml"); | ||
const mkdirp = require("mkdirp-promise"); | ||
const path = require("path"); | ||
const rimraf = require("rimraf-then"); | ||
const thenify = require("thenify"); | ||
const writeFileAtomicCB = require("write-file-atomic"); | ||
const thenify = require("thenify"); | ||
const rimraf = require("rimraf-then"); | ||
const yaml = require("js-yaml"); | ||
const constants_1 = require("./constants"); | ||
const mkdirp = require("mkdirp-promise"); | ||
const logger_1 = require("./logger"); | ||
const writeFileAtomic = thenify(writeFileAtomicCB); | ||
const SHRINKWRAP_YAML_FORMAT = { | ||
sortKeys: true, | ||
lineWidth: 1000, | ||
noCompatMode: true, | ||
sortKeys: true, | ||
}; | ||
@@ -17,0 +17,0 @@ function write(pkgPath, wantedShrinkwrap, currentShrinkwrap) { |
{ | ||
"name": "pnpm-shrinkwrap", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "pnpm's shrinkwrap", | ||
@@ -11,3 +11,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"test": "ts-node test", | ||
"test": "tslint -c tslint.json -p . && preview && ts-node test", | ||
"tsc": "rimraf lib && tsc", | ||
@@ -27,3 +27,3 @@ "prepublishOnly": "npm run tsc" | ||
"name": "Zoltan Kochan", | ||
"email": "zoltan.kochan@gmail.com", | ||
"email": "z@kochan.io", | ||
"url": "https://www.kochan.io" | ||
@@ -37,10 +37,12 @@ }, | ||
"peerDependencies": { | ||
"pnpm-logger": "^0.6.2" | ||
"@pnpm/logger": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@pnpm/logger": "^1.0.0", | ||
"@types/tape": "^4.2.30", | ||
"pnpm-logger": "^0.6.2", | ||
"package-preview": "^1.0.0", | ||
"rimraf": "^2.6.1", | ||
"tape": "^4.6.3", | ||
"ts-node": "^3.0.4", | ||
"tslint": "^5.8.0", | ||
"typescript": "^2.3.4" | ||
@@ -47,0 +49,0 @@ }, |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31114
33
431
8