Factorize getLinkDeps (#23013)
Prepare reuse of getLinkDeps for TH implementation in the JS backend (cf #22261 and review of !9779 (closed)).
Prepare reuse of getLinkDeps for TH implementation in the JS backend (cf #22261 and review of !9779 (closed)).