Socket
Socket
Sign inDemoInstall

documentation

Package Overview
Dependencies
270
Maintainers
5
Versions
119
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 14.0.1 to 14.0.2

screenshorts/show options.jpg

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [14.0.2](https://github.com/documentationjs/documentation/compare/v14.0.1...v14.0.2) (2023-05-19)
### Bug Fixes
* **exported:** respect `parse-extension` & `require-extension` ([#1484](https://github.com/documentationjs/documentation/issues/1484)) ([798fa10](https://github.com/documentationjs/documentation/commit/798fa10595d7523032ac187ae9c8aa943c15e8da)), closes [#1272](https://github.com/documentationjs/documentation/issues/1272) [#1258](https://github.com/documentationjs/documentation/issues/1258)
## [14.0.1](https://github.com/documentationjs/documentation/compare/v14.0.0...v14.0.1) (2022-12-14)

@@ -7,0 +14,0 @@

@@ -86,2 +86,13 @@ # Getting Started

<br/>
### **Show Options passing Value**
```js
* @param {{status : "active" | "inactive" | "inprocess"}}
```
<img src="../screenshorts/show options.jpg" />
<br/>
<br/>
## What `documentation` does, so you don't have to

@@ -88,0 +99,0 @@

2

package.json
{
"name": "documentation",
"description": "a documentation generator",
"version": "14.0.1",
"version": "14.0.2",
"author": "Tom MacWright",

@@ -6,0 +6,0 @@ "homepage": "https://documentation.js.org",

@@ -18,2 +18,4 @@ import babelTraverse from '@babel/traverse';

* documented as well as we can.
* @param {Object} config
* @param {Object} [config.extensions] extensions to try when resolving
* @param {Object} ast the babel-parsed syntax tree

@@ -26,2 +28,3 @@ * @param {Object} data the name of the file

export default function walkExported(
config /* { extensions?: string[] } */,
ast,

@@ -125,3 +128,4 @@ data /*: {

filename,
source.value
source.value,
config.extensions
);

@@ -187,12 +191,36 @@ bindingPath = tmp.ast;

function getCachedData(dataCache, filePath) {
let path = filePath;
if (!nodePath.extname(path)) {
path = require.resolve(path);
function resolveFile(filePath, extensions = []) {
try {
// First try resolving the file with the default extensions.
return require.resolve(filePath);
} catch {
// If that fails, try resolving the file with the extensions passed in.
}
// Then try all other extensions in order.
for (const extension of extensions) {
try {
return require.resolve(
`${filePath}${extension.startsWith('.') ? extension : `.${extension}`}`
);
} catch {
continue;
}
}
throw new Error(
`Could not resolve \`${filePath}\` with any of the extensions: ${[
...require.extensions,
...extensions
].join(', ')}`
);
}
function getCachedData(dataCache, filePath, extensions) {
const path = resolveFile(filePath, extensions);
let value = dataCache.get(path);
if (!value) {
const input = fs.readFileSync(path, 'utf-8');
const ast = parseToAst(input, filePath);
const ast = parseToAst(input, path);
value = {

@@ -216,6 +244,7 @@ data: {

referrer,
filename
filename,
extensions
) {
const depPath = nodePath.resolve(nodePath.dirname(referrer), filename);
const tmp = getCachedData(dataCache, depPath);
const tmp = getCachedData(dataCache, depPath, extensions);
const ast = tmp.ast;

@@ -281,3 +310,4 @@ let data = tmp.data;

depPath,
source.value
source.value,
extensions
);

@@ -284,0 +314,0 @@ rv = tmp.ast;

@@ -27,5 +27,9 @@ import _ from 'lodash';

const extensions = []
.concat(config.parseExtension, config.requireExtension)
.filter(Boolean);
return _.flatMap(
config.documentExported
? [walkExported]
? [walkExported.bind(null, { extensions })]
: [

@@ -32,0 +36,0 @@ walkComments.bind(null, 'leadingComments', true),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc