wikimedia/minify
Minification of JavaScript code and CSS stylesheets
Loading...
Searching...
No Matches
Wikimedia\Minify\MapperState Class Reference

The base class for stateful minifying with source map fetching. More...

+ Inheritance diagram for Wikimedia\Minify\MapperState:

Public Member Functions

 addSourceFile (string $url, string $source, bool $bundle=false)
 Minify a source file and collect the output and mappings data.
 
 addOutput (string $output)
 Add a string to the output without any minification or source mapping.
 
 getSourceMapData ()
 Get the source map data to be JSON encoded.
 
 getRawSourceMap ()
 Get the JSON-encoded source map.
 
 getSourceMap ()
 Get the JSON-encoded source map including XSSI protection prefix.
 
- Public Member Functions inherited from Wikimedia\Minify\MinifierState
 outputFile (string $file)
 Set the name of the output file, to be given as the "file" key.
 
 sourceRoot (string $url)
 Set the source root.
 
 setErrorHandler ( $onError)
 Register an error callback.
 
 ensureNewline ()
 Add a line break to the output if the output is non-empty and does not end in a line break.
 
 getMinifiedOutput ()
 Get the minified output.
 

Protected Attributes

 $mappingsGenerator
 
- Protected Attributes inherited from Wikimedia\Minify\MinifierState
 $sources = []
 
 $sourcesContent = []
 
 $minifiedOutput = ''
 
 $outputFile
 
 $sourceRoot
 
 $onError
 

Additional Inherited Members

- Protected Member Functions inherited from Wikimedia\Minify\MinifierState
 minify (string $source)
 Minify a string.
 

Detailed Description

The base class for stateful minifying with source map fetching.

Member Function Documentation

◆ addOutput()

Wikimedia\Minify\MapperState::addOutput ( string $output)

Add a string to the output without any minification or source mapping.

Parameters
string$output
Returns
$this

Reimplemented from Wikimedia\Minify\MinifierState.

◆ addSourceFile()

Wikimedia\Minify\MapperState::addSourceFile ( string $url,
string $source,
bool $bundle = false )

Minify a source file and collect the output and mappings data.

Parameters
string$urlThe name of the input file. Possibly a URL relative to the source root.
string$sourceThe input source text.
bool$bundleWhether to add the source text to sourcesContent
Returns
$this

Reimplemented from Wikimedia\Minify\MinifierState.

◆ getRawSourceMap()

Wikimedia\Minify\MapperState::getRawSourceMap ( )

Get the JSON-encoded source map.

Take care to avoid leaking private data due to an XSSI attack.

Returns
string

◆ getSourceMap()

Wikimedia\Minify\MapperState::getSourceMap ( )

Get the JSON-encoded source map including XSSI protection prefix.

Returns
string

◆ getSourceMapData()

Wikimedia\Minify\MapperState::getSourceMapData ( )

Get the source map data to be JSON encoded.

Returns
array

The documentation for this class was generated from the following file: