checkPackedExports
functionChecks unpublished workspace/catalog ranges, imports the requested public subpaths through Node, and requires the package export map to reject each private subpath. Import checks execute the installed package, so use a trusted artifact. CLI, type and browser checks are caller-owned.
checkPackedExports(
consumer: IPackedConsumer,
options: IPackedExportCheck,
): Promise<string[]>Parameters
consumerIPackedConsumerAn installed temporary consumer.
optionsIPackedExportCheckThe name and paths to check. A root export is specified as
.. The caller's signal reason propagates if it interrupts an import check.
Returns
Promise<string[]>Diagnostics, or an empty array when all requested checks pass.
import { resolve } from 'node:path';
import { checkPackedExports, withPackedConsumer } from 'jg-package-check';
await withPackedConsumer(
{ packageManager: 'npm', tarballs: [resolve('jg-example-1.0.0.tgz')] },
(consumer) => checkPackedExports(consumer, {
packageName: 'jg-example',
importSubpaths: ['.', './format'],
privateSubpaths: ['./dist/internal.js'],
}),
);