jsdoc-tsimport-plugin
Advanced tools
Comparing version 1.0.3 to 1.0.4
18
index.js
@@ -81,3 +81,4 @@ const path = require('path'); | ||
const s = source || (fs.readFileSync(filenameNor).toString()); | ||
const s = source || ((fs.existsSync(filenameNor)) ? | ||
fs.readFileSync(filenameNor).toString() : ''); | ||
s.replace(docCommentsRegex, (comment) => { | ||
@@ -176,7 +177,8 @@ if (!fileInfo.moduleId) { | ||
/** | ||
* Given a filename, if there is no extension, scan the files for the | ||
* Given a filename, if there is no extension, scan the files for the | ||
* most likely match. | ||
* | ||
* @param {string} filename | ||
* @returns {string} | ||
* @param {string} filename The filename with or without an | ||
* extension to resolve. | ||
* @returns {string} The path to the resolved file. | ||
*/ | ||
@@ -186,11 +188,13 @@ function inferExtension(filename) { | ||
const ext = path.extname(filenameNor); | ||
if (ext) return ext; | ||
if (ext && fs.existsSync(filename)) return ext; | ||
const files = fs.readdirSync(path.dirname(filenameNor)); | ||
const name = path.basename(filenameNor); | ||
return path.join(path.dirname(filenameNor), files.find((iFile) => { | ||
const foundFile = files.find((iFile) => { | ||
if (noExtension(iFile) == name) { | ||
return true; | ||
} | ||
})); | ||
}); | ||
if (foundFile === undefined) return filename; | ||
return path.join(path.dirname(filenameNor), foundFile); | ||
} | ||
@@ -197,0 +201,0 @@ |
{ | ||
"name": "jsdoc-tsimport-plugin", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A JSDoc plugin to support the typescript module import syntax.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ # jsdoc-tsimport-plugin |
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
204
22141