Socket
Book a DemoInstallSign in
Socket

rtt-library

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtt-library

A front-end tool to test robots.txt rules against specific URLs.

1.0.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

Robots.txt Tester Library

A reusable JavaScript library for testing robots.txt rules against specific URLs.

Features

  • Test URLs against robots.txt rules
  • Highlight syntax for robots.txt content
  • Validate robots.txt syntax
  • Check for errors and potential issues
  • Check specific user-agents & paths

Installation

npm install

Development

The project uses Webpack for JavaScript bundling and Gulp for additional build tasks:

  • npm run dev - Start development mode with watch
  • npm run build - Create production build with bundling and minification
  • npm run styles - Build SCSS files
  • npm run watch:styles - Watch SCSS files for changes
  • npm run bundle - Create final bundle with dependencies

Build Output

The build process generates the following files in the dist directory:

  • rtt-library.js - The main library file. Must be used in conjunction with the third-party dependencies in the lib directory.
  • bundle.js - Combined file with all dependencies. Can be used as a standalone library.
  • main.css - Compiled and minified styles. Default styles for the library.

CssWrap is used to scope the styles to the #rtt-tool selector, ensuring that the styles do not conflict with other styles on the page.

Usage

You can use the library in two ways:

1. Via script/style tags

Include the bundle.js (or rtt-library.js plus the libs) and main.css files on a page:

<link rel="stylesheet" href="path/to/dist/main.css">
<script src="path/to/dist/bundle.js"></script>

Render the tool on a page:

/**
 * External dependencies
 */
import $ from 'jquery'

/**
 * WordPress dependencies
 */
import { createRoot } from '@wordpress/element'

const RttTool = window.RttTool || {};

( function() {
	$( function() {
		if ( document.getElementById( 'rank-math-admin-rtt' ) ) {
			const root = createRoot( document.getElementById( 'rank-math-admin-rtt' ) );
			root.render(
				<RttTool
					ajaxUrl={ window.rankMath.robotsTxtData.ajaxUrl }
					ajaxNonce={ window.rankMath.robotsTxtData.nonce }
					siteUrl={ window.rankMath.robotsTxtData.siteUrl }
				/>
			)
		}
	} )
}() )

2. Via npm import

import 'rtt-library';
import { createRoot } from '@wordpress/element';
import 'rtt-library/dist/main.css';

const RttTool = window.RttTool;

const root = createRoot(document.getElementById('rank-math-admin-rtt'));
root.render(
	<RttTool
		ajaxUrl={window.rankMath.robotsTxtData.ajaxUrl}
		ajaxNonce={window.rankMath.robotsTxtData.nonce}
		siteUrl={window.rankMath.robotsTxtData.siteUrl}
	/>
);

Configuration

You can configure the library by passing options to the RttTool component. The following options are available:

  • ajaxUrl: The URL for AJAX requests
  • ajaxNonce: The nonce for security
  • siteUrl: The initial site URL
  • robotsTxtContent: The initial content of the robots.txt file
  • editorDisabled: Whether the editor is disabled (for read-only mode)
  • isLocal: Local mode disables AJAX requests & prevents changing the site URL (default is false)

Dependencies

The library includes the following third-party dependencies:

  • highlight.js - For syntax highlighting
  • Additional highlight.js plugins for line numbers and line highlighting

FAQs

Package last updated on 02 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.