Use dictionary for calling input filters (#56089)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56089

Changelog: [Internal]

Replaces chained input filter calls with an iteration over a dict.

Reviewed By: cipolleschi

Differential Revision: D96455826

fbshipit-source-id: bdaf44285db6d3432a6401d6118f245abfa7dafb
This commit is contained in:
Dawid Małecki
2026-03-18 09:29:02 -07:00
committed by meta-codesync[bot]
parent 4aacd3f2be
commit 91c6c4d4ae
+11 -4
View File
@@ -14,6 +14,13 @@ from strip_block_comments import strip_block_comments
from strip_deprecated_msg import strip_deprecated_msg
from strip_ns_unavailable import strip_ns_unavailable
FILTERS = [
strip_block_comments,
strip_deprecated_msg,
strip_ns_unavailable,
encode_objc_interface_generics,
]
def main():
if len(sys.argv) < 2:
@@ -26,10 +33,10 @@ def main():
with open(filename, "r", encoding="utf-8", errors="replace") as f:
content = f.read()
filtered = strip_block_comments(content)
filtered = strip_deprecated_msg(filtered)
filtered = strip_ns_unavailable(filtered)
filtered = encode_objc_interface_generics(filtered)
filtered = content
for filter_fn in FILTERS:
filtered = filter_fn(filtered)
print(filtered, end="")
except Exception as e:
# On error, output original content to not break the build