Factor out replace_extension function
Extract function to convert Python filename to JS filename