Files
streamyfin_mirror/plugins/with-runtime-framework-headers.js
lance chant 89b34eddc1 fix: tv playback (#820)
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
Signed-off-by: lancechant <13349722+lancechant@users.noreply.github.com>
Co-authored-by: Fredrik Burmester <fredrik.burmester@gmail.com>
Co-authored-by: Uruk <contact@uruk.dev>
Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com>
2025-08-07 10:12:40 +02:00

67 lines
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { withPodfile } = require("expo/config-plugins");
const PATCH_START = "## >>> runtime-framework headers";
const PATCH_END = "## <<< runtime-framework headers";
const EXTRA_HDRS = [
`\${PODS_CONFIGURATION_BUILD_DIR}/React-RuntimeApple/React_RuntimeApple.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-RuntimeCore/React_RuntimeCore.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-jserrorhandler/React_jserrorhandler.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector/jsinspector_modern.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-runtimescheduler/React_runtimescheduler.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-performancetimeline/React_performancetimeline.framework/Headers`,
`\${PODS_CONFIGURATION_BUILD_DIR}/React-rendererconsistency/React_rendererconsistency.framework/Headers`,
];
function buildPatch() {
return [
PATCH_START,
" extra_hdrs = [",
...EXTRA_HDRS.map((h) => ` "${h}",`),
" ]",
"",
" installer.pods_project.targets.each do |t|",
" t.build_configurations.each do |cfg|",
" cfg.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited)'",
" cfg.build_settings['HEADER_SEARCH_PATHS'] << \" #{extra_hdrs.join(' ')}\"",
" end",
" end",
PATCH_END,
].join("\n");
}
module.exports = function withRuntimeFrameworkHeaders(config) {
return withPodfile(config, (config) => {
let podfile = config.modResults.contents;
// 1⃣ ensure there's a post_install block
if (!/^\s*post_install\s+do\s+\|installer\|/m.test(podfile)) {
podfile += `
post_install do |installer|
end
`;
}
const patch = buildPatch();
if (podfile.includes(PATCH_START)) {
// 🔄 update existing patch
podfile = podfile.replace(
new RegExp(`${PATCH_START}[\\s\\S]*?${PATCH_END}`),
patch,
);
} else {
// insert right after the post_install opening line
podfile = podfile.replace(
/^\s*post_install\s+do\s+\|installer\|.*$/m,
(match) => `${match}\n\n${patch}`,
);
}
console.log("✅ with-runtime-framework-headers: Podfile updated");
config.modResults.contents = podfile;
return config;
});
};