Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
ScssPhp\ScssPhp\SourceMap\SourceMapGenerator Class Reference

Source Map Generator. More...

Public Member Functions

 addMapping ($generatedLine, $generatedColumn, $originalLine, $originalColumn, $sourceFile)
 Adds a mapping.
 
 fixWindowsPath ($path, $addEndSlash=false)
 Fix windows paths.
 
 generateJson ($prefix='')
 Generates the JSON source map.
 
 generateMappings ($prefix='')
 Generates the mappings string.
 
 saveMap ($content)
 Saves the source map to a file.
 

Public Attributes

const VERSION = 3
 What version of source map does the generator generate?
 

Protected Member Functions

 findFileIndex ($filename)
 Finds the index for the filename.
 
 getSourcesContent ()
 Returns the sources contents.
 
 normalizeFilename ($filename)
 Normalize filename.
 

Protected Attributes

array $contentsMap = []
 Array of contents map.
 
array $defaultOptions
 Array of default options.
 
ScssPhp ScssPhp SourceMap Base64VLQ $encoder
 The base64 VLQ encoder.
 
array $mappings = []
 Array of mappings.
 
array< string, $sources=[];protected array< string, $sourceKeys=[];private array $options;public function __construct(array $options=[]) { $this->options=array_replace( $this->defaultOptions, $options);$this-> encoder = new Base64VLQ()
 File to content map.
 

Detailed Description

Source Map Generator.

{

Member Function Documentation

◆ addMapping()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::addMapping ( $generatedLine,
$generatedColumn,
$originalLine,
$originalColumn,
$sourceFile )

Adds a mapping.

Parameters
int$generatedLineThe line number in generated file
int$generatedColumnThe column number in generated file
int$originalLineThe line number in original file
int$originalColumnThe column number in original file
string$sourceFileThe original source file
Return values
void

◆ findFileIndex()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::findFileIndex ( $filename)
protected

Finds the index for the filename.

Parameters
string$filename
Return values
int|false

◆ fixWindowsPath()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::fixWindowsPath ( $path,
$addEndSlash = false )

Fix windows paths.

Parameters
string$path
bool$addEndSlash
Return values
string

◆ generateJson()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::generateJson ( $prefix = '')

Generates the JSON source map.

Parameters
string$prefixA prefix added in the output file, which needs to shift mappings
Return values
string
See also
https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#

◆ generateMappings()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::generateMappings ( $prefix = '')

Generates the mappings string.

Parameters
string$prefixA prefix added in the output file, which needs to shift mappings
Return values
string

◆ getSourcesContent()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::getSourcesContent ( )
protected

Returns the sources contents.

Return values
string[]|null

◆ normalizeFilename()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::normalizeFilename ( $filename)
protected

Normalize filename.

Parameters
string$filename
Return values
string

◆ saveMap()

ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::saveMap ( $content)

Saves the source map to a file.

Parameters
string$contentThe content to write
Return values
string|null
Exceptions
ScssPhp\ScssPhp\Exception\CompilerExceptionIf the file could not be saved
Deprecated

Member Data Documentation

◆ $defaultOptions

array ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::$defaultOptions
protected
Initial value:
= [
'sourceRoot' => '',
'sourceMapFilename' => null,
'sourceMapURL' => null,
'sourceMapWriteTo' => null,
'outputSourceFiles' => false,
'sourceMapRootpath' => '',
'sourceMapBasepath' => ''
]

Array of default options.

@phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}

◆ $mappings

array ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::$mappings = []
protected

Array of mappings.

@phpstan-var list<array{generated_line: int, generated_column: int, original_line: int, original_column: int, source_file: string}>

◆ encoder

array<string, $sources = []; protected array<string, $sourceKeys = []; private array $options; public function __construct(array $options = []) { $this->options = array_replace($this->defaultOptions, $options); $this-> ScssPhp\ScssPhp\SourceMap\SourceMapGenerator::encoder = new Base64VLQ()
protected

File to content map.

string>


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