Show info about files/packages included with your rollup bundle
94
Build a utility that resolves and displays module file paths relative to their entry point directories, similar to how bundler analysis tools present module information.
Your implementation should process module information from a bundler and output relative paths for application files based on the entry point location. The tool should handle multiple entry points and maintain correct path relationships.
Handle module data that includes:
For modules in the "app" category:
For other module categories:
Display resolved module information showing:
When given entry point "/project/src/main.js" and module "/project/src/components/App.js", the base directory should be "/project/src" and the relative path should be "components/App.js" @test
When given multiple entry points ["/project/src/app.js", "/project/admin/index.js"] and modules from both locations, each module should resolve relative to its corresponding base directory @test
When given entry points as object {app: "/project/src/app.js", admin: "/project/admin/index.js"}, the resolution should match modules to the correct base directory by entry point @test
For npm package modules like "lodash" or helper modules, the identifier should remain unchanged regardless of entry point @test
@generates
/**
* Resolves module paths relative to their entry point base directories
* @param {Object} config - Configuration object
* @param {string|string[]|Object} config.entryPoints - Entry point(s) for the bundle
* @param {Array} config.modules - Array of module objects with {id, category} properties
* @returns {Array} Array of resolved module objects with {identifier, category, baseDir} properties
*/
function resolveModulePaths(config) {
// Implementation here
}
module.exports = { resolveModulePaths };Bundle size analysis plugin that demonstrates base directory management for module path resolution.
Provides path manipulation utilities for directory and relative path operations.
Install with Tessl CLI
npx tessl i tessl/npm-rollup-plugin-sizesdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10