// Given a set of output pieces (i.e. a buffer already divided into the spans
// between import paths), substitute the final import paths in and then join
// everything into a single byte buffer.
Given a set of output pieces , substitute the final import paths in and then join
everything into a single byte buffer.
// Given a set of output pieces ( i . e . a buffer already divided into the spans // between import paths ) substitute the final import paths in and then join // everything into a single byte buffer .
func (c *linkerContext) substituteFinalPaths(
	chunks []chunkInfo,
	pieces []outputPiece,
	modifyPath func(string) string,
) (j helpers.Joiner, shifts []sourcemap.SourceMapShift) {
	var shift sourcemap.SourceMapShift
	shifts = make([]sourcemap.SourceMapShift, 0, len(pieces))
	shifts = append(shifts, shift)
	for _, piece := range pieces {
		var dataOffset sourcemap.LineColumnOffset
		j.AddBytes(piece.data)
		dataOffset.AdvanceBytes(piece.data)
		shift.Before.Add(dataOffset)
		shift.After.Add(dataOffset)
		if piece.chunkIndex.IsValid() {
			chunk := chunks[piece.chunkIndex.GetIndex()]
			importPath := modifyPath(chunk.finalRelPath)
			j.AddString(importPath)
			shift.Before.AdvanceString(chunk.uniqueKey)
			shift.After.AdvanceString(importPath)
			shifts = append(shifts, shift)
		}
	}
	return
}
func ( c * linkerContext ) substituteFinalPaths ( chunks [ ] chunkInfo , pieces [ ] outputPiece , modifyPath func ( string ) string , ) ( j helpers . Joiner , shifts [ ] sourcemap . SourceMapShift ) { var shift sourcemap . SourceMapShift shifts = make ( [ ] sourcemap . SourceMapShift , 0 , len ( pieces ) ) shifts = append ( shifts , shift ) for _ , piece := range pieces { var dataOffset sourcemap . LineColumnOffset j . AddBytes ( piece . data ) dataOffset . AdvanceBytes ( piece . data ) shift . Before . Add ( dataOffset ) shift . After . Add ( dataOffset ) if piece . chunkIndex . IsValid ( ) { chunk := chunks [ piece . chunkIndex . GetIndex ( ) ] importPath := modifyPath ( chunk . finalRelPath ) j . AddString ( importPath ) shift . Before . AdvanceString ( chunk . uniqueKey ) shift . After . AdvanceString ( importPath ) shifts = append ( shifts , shift ) } } return }
Given a set of output pieces , substitute the final import paths in and then join
everything into a single byte buffer.
Given a set of output pieces substitute the final import paths in and then join everything into a single byte buffer .