Socket
Socket
Sign inDemoInstall

dgeni-packages

Package Overview
Dependencies
226
Maintainers
4
Versions
147
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.29.1 to 0.29.2

14

base/processors/checkAnchorLinks.js

@@ -9,3 +9,3 @@ const path = require('canonical-path');

*/
module.exports = function checkAnchorLinksProcessor(log, resolveUrl, extractLinks) {
module.exports = function checkAnchorLinksProcessor(log, resolveUrl, extractLinks, createDocMessage) {
return {

@@ -44,2 +44,3 @@ ignoredLinks: [/^http(?:s)?:\/\//, /^mailto:/, /^chrome:/],

linkInfo.outputPath = doc.outputPath;
linkInfo.doc = doc;
allDocs.push(linkInfo);

@@ -63,2 +64,3 @@

let unmatchedLinkCount = 0;
const messages = [];

@@ -84,3 +86,6 @@ // Check that all anchor links in each doc point to valid

unmatchedLinkCount += unmatchedLinks.length;
log.warn('Dangling Links Found in "' + linkInfo.outputPath + '":' + unmatchedLinks.map(link => '\n - ' + link));
messages.push(
createDocMessage(' ', linkInfo.doc) +
'\n' +
unmatchedLinks.map(link => ' - ' + link).join('\n'));
}

@@ -90,3 +95,6 @@ });

if ( unmatchedLinkCount ) {
const errorMessage = unmatchedLinkCount + ' unmatched links';
const plural = unmatchedLinkCount > 0 ? 's' : '';
const errorMessage =
`Dangling links: ${unmatchedLinkCount} unmatched link${plural}. The following docs have links to URLs that do not exist\n` +
messages.join('\n');
if (this.errorOnUnmatchedLinks) {

@@ -93,0 +101,0 @@ throw new Error(errorMessage);

@@ -15,2 +15,15 @@ const path = require('canonical-path');

function createDoc(docType, renderedContent, path, outputPath, relativePath, startingLine, endingLine) {
return {
path,
outputPath,
docType,
fileInfo: {
relativePath
},
renderedContent,
startingLine,
endingLine
};
}

@@ -27,4 +40,4 @@ beforeEach(() => {

it("should warn when there is a dangling link", () => {
processor.$process([{ renderedContent: '<a href="foo"></a>', outputPath: 'doc/path.html', path: 'doc/path' }]);
checkWarning('foo', 'doc/path.html');
processor.$process([createDoc('content', '<a href="foo"></a>', 'doc/path', 'doc/path.html', 'doc/path.md', 0, 1)]);
checkWarning('foo', 'doc/path.md');
});

@@ -36,3 +49,3 @@

processor.$process([{ renderedContent: '<a href="foo"></a>', outputPath: 'doc/path.html', path: 'doc/path' }]);
}).toThrowError('1 unmatched links');
}).toThrowError(/1 unmatched link/);
});

@@ -113,5 +126,5 @@

processor.$process([
{ renderedContent: '<a href="#foo">to foo</a>', outputPath: 'x.html', path: 'x' }
createDoc('api', '<a href="#foo">to foo</a>', 'a/b/c/x', 'dist/a/b/c/x.html', 'src/a/b/c/x.js', 45, 48),
]);
checkWarning('#foo', 'x.html');
checkWarning('#foo', 'src/a/b/c/x.js');
});

@@ -121,6 +134,6 @@

processor.$process([
{ renderedContent: '<a name="foo">foo</a>', outputPath: 'x.html', path: 'x' },
{ renderedContent: '<a href="x#bar">to bar</a>', outputPath: 'y.html', path: 'y' }
createDoc('content', '<a name="foo">foo</a>', 'x', 'x.html', 'x.md'),
createDoc('content', '<a href="x#bar">to bar</a>', 'y', 'y.html', 'y.md'),
]);
checkWarning('x#bar', 'y.html');
checkWarning('x#bar', 'y.md');
});

@@ -127,0 +140,0 @@

@@ -16,6 +16,6 @@ module.exports = function createDocMessage() {

message += ' - from file "' + filePath + '"';
if ( doc.startingLine ) {
if ( typeof doc.startingLine === 'number' ) {
message += ' - starting at line ' + doc.startingLine;
}
if ( doc.endingLine ) {
if ( typeof doc.endingLine === 'number' ) {
message += ', ending at line ' + doc.endingLine;

@@ -22,0 +22,0 @@ }

@@ -22,2 +22,5 @@ const mockPackage = require('../mocks/mockPackage');

message = createDocMessage('some message', { name: 'doc-one', path: 'some/doc1', fileInfo: { relativePath: 'some/file.js'} , startingLine: 0, endingLine: 0 });
expect(message).toEqual('some message - doc "doc-one" - from file "some/file.js" - starting at line 0, ending at line 0');
message = createDocMessage('some message', { path: 'some/doc1', fileInfo: { relativePath: 'some/file.js'} });

@@ -24,0 +27,0 @@ expect(message).toEqual('some message - doc "some/doc1" - from file "some/file.js"');

# Changelog
<a name=""></a>
# 0.29.2 2 September 2021
## Bug Fixes
- **base**:
- improve layout of checkAnchorLinks messages
[4e5c3e4](https://github.com/angular/angular.js/commit/4e5c3e4)
- display doc locations even if they are 0
[a390fbf](https://github.com/angular/angular.js/commit/a390fbf)
- **ngdoc**: link filter - correctly handle missing title
[affb49e](https://github.com/angular/angular.js/commit/affb49e)
## New Features
- **jsdoc**: add support for parsing ES2017 syntax
[974173d](https://github.com/angular/angular.js/commit/974173d)
# 0.29.1 27 April 2021

@@ -74,3 +89,3 @@

### **nunjucks** due to:
- **[16ceb9](https://github.com/angular/angular.js/commit/16ceb9c9bc9aac168f82db977a9e380fb20b815a)**: upgrade `marked` to avoid vulnerability
- **[16ceb9](https://github.com/angular/dgeni-packages/commit/16ceb9c9bc9aac168f82db977a9e380fb20b815a)**: upgrade `marked` to avoid vulnerability

@@ -77,0 +92,0 @@ There are a few relevant breaking changes with this latest version of `marked`.

@@ -18,3 +18,3 @@ module.exports = function jsParserConfig() {

// You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), or 2021 (same as 12) to use the year-based naming.
ecmaVersion: 6,
ecmaVersion: 8,

@@ -21,0 +21,0 @@ // specify which type of script you're parsing ("script" or "module")

@@ -19,4 +19,4 @@ var Dgeni = require('dgeni');

expect(jsParserConfig.tokens).toBe(true);
expect(jsParserConfig.ecmaVersion).toBe(6);
expect(jsParserConfig.ecmaVersion).toBe(8);
});
});

@@ -5,5 +5,5 @@ module.exports = function() {

process(url, title, doc) {
return `{@link ${url} ${title} }`;
return `{@link ${url} ${title || ''} }`;
}
};
};
};

@@ -18,2 +18,6 @@ const filterFactory = require('./link');

});
it("should omit title when it is undefined", () => {
expect(filter.process('URL', undefined)).toEqual('{@link URL }');
});
});
{
"name": "dgeni-packages",
"version": "0.29.1",
"version": "0.29.2",
"description": "A collection of dgeni packages for generating documentation from source code",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc