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.0.0 to 1.0.1

17

cli.js
#!/usr/bin/env node
import sade from "sade";
import { readFileSync } from "fs";
import { checkLinks } from "./index.js";
sade("href-checker <url>", true)
.version(JSON.parse(readFileSync("./package.json", "utf-8")).version)
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const sade_1 = __importDefault(require("sade"));
const fs_1 = require("fs");
const index_js_1 = require("./index.js");
sade_1.default("href-checker <url>", true)
.version(JSON.parse(fs_1.readFileSync("./package.json", "utf-8")).version)
.example("https://example.com")

@@ -49,3 +54,3 @@ .example("https://sidvishnoi.github.io/ --no-off-site --format=json")

}
for await (const result of checkLinks(url, options)) {
for await (const result of index_js_1.checkLinks(url, options)) {
const output = formatOutput(result, outputOptions);

@@ -52,0 +57,0 @@ if (output)

@@ -1,2 +0,8 @@

import puppeteer from "puppeteer";
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllLinks = exports.checkLinks = void 0;
const puppeteer_1 = __importDefault(require("puppeteer"));
const defaults = {

@@ -12,7 +18,7 @@ samePage: true,

};
export async function* checkLinks(url, options = {}) {
async function* checkLinks(url, options = {}) {
const opts = { ...defaults, ...options };
opts.puppeteer = { ...defaults.puppeteer, ...options.puppeteer };
let caughtError;
const browser = await puppeteer.launch();
const browser = await puppeteer_1.default.launch();
try {

@@ -45,3 +51,4 @@ const page = await browser.newPage();

}
export async function getAllLinks(page, options) {
exports.checkLinks = checkLinks;
async function getAllLinks(page, options) {
return {

@@ -53,2 +60,3 @@ samePage: count(options.samePage ? await getSamePageLinks(page) : []),

}
exports.getAllLinks = getAllLinks;
function getExternalLinks(page) {

@@ -112,3 +120,4 @@ return page.$$eval("a[href]", elems => {

}
return { pageExists, fragExists, status: response?.status() };
const status = response ? response.status() : undefined;
return { pageExists, fragExists, status };
}

@@ -115,0 +124,0 @@ catch (error) {

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

@@ -20,3 +20,2 @@ "keywords": [

"author": "Sid Vishnoi <sidvishnoi8@gmail.com> (https://sidvishnoi.github.io/)",
"type": "module",
"main": "index.js",

@@ -29,2 +28,3 @@ "bin": "cli.js",

"scripts": {
"prepare": "tsc -d -p tsconfig.json",
"build": "tsc -d -p tsconfig.json"

@@ -42,4 +42,4 @@ },

"engines": {
"node": ">= 14"
"node": ">= 12.11"
}
}
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