UNPKG

@pnpm/fs.packlist

Version:

Get a list of the files to add from a directory into an npm package

20 lines 981 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.packlist = packlist; const npm_packlist_1 = __importDefault(require("npm-packlist")); async function packlist(pkgDir, opts) { const packageJsonCacheMap = opts?.packageJsonCache ? new Map(Object.entries(opts.packageJsonCache)) : undefined; const files = await (0, npm_packlist_1.default)({ path: pkgDir, packageJsonCache: packageJsonCacheMap }); // There's a bug in the npm-packlist version that we use, // it sometimes returns duplicates. // Related issue: https://github.com/pnpm/pnpm/issues/6997 // Unfortunately, we cannot upgrade the library // newer versions of npm-packlist are very slow. return Array.from(new Set(files.map((file) => file.replace(/^\.[/\\]/, '')))); } //# sourceMappingURL=index.js.map