function getPackageDetails(dir) {
    const result = {
        /** @type {string} The package directory */ 
        moduleDir: dir,
        /** @type {string} The full file path of package.json for this package */
        packageFile: null,
        /** @type {boolean} True if this is a valid node-red module */
        isNodeRedModule: false,
        /** @type {boolean} True if a package.json file is present */
        isPackage: false,
        /** @type {boolean} True if this a node-red module and passes the checks */
        allowed: false,
        /** @type {object} The contents of package.json */
        package: null,
    }
    if (!dir) {  return result }
    try {
        const packagefile = path.join(dir,'package.json')
        result.has_node_modules = fs.existsSync(path.join(dir,'node_modules'))
        if(!fs.existsSync(packagefile)) {
            return result
        }
        result.packageFile = packagefile
        const pkg = require(packagefile)
        result.package = pkg
        if(result.package) {
            result.allowed = true
            result.isPackage = true
            result.isNodeRedModule = typeof result.package['node-red'] === 'object'
            if(result.isNodeRedModule) {
                result.isNodeRedModule = true;
                result.allowed = registryUtil.checkModuleAllowed(pkg.name,pkg.version,loadAllowList,loadDenyList) 
            }
        }
    } catch(err) {
        result.error = err; // this is not a package we are interested in!
    }
    return result || result;
}
Gets the package json object for the supplied `dir`.  
If there is no package.json or the `node-red` section is missing, `result.isNodeRedModule` will be `false`.
If there is no package.json `isPackage` will be `false`.
If an error occurs, `result.error` will contain the error.
@param {string} dir The directory to inspect