(jsPath string, flags Flag)
| 473 | } |
| 474 | |
| 475 | func 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 | |
| 506 | func insertVersionInfo(jsPath string, flags Flag) { |
| 507 | utils.ModifyFile(jsPath, func(content string) string { |
nothing calls this directly
no test coverage detected