@pnpm/read-importer-manifest
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -138,4 +138,13 @@ "use strict"; | ||
exports.readExactImporterManifest = readExactImporterManifest; | ||
function readPackageYaml(filePath) { | ||
return read_yaml_file_1.default(filePath); | ||
async function readPackageYaml(filePath) { | ||
try { | ||
return await read_yaml_file_1.default(filePath); | ||
} | ||
catch (err) { | ||
if (err.name !== 'YAMLException') | ||
throw err; | ||
err.message += `\nin ${filePath}`; | ||
err['code'] = 'ERR_PNPM_YAML_PARSE'; | ||
throw err; | ||
} | ||
} | ||
@@ -142,0 +151,0 @@ function createManifestWriter(opts) { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const JSON5 = require("json5"); | ||
const parseJson = require("parse-json"); | ||
const stripBom = require("strip-bom"); | ||
@@ -11,6 +12,13 @@ const util_1 = require("util"); | ||
const text = await readFileWithoutBom(filePath); | ||
return { | ||
data: JSON5.parse(text), | ||
text, | ||
}; | ||
try { | ||
return { | ||
data: JSON5.parse(text), | ||
text, | ||
}; | ||
} | ||
catch (err) { | ||
err.message += ` in ${filePath}`; | ||
err['code'] = 'ERR_PNPM_JSON5_PARSE'; | ||
throw err; | ||
} | ||
} | ||
@@ -20,6 +28,12 @@ exports.readJson5File = readJson5File; | ||
const text = await readFileWithoutBom(filePath); | ||
return { | ||
data: JSON.parse(text), | ||
text, | ||
}; | ||
try { | ||
return { | ||
data: parseJson(text, filePath), | ||
text, | ||
}; | ||
} | ||
catch (err) { | ||
err['code'] = 'ERR_PNPM_JSON_PARSE'; | ||
throw err; | ||
} | ||
} | ||
@@ -26,0 +40,0 @@ exports.readJsonFile = readJsonFile; |
{ | ||
"name": "@pnpm/read-importer-manifest", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Read an importer manifest (called package.json in most cases)", | ||
@@ -17,4 +17,3 @@ "main": "lib/index.js", | ||
"prepublishOnly": "tsc", | ||
"tsc": "tsc", | ||
"md": "mos" | ||
"tsc": "tsc" | ||
}, | ||
@@ -44,2 +43,3 @@ "repository": "https://github.com/pnpm/pnpm/blob/master/packages/read-importer-manifest", | ||
"json5": "2.1.0", | ||
"parse-json": "4.0.0", | ||
"read-yaml-file": "1.1.0", | ||
@@ -56,5 +56,4 @@ "strip-bom": "4.0.0" | ||
"@types/node": "^10.3.2", | ||
"@types/parse-json": "4.0.0", | ||
"@types/tape": "^4.2.31", | ||
"mos": "^2.0.0-alpha.3", | ||
"mos-plugin-readme": "^1.0.4", | ||
"tape": "^4.8.0", | ||
@@ -65,11 +64,3 @@ "tempy": "0.3.0", | ||
"typescript": "3.4.5" | ||
}, | ||
"mos": { | ||
"plugins": [ | ||
"readme" | ||
], | ||
"installation": { | ||
"useShortAlias": true | ||
} | ||
} | ||
} |
@@ -25,2 +25,2 @@ # @pnpm/read-importer-manifest | ||
[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io/) | ||
MIT © [Zoltan Kochan](https://www.kochan.io/) |
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
16207
14
224
9
+ Addedparse-json@4.0.0
+ Addederror-ex@1.3.2(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedparse-json@4.0.0(transitive)