// Fails when a package's built declarations import a module the package doesn't depend on, which resolves to `any` for // a user whose package manager doesn't hoist it, such as pnpm with `hoist: false` or Yarn PnP import { existsSync, globSync, readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; interface Manifest { private?: boolean; dependencies?: Record; peerDependencies?: Record; } const root = fileURLToPath(new URL('../', import.meta.url)); // A string or comment that isn't a module specifier is a match of its own, so its text is never read as an import const IMPORT_STRING_OR_COMMENT = /\b(?:from|import)\s*\(?\s*["'](?[^"'.][^"']*)["']|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?