I agree that you have to have food to nourish your body. You have to take in so many calories/day in order to maintain basic body functions, such as breathing, heart beat, kidney, liver, brain function, etc.
You quite possibly passed out because of a lack of blood sugar, which occurs when not enough food is taken in.
It appears that maybe you have developed anorexia and you really should talk to your doctor and/or get counseling in order to re-establish healthy eating habits. It's entirely possible to eat healthy and exercise and not regain the weight you lost.
Have you talked with your doctor about your concerns? That you would sacrifice your health to maintain your current weight which you've learned is in jeopardy is a red flag to me. Your current weight isn't healthy if you can't function, which you can't if you are fainting. Please be gentle with yourself. Give yourself permission to eat to fulfill your basic requirements at the very least. Good luck.