On this page

class webpack.sources.CachedSource extends Source
new CachedSource(source, cachedData?): CachedSource
Attributes
source:Source | (() => Source)
cachedData:CachedData
Returns:CachedSource
buffer(): Buffer
Returns:Buffer

buffers(): Buffer<ArrayBufferLike>[]
Returns:Buffer<ArrayBufferLike>[]

clearCache(options?, visited?): void
Attributes
visited:WeakSet<Source>
Returns:void

Release cached data held by this source. clearCache is a memory hint: it never affects correctness or output, only how expensive the next read is. Subclasses override; the base is a no-op so every Source supports the call. Composite sources always recurse into wrapped sources. When the same child is reachable via several parents (e.g. modules shared across webpack chunks), pass a shared visited WeakSet so each subtree is walked at most once. Not safe to call concurrently with source/map/sourceAndMap/ streamChunks/updateHash on the same instance.


getCachedData(): CachedData
Returns:CachedData

map(options?): RawSourceMap | null
Attributes
options:MapOptions
Returns:RawSourceMap | null

original(): Source
Returns:Source

originalLazy(): Source | (() => Source)
Returns:Source | (() => Source)

size(): number
Returns:number

source(): SourceValue
Returns:SourceValue

sourceAndMap(options?): SourceAndMap
Attributes
options:MapOptions
Returns:SourceAndMap

streamChunks(options, onChunk, onSource, onName): GeneratedSourceInfo
Attributes
onChunk:(chunk: string | undefined, generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void
onSource:(sourceIndex: number, source: string | null, sourceContent?: string) => void
onName:(nameIndex: number, name: string) => void

updateHash(hash): void
Attributes
Returns:void
Attributes
file:string
file
mappings:Buffer<ArrayBufferLike>
mappings
names:string[]
name
sourceRoot:string
source root
sources:string[]
sources
sourcesContent:("" | Buffer<ArrayBufferLike>)[]
sources content
version:number
version

Attributes
bufferedMap:BufferedMap | null
map:RawSourceMap | null

Attributes
buffer:Buffer
buffer
hash:(string | Buffer<ArrayBufferLike>)[]
hash
size:number
size
source:boolean
source