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 2.13.7 to 2.14.0

20

build/src/cli.js

@@ -64,2 +64,8 @@ #!/usr/bin/env node

--url-rewrite-search
Pattern to search for in urls. Must be used with --url-rewrite-replace.
--url-rewrite-replace
Expression used to replace search content. Must be used with --url-rewrite-search.
--verbosity

@@ -89,2 +95,4 @@ Override the default verbosity for this command. Available options are

retry: { type: 'boolean' },
urlRewriteSearch: { type: 'string' },
urlReWriteReplace: { type: 'string' },
},

@@ -100,2 +108,6 @@ booleanDefault: undefined,

flags = await config_1.getConfig(cli.flags);
if ((flags.urlRewriteReplace && !flags.urlRewriteSearch) ||
(flags.urlRewriteSearch && !flags.urlRewriteReplace)) {
throw new Error('The url-rewrite-replace flag must be used with the url-rewrite-search flag.');
}
const start = Date.now();

@@ -145,2 +157,10 @@ const verbosity = parseVerbosity(flags);

}
if (flags.urlRewriteSearch && flags.urlRewriteReplace) {
opts.urlRewriteExpressions = [
{
pattern: new RegExp(flags.urlRewriteSearch),
replacement: flags.urlRewriteReplace,
},
];
}
const result = await checker.check(opts);

@@ -147,0 +167,0 @@ const filteredResults = result.links.filter(link => {

2

build/src/config.d.ts

@@ -14,3 +14,5 @@ export interface Flags {

retry?: boolean;
urlRewriteSearch?: string;
urlRewriteReplace?: string;
}
export declare function getConfig(flags: Flags): Promise<Flags>;

@@ -99,2 +99,11 @@ "use strict";

var _a;
// apply any regex url replacements
if (opts.checkOptions.urlRewriteExpressions) {
for (const exp of opts.checkOptions.urlRewriteExpressions) {
const newUrl = opts.url.href.replace(exp.pattern, exp.replacement);
if (opts.url.href !== newUrl) {
opts.url.href = newUrl;
}
}
}
// explicitly skip non-http[s] links before making the request

@@ -101,0 +110,0 @@ const proto = opts.url.protocol;

@@ -0,1 +1,5 @@

export interface UrlRewriteExpression {
pattern: RegExp;
replacement: string;
}
export interface CheckOptions {

@@ -12,2 +16,3 @@ concurrency?: number;

retry?: boolean;
urlRewriteExpressions?: UrlRewriteExpression[];
}

@@ -14,0 +19,0 @@ export interface InternalCheckOptions extends CheckOptions {

2

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

@@ -6,0 +6,0 @@ "repository": "JustinBeckwith/linkinator",

@@ -83,2 +83,8 @@ # 🐿 linkinator

--url-rewrite-search
Pattern to search for in urls. Must be used with --url-rewrite-replace.
--url-rewrite-replace
Expression used to replace search content. Must be used with --url-rewrite-search.
--verbosity

@@ -204,2 +210,3 @@ Override the default verbosity for this command. Available options are

- `directoryListing` (boolean) - Automatically serve a static file listing page when serving a directory. Defaults to `false`.
- `urlRewriteExpressions` (array) - Collection of objects that contain a search pattern, and replacement.

@@ -206,0 +213,0 @@ ### linkinator.LinkChecker()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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