@morojs/moro / isPackageAvailable
Function: isPackageAvailable()
isPackageAvailable(
packageName):boolean
Defined in: src/core/utilities/package-utils.ts:20
Check if a package is available in the user's node_modules Uses ESM-compatible module resolution from the user's working directory
Parameters
packageName
string
The name of the package to check (e.g., 'socket.io', 'zod')
Returns
boolean
true if the package is installed, false otherwise
Example
if (isPackageAvailable('socket.io')) { // socket.io is installed, safe to import const { Server } = await import('socket.io'); }