// Sort cross-chunk imports by chunk name for determinism
Sort cross-chunk imports by chunk name for determinism
// Sort cross - chunk imports by chunk name for determinism
func (c *linkerContext) sortedCrossChunkImports(chunks []chunkInfo, importsFromOtherChunks map[uint32]crossChunkImportItemArray) crossChunkImportArray {
	result := make(crossChunkImportArray, 0, len(importsFromOtherChunks))
	for otherChunkIndex, importItems := range importsFromOtherChunks {
		otherChunk := &chunks[otherChunkIndex]
		exportsToOtherChunks := otherChunk.chunkRepr.(*chunkReprJS).exportsToOtherChunks
		for i, item := range importItems {
			importItems[i].exportAlias = exportsToOtherChunks[item.ref]
		}
		sort.Sort(importItems)
		result = append(result, crossChunkImport{
			chunkIndex:        otherChunkIndex,
			sortedImportItems: importItems,
		})
	}
	sort.Sort(result)
	return result
}
func ( c * linkerContext ) sortedCrossChunkImports ( chunks [ ] chunkInfo , importsFromOtherChunks map [ uint32 ] crossChunkImportItemArray ) crossChunkImportArray { result := make ( crossChunkImportArray , 0 , len ( importsFromOtherChunks ) ) for otherChunkIndex , importItems := range importsFromOtherChunks { otherChunk := & chunks [ otherChunkIndex ] exportsToOtherChunks := otherChunk . chunkRepr . ( * chunkReprJS ) . exportsToOtherChunks for i , item := range importItems { importItems [ i ] . exportAlias = exportsToOtherChunks [ item . ref ] } sort . Sort ( importItems ) result = append ( result , crossChunkImport { chunkIndex : otherChunkIndex , sortedImportItems : importItems , } ) } sort . Sort ( result ) return result }
Sort cross-chunk imports by chunk name for determinism
Sort cross - chunk imports by chunk name for determinism
// Sort imports from a single chunk by alias for determinism