mediawiki.inspect

Tools for inspecting page composition and performance.

Methods

auditSelectors(css) → {Object|number|number}static #

Given CSS source, count both the total number of selectors it contains and the number which match some element in the current document.

Parameters:

Name Type Description
css string

CSS source

Source:

Returns:

  • Selector counts

    Type
    Object
  • return.selectors Total number of selectors

    Type
    number
  • return.matched Number of matched selectors

    Type
    number

Given CSS source, count both the total number of selectors it contains and the number which match some element in the current document.

dumpTable(data)static #

Print tabular data to the console using console.table.

Parameters:

Name Type Description
data Array

Tabular data represented as an array of objects with common properties.

Source:
Print tabular data to the console using console.table.

getDependencyGraph() → {Object}static #

Return a map of all dependency relationships between loaded modules.

Source:

Returns:

Maps module names to objects. Each sub-object has two properties, 'requires' and 'requiredBy'.

Type
Object
Return a map of all dependency relationships between loaded modules.

getLoadedModules() → {Array}static #

Get a list of all loaded ResourceLoader modules.

Source:

Returns:

List of module names

Type
Array
Get a list of all loaded ResourceLoader modules.

getModuleSize(moduleName) → {number|null}static #

Calculate the byte size of a ResourceLoader module.

Parameters:

Name Type Description
moduleName string

The name of the module

Source:

Returns:

Module size in bytes or null

Type
number | null
Calculate the byte size of a ResourceLoader module.

grep(pattern) → {Array}static #

Perform a string search across the JavaScript and CSS source code of all loaded modules and return an array of the names of the modules that matched.

Parameters:

Name Type Description
pattern string | RegExp

String or regexp to match.

Source:

Returns:

Array of the names of modules that matched.

Type
Array

Perform a string search across the JavaScript and CSS source code of all loaded modules and return an array of the names of the modules that matched.

runReports(…reports)static #

Generate and print reports.

When invoked without arguments, prints all available reports.

Parameters:

Name Type Attributes Description
reports string optional
repeatable

One or more of "size", "css", "store", or "time".

Source:
Generate and print reports.