MCPcopy
hub / github.com/spicetify/cli / insertExpFeatures

Function insertExpFeatures

src/apply/apply.go:475–504  ·  view source on GitHub ↗
(jsPath string, flags Flag)

Source from the content-addressed store, hash-verified

473}
474
475func insertExpFeatures(jsPath string, flags Flag) {
476 if !flags.ExpFeatures {
477 return
478 }
479
480 utils.ModifyFile(jsPath, func(content string) string {
481 utils.ReplaceOnce(
482 &content,
483 `(function \w+\((\w+)\)\{)(\w+ \w+=\w\.name;if\("internal")`,
484 func(submatches ...string) string {
485 return fmt.Sprintf("%s%s=Spicetify.expFeatureOverride(%s);%s", submatches[1], submatches[2], submatches[2], submatches[3])
486 })
487
488 // utils.ReplaceOnce(
489 // &content,
490 // `(\w+\.fromJSON)(\s*=\s*function\b[^{]*{[^}]*})`,
491 // func(submatches ...string) string {
492 // return fmt.Sprintf("%s=Spicetify.createInternalMap%s", submatches[1], submatches[2])
493 // })
494
495 utils.ReplaceOnce(
496 &content,
497 `(([\w$.]+\.fromJSON)\(\w+\)+;)(return ?[\w{}().,]+[\w$]+\.Provider,)(\{value:\{localConfiguration)`,
498 func(submatches ...string) string {
499 return fmt.Sprintf("%sSpicetify.createInternalMap=%s;%sSpicetify.RemoteConfigResolver=%s", submatches[1], submatches[2], submatches[3], submatches[4])
500 })
501
502 return content
503 })
504}
505
506func insertVersionInfo(jsPath string, flags Flag) {
507 utils.ModifyFile(jsPath, func(content string) string {

Callers

nothing calls this directly

Calls 2

ModifyFileFunction · 0.92
ReplaceOnceFunction · 0.92

Tested by

no test coverage detected