tessl install tessl/npm-coffeescript@2.7.0A programming language that compiles into JavaScript, offering more concise and readable syntax while maintaining full JavaScript compatibility.
Agent Success
Agent success rate when using this tile
77%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
76%
Create a module loader utility that enables Node.js to require files with multi-dot extensions (e.g., .spec.js, .config.json, .test.ts).
Node.js's module system only recognizes the last extension in a filename. For example, with a file named config.production.json, Node.js only sees .json and doesn't recognize .production.json as a valid extension handler. This limitation prevents custom extension handlers from working with multi-dot filenames.
Your task is to implement a module loader that patches Node.js's module loading mechanism to support multi-dot extensions.
The loader must:
.test.js, .config.json)require()./config.production.json, the loader should first check if .production.json has a registered handler, then check .json.test.js extension handler successfully loads a file named example.test.js @test@generates
/**
* Registers a custom handler for a multi-dot extension.
*
* @param {string} extension - The extension to register (e.g., '.test.js', '.config.json')
* @param {function} handler - Function that takes (module, filename) and loads the content
*/
function registerExtension(extension, handler) {
// IMPLEMENTATION HERE
}
/**
* Patches Node.js's module system to support multi-dot extensions.
* Must be called before requiring any files with multi-dot extensions.
*/
function patchModuleLoader() {
// IMPLEMENTATION HERE
}
module.exports = {
registerExtension,
patchModuleLoader
};Provides CoffeeScript compilation and module loading capabilities.
@satisfied-by