INNER CODE UNIT · Go

cgIsPublicPathName

cc1a2b/JShunter · internal/jshunter/chunkgraph.go:262

func cgIsPublicPathName(n string) bool {
	return n == "p" || n == "publicPath" || n == "__webpack_public_path__" || n == "u"
}

// cgWebpackChunkMaps reconstructs chunk URLs from the runtime's own URL builder.
//
// webpack emits `r.u = e => "static/chunks/" + e + "." + {1:"a1b2",2:"c3d4"}[e] + ".js"`.
// The literal fragments give the path template and the object literals give the
// id-to-hash and id-to-name maps, so the full asset list is recoverable exactly
// rather than guessed.
func cgWebpackChunkMaps(body []byte) []ChunkRef {
	var out []ChunkRef
	for _, prop := range []string{"u", "miniCssF", "k"} {
		for _, cap := range cgCaptureAssignments(body, prop) {
			out = append(out, cgBuildChunkURLs(cap, "webpack."+prop)...)
		}
	}
	return out

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…