dts-critic
Advanced tools
Comparing version 1.0.7 to 1.0.8
21
index.js
@@ -21,8 +21,5 @@ const yargs = require("yargs"); | ||
const names = findNames(dtsPath, sourcePath, header) | ||
const src = sourcePath ? | ||
fs.readFileSync(require.resolve(sourcePath), "utf-8") : | ||
download("https://unpkg.com/" + mangleScoped(names.src)); | ||
checkNames(names, header); | ||
if (header && !header.nonNpm) { | ||
checkSource(names.dts, dts, src); | ||
checkSource(names.dts, dts, readSource(sourcePath, names.src, header)); | ||
} | ||
@@ -63,2 +60,18 @@ } | ||
/** | ||
* @param {string | undefined} sourcePath | ||
* @param {string} name | ||
* @param {headerParser.Header | undefined} header | ||
*/ | ||
function readSource(sourcePath, name, header) { | ||
if (sourcePath) { | ||
return fs.readFileSync(require.resolve(sourcePath), "utf-8"); | ||
} | ||
let fullName = mangleScoped(name); | ||
if (header) { | ||
fullName += `@${header.libraryMajorVersion}.${header.libraryMinorVersion}`; | ||
} | ||
return download("https://unpkg.com/" + fullName); | ||
} | ||
/** | ||
* Find package names of dts and source. Also finds the homepage from the DT header, if present. | ||
@@ -65,0 +78,0 @@ * @param {string} dtsPath |
{ | ||
"name": "dts-critic", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"author": "Nathan Shively-Sanders", | ||
@@ -5,0 +5,0 @@ "description": "Checks a new .d.ts against the Javascript source and tells you what problems it has", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20889
476
0