There's bug in above code that os.EOL need to be replaced by '\n'. In case in Windows system, but line is broken only with '\n', os.EOL in Windows is '\r\n'.
const endBlock = /\/\/ #endif$/
This above still have bug that change it like this const endBlock = /\/\/ #endif/
const sourceByLine = source.split(os.EOL)
There's bug in above code that os.EOL need to be replaced by '\n'. In case in Windows system, but line is broken only with '\n', os.EOL in Windows is '\r\n'.
const endBlock = /\/\/ #endif$/
This above still have bug that change it like this const endBlock = /\/\/ #endif/