CommonJS
The CJS filter maps export statements to their CommonJS counterparts.
export def ftoexports.f =export async def ftoexports.f = asyncexport v =toexports.v =export default proctomodule.exports =export default async proctomodule.exports = asyncexport defaulttomodule.exports =
__FILE__
Ruby’s __FILE__ constant is converted to __filename, which is available in Node.js CommonJS modules:
__FILE__
# => __filename
puts __FILE__
# => puts(__filename)
__dir__
Ruby’s __dir__ method is converted to __dirname, which is available in Node.js CommonJS modules:
__dir__
# => __dirname
puts __dir__
# => puts(__dirname)