Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

linkinator

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linkinator - npm Package Compare versions

Comparing version 6.0.4 to 6.0.5

21

build/src/cli.js

@@ -145,5 +145,2 @@ #!/usr/bin/env node

}
default: {
throw new Error('Unexpected link state.');
}
}

@@ -215,9 +212,7 @@ if (format === Format.CSV) {

// eslint-disable-next-line unicorn/no-array-reduce
const parents = result.links.reduce((acc, curr) => {
const parent = curr.parent || '';
if (!acc[parent]) {
acc[parent] = [];
}
acc[parent].push(curr);
return acc;
const parents = result.links.reduce((accumulator, current) => {
const parent = current.parent || '';
accumulator[parent] ||= [];
accumulator[parent].push(current);
return accumulator;
}, {});

@@ -264,5 +259,2 @@ for (const parent of Object.keys(parents)) {

}
default: {
throw new Error('Unexpected link state.');
}
}

@@ -322,7 +314,4 @@ }

}
default: {
throw new Error('Unexpected link state.');
}
}
}
await main();

@@ -37,3 +37,3 @@ import { EventEmitter } from 'node:events';

}
options.linksToSkip = options.linksToSkip || [];
options.linksToSkip ||= [];
let server;

@@ -40,0 +40,0 @@ const hasHttpPaths = options.path.find((x) => x.startsWith('http'));

import { WritableStream } from 'htmlparser2/lib/WritableStream';
import { parseSrcset } from 'srcset';
const linksAttr = {
const linksAttribute = {
background: ['body'],

@@ -30,8 +30,7 @@ cite: ['blockquote', 'del', 'ins', 'q'],

// Create lookup table for tag name to attribute that contains URL:
const tagAttr = {};
for (const attr of Object.keys(linksAttr)) {
for (const tag of linksAttr[attr]) {
if (!tagAttr[tag])
tagAttr[tag] = [];
tagAttr[tag].push(attr);
const tagAttribute = {};
for (const attribute of Object.keys(linksAttribute)) {
for (const tag of linksAttribute[attribute]) {
tagAttribute[tag] ||= [];
tagAttribute[tag].push(attribute);
}

@@ -51,2 +50,3 @@ }

// ignore href properties for link tags where rel is likely to fail
// eslint-disable-next-line unicorn/prevent-abbreviations
const relValuesToIgnore = ['dns-prefetch', 'preconnect'];

@@ -67,7 +67,7 @@ if (tag === 'link' && relValuesToIgnore.includes(attributes.rel)) {

}
if (tagAttr[tag]) {
for (const attr of tagAttr[tag]) {
const linkString = attributes[attr];
if (tagAttribute[tag]) {
for (const attribute of tagAttribute[tag]) {
const linkString = attributes[attribute];
if (linkString) {
for (const link of parseAttr(attr, linkString)) {
for (const link of parseAttribute(attribute, linkString)) {
links.push(parseLink(link, realBaseUrl));

@@ -102,3 +102,3 @@ }

}
function parseAttr(name, value) {
function parseAttribute(name, value) {
switch (name) {

@@ -105,0 +105,0 @@ case 'srcset': {

@@ -39,5 +39,3 @@ import { promises as fs } from 'node:fs';

}
if (options.serverRoot) {
options.serverRoot = path.normalize(options.serverRoot);
}
options.serverRoot &&= path.normalize(options.serverRoot);
// Expand globs into paths

@@ -44,0 +42,0 @@ if (!isUrlType) {

@@ -16,5 +16,5 @@ /// <reference types="node" resolution-mode="require"/>

on(event: 'done', listener: () => void): this;
add(fn: AsyncFunction, options?: QueueItemOptions): void;
add(function_: AsyncFunction, options?: QueueItemOptions): void;
onIdle(): Promise<void>;
private tick;
}

@@ -21,7 +21,7 @@ import { EventEmitter } from 'node:events';

}
add(fn, options) {
add(function_, options) {
const delay = options?.delay || 0;
const timeToRun = Date.now() + delay;
this.q.push({
fn,
fn: function_,
timeToRun,

@@ -28,0 +28,0 @@ });

@@ -53,8 +53,8 @@ import http from 'node:http';

// This means we got a path with no / at the end!
const doc = "<html><body>Redirectin'</body></html>";
const document = "<html><body>Redirectin'</body></html>";
response.statusCode = 301;
response.setHeader('Content-Type', 'text/html; charset=UTF-8');
response.setHeader('Content-Length', Buffer.byteLength(doc));
response.setHeader('Content-Length', Buffer.byteLength(document));
response.setHeader('Location', request.url + '/');
response.end(doc);
response.end(document);
return;

@@ -75,3 +75,10 @@ }

if (isMarkdown && options.markdown) {
data = marked(data, { gfm: true });
const markedData = marked(data, { gfm: true });
if (typeof markedData === 'string') {
data = markedData;
}
else if ((typeof markedData === 'object' || typeof markedData === 'function') &&
typeof markedData.then === 'function') {
data = await markedData;
}
mimeType = 'text/html; charset=UTF-8';

@@ -78,0 +85,0 @@ }

{
"name": "linkinator",
"description": "Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.",
"version": "6.0.4",
"version": "6.0.5",
"license": "MIT",

@@ -31,3 +31,3 @@ "repository": "JustinBeckwith/linkinator",

"htmlparser2": "^9.0.0",
"marked": "^10.0.0",
"marked": "^12.0.1",
"meow": "^13.0.0",

@@ -45,11 +45,11 @@ "mime": "^4.0.0",

"c8": "^9.0.0",
"execa": "^8.0.0",
"execa": "^9.0.0",
"mocha": "^10.0.0",
"nock": "^13.2.1",
"pkg": "^5.4.1",
"semantic-release": "^23.0.0",
"sinon": "^17.0.0",
"semantic-release": "^24.0.0",
"sinon": "^18.0.0",
"strip-ansi": "^7.0.1",
"typescript": "^5.0.0",
"xo": "^0.56.0"
"xo": "^0.58.0"
},

@@ -56,0 +56,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc