SourceMapGenerator
in package
Source Map Generator
}
Tags
Table of Contents
- VERSION = 3
- What version of source map does the generator generate?
- $contentsMap : array<string|int, mixed>
- Array of contents map
- $defaultOptions : array<string|int, mixed>
- Array of default options
- $encoder : Base64VLQ
- The base64 VLQ encoder
- $mappings : array<string|int, mixed>
- Array of mappings
- $sourceKeys : mixed
- $sources : array<string|int, mixed>
- File to content map
- $options : array<string|int, mixed>
- __construct() : mixed
- addMapping() : mixed
- Adds a mapping
- fixWindowsPath() : string
- Fix windows paths
- generateJson() : string
- Generates the JSON source map
- generateMappings() : string
- Generates the mappings string
- saveMap() : string
- Saves the source map to a file
- findFileIndex() : int|false
- Finds the index for the filename
- getSourcesContent() : array<string|int, mixed>|null
- Returns the sources contents
- normalizeFilename() : string
- Normalize filename
Constants
VERSION
What version of source map does the generator generate?
public
mixed
VERSION
= 3
Properties
$contentsMap
Array of contents map
protected
array<string|int, mixed>
$contentsMap
= []
$defaultOptions
Array of default options
protected
array<string|int, mixed>
$defaultOptions
= [
// an optional source root, useful for relocating source files
// on a server or removing repeated values in the 'sources' entry.
// This value is prepended to the individual entries in the 'source' field.
'sourceRoot' => '',
// an optional name of the generated code that this source map is associated with.
'sourceMapFilename' => null,
// url of the map
'sourceMapURL' => null,
// absolute path to a file to write the map to
'sourceMapWriteTo' => null,
// output source contents?
'outputSourceFiles' => false,
// base path for filename normalization
'sourceMapRootpath' => '',
// base path for filename normalization
'sourceMapBasepath' => '',
]
$encoder
The base64 VLQ encoder
protected
Base64VLQ
$encoder
$mappings
Array of mappings
protected
array<string|int, mixed>
$mappings
= []
$sourceKeys
protected
mixed
$sourceKeys
= []
$sources
File to content map
protected
array<string|int, mixed>
$sources
= []
$options
private
array<string|int, mixed>
$options
Methods
__construct()
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
Return values
mixed —addMapping()
Adds a mapping
public
addMapping(int $generatedLine, int $generatedColumn, int $originalLine, int $originalColumn, string $sourceFile) : mixed
Parameters
- $generatedLine : int
-
The line number in generated file
- $generatedColumn : int
-
The column number in generated file
- $originalLine : int
-
The line number in original file
- $originalColumn : int
-
The column number in original file
- $sourceFile : string
-
The original source file
Return values
mixed —fixWindowsPath()
Fix windows paths
public
fixWindowsPath(string $path[, bool $addEndSlash = false ]) : string
Parameters
- $path : string
- $addEndSlash : bool = false
Return values
string —generateJson()
Generates the JSON source map
public
generateJson() : string
Tags
Return values
string —generateMappings()
Generates the mappings string
public
generateMappings() : string
Return values
string —saveMap()
Saves the source map to a file
public
saveMap(string $content) : string
Parameters
- $content : string
-
The content to write
Tags
Return values
string —findFileIndex()
Finds the index for the filename
protected
findFileIndex(string $filename) : int|false
Parameters
- $filename : string
Return values
int|false —getSourcesContent()
Returns the sources contents
protected
getSourcesContent() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —normalizeFilename()
Normalize filename
protected
normalizeFilename(string $filename) : string
Parameters
- $filename : string