installGlobalsForPolicy = (resourceId, packageCompartmentGlobal) => {
  if (resourceId === LAVAMOAT.root) {
    rootCompartmentGlobalThis = packageCompartmentGlobal
    copyWrappedGlobals(
      theRealGlobalThis,
      rootCompartmentGlobalThis,
      globalAliases
    )
    LAVAMOAT?.scuttling?.scuttle(
      theRealGlobalThis,
      LAVAMOAT.options?.scuttleGlobalThis
    )
  } else {
    const endowments = getEndowmentsForConfig(
      rootCompartmentGlobalThis,
      LAVAMOAT.policy.resources[resourceId] || {},
      globalThis,
      packageCompartmentGlobal
    )

    defineProperties(packageCompartmentGlobal, {
      ...getOwnPropertyDescriptors(endowments),
      // preserve the correct global aliases even if endowments define them differently
      ...fromEntries(
        globalAliases.map((alias) => [
          alias,
          { value: packageCompartmentGlobal },
        ])
      ),
    })

    if (LAVAMOAT.debug) {
      LAVAMOAT.debug.debugProxy(
        packageCompartmentGlobal,
        rootCompartmentGlobalThis,
        resourceId
      )
    }
  }
}
Installs globals for a specific policy resource.

@param {string} resourceId - The ID of the resource.
@param {Object} packageCompartmentGlobal - The global object of the package
  compartment.