posthog_cli/sourcemaps/hermes/
inject.rs

1// Inject-minified is identical to injecting web-facing bundles, just with slightly different search parameters
2// It's intended as an escape hatch for people rolling their own build pipeline - we expect most users to be
3// using the metro plugin for injecting, and then calling clone
4
5use anyhow::Result;
6use walkdir::DirEntry;
7
8use crate::{
9    invocation_context::context,
10    sourcemaps::inject::{inject_impl, InjectArgs},
11};
12
13pub fn inject(args: &InjectArgs) -> Result<()> {
14    context().capture_command_invoked("hermes_inject");
15    inject_impl(args, is_metro_bundle)
16}
17
18pub fn is_metro_bundle(entry: &DirEntry) -> bool {
19    entry.file_type().is_file()
20        && entry
21            .path()
22            .extension()
23            .is_some_and(|ext| ext == "bundle" || ext == "jsbundle")
24}