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

href-checker

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

href-checker - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

36

cli.js

@@ -29,3 +29,3 @@ #!/usr/bin/env node

try {
await main(new URL(url), options);
await main(url, options);
}

@@ -38,3 +38,4 @@ catch (error) {

.parse(process.argv);
async function main(url, opts) {
async function main(input, opts) {
const url = normalizeURL(input);
const LinkType = {

@@ -62,2 +63,6 @@ "same-page": "samePage",

};
if (url.protocol === "file:" && options.sameSite) {
options.sameSite = false;
console.warn("Warning: --same-site is ignored with local files.");
}
const errorIf = new Set();

@@ -81,11 +86,32 @@ const warnIf = new Set();

};
let hasFailures = false;
for await (const result of index_js_1.checkLinks(url, options)) {
const output = formatOutput(result, outputOptions);
const resultType = getResultType(result, outputOptions);
if (resultType === 1 /* fail */)
hasFailures = true;
const output = formatOutput(result, resultType, outputOptions);
if (output)
console.log(output);
}
if (hasFailures) {
throw new Error("Broken links found.");
}
}
function formatOutput(result, options) {
function normalizeURL(url) {
try {
return new URL(url);
}
catch {
if (!fs_1.existsSync(url)) {
throw new Error(`ENOENT (No such file): ${url}`);
}
url = path_1.resolve(url).replace(/\\/g, "/");
if (url[0] !== "/") {
url = "/" + url;
}
return new URL(encodeURI("file://" + url));
}
}
function formatOutput(result, resultType, options) {
const { input, output } = result;
const resultType = getResultType(result, options);
if (options.silent && resultType === 0 /* ok */) {

@@ -92,0 +118,0 @@ return null;

2

package.json
{
"name": "href-checker",
"version": "1.1.0",
"version": "1.1.1",
"description": "Hyperlink checker for HTML pages which checks href attributes by actually visiting linked pages and also checking existence of URL fragments.",

@@ -5,0 +5,0 @@ "keywords": [

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