@pnpm/directory-fetcher
Advanced tools
Comparing version 7.0.12 to 8.0.0
@@ -15,4 +15,5 @@ import type { DirectoryFetcher, DirectoryFetcherOptions } from '@pnpm/fetcher-base'; | ||
packageImportMethod: "hardlink"; | ||
manifest: DependencyManifest | undefined; | ||
manifest: DependencyManifest; | ||
requiresBuild: boolean; | ||
}>; | ||
export {}; |
@@ -9,2 +9,4 @@ "use strict"; | ||
const path_1 = __importDefault(require("path")); | ||
const util_1 = __importDefault(require("util")); | ||
const exec_pkg_requires_build_1 = require("@pnpm/exec.pkg-requires-build"); | ||
const logger_1 = require("@pnpm/logger"); | ||
@@ -19,3 +21,3 @@ const fs_packlist_1 = require("@pnpm/fs.packlist"); | ||
const dir = path_1.default.join(opts.lockfileDir, resolution.directory); | ||
return fetchFromDir(dir, opts); | ||
return fetchFromDir(dir); | ||
}; | ||
@@ -29,17 +31,15 @@ return { | ||
if (opts.includeOnlyPackageFiles) { | ||
return fetchPackageFilesFromDir(dir, opts); | ||
return fetchPackageFilesFromDir(dir); | ||
} | ||
const readFileStat = opts?.resolveSymlinks === true ? realFileStat : fileStat; | ||
return fetchAllFilesFromDir(readFileStat, dir, opts); | ||
return fetchAllFilesFromDir(readFileStat, dir); | ||
} | ||
exports.fetchFromDir = fetchFromDir; | ||
async function fetchAllFilesFromDir(readFileStat, dir, opts) { | ||
async function fetchAllFilesFromDir(readFileStat, dir) { | ||
const filesIndex = await _fetchAllFilesFromDir(readFileStat, dir); | ||
let manifest; | ||
if (opts.readManifest) { | ||
// In a regular pnpm workspace it will probably never happen that a dependency has no package.json file. | ||
// Safe read was added to support the Bit workspace in which the components have no package.json files. | ||
// Related PR in Bit: https://github.com/teambit/bit/pull/5251 | ||
manifest = await (0, read_project_manifest_1.safeReadProjectManifestOnly)(dir) ?? undefined; | ||
} | ||
// In a regular pnpm workspace it will probably never happen that a dependency has no package.json file. | ||
// Safe read was added to support the Bit workspace in which the components have no package.json files. | ||
// Related PR in Bit: https://github.com/teambit/bit/pull/5251 | ||
const manifest = await (0, read_project_manifest_1.safeReadProjectManifestOnly)(dir) ?? undefined; | ||
const requiresBuild = (0, exec_pkg_requires_build_1.pkgRequiresBuild)(manifest, filesIndex); | ||
return { | ||
@@ -50,2 +50,3 @@ local: true, | ||
manifest, | ||
requiresBuild, | ||
}; | ||
@@ -83,5 +84,5 @@ } | ||
} | ||
catch (err) { // eslint-disable-line @typescript-eslint/no-explicit-any | ||
catch (err) { | ||
// Broken symlinks are skipped | ||
if (err.code === 'ENOENT') { | ||
if (util_1.default.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT') { | ||
directoryFetcherLogger.debug({ brokenSymlink: filePath }); | ||
@@ -100,5 +101,5 @@ return { filePath: null, stat: null }; | ||
} | ||
catch (err) { // eslint-disable-line @typescript-eslint/no-explicit-any | ||
catch (err) { | ||
// Broken symlinks are skipped | ||
if (err.code === 'ENOENT') { | ||
if (util_1.default.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT') { | ||
directoryFetcherLogger.debug({ brokenSymlink: filePath }); | ||
@@ -110,12 +111,10 @@ return { filePath: null, stat: null }; | ||
} | ||
async function fetchPackageFilesFromDir(dir, opts) { | ||
async function fetchPackageFilesFromDir(dir) { | ||
const files = await (0, fs_packlist_1.packlist)(dir); | ||
const filesIndex = Object.fromEntries(files.map((file) => [file, path_1.default.join(dir, file)])); | ||
let manifest; | ||
if (opts.readManifest) { | ||
// In a regular pnpm workspace it will probably never happen that a dependency has no package.json file. | ||
// Safe read was added to support the Bit workspace in which the components have no package.json files. | ||
// Related PR in Bit: https://github.com/teambit/bit/pull/5251 | ||
manifest = await (0, read_project_manifest_1.safeReadProjectManifestOnly)(dir) ?? undefined; | ||
} | ||
// In a regular pnpm workspace it will probably never happen that a dependency has no package.json file. | ||
// Safe read was added to support the Bit workspace in which the components have no package.json files. | ||
// Related PR in Bit: https://github.com/teambit/bit/pull/5251 | ||
const manifest = await (0, read_project_manifest_1.safeReadProjectManifestOnly)(dir) ?? undefined; | ||
const requiresBuild = (0, exec_pkg_requires_build_1.pkgRequiresBuild)(manifest, filesIndex); | ||
return { | ||
@@ -126,4 +125,5 @@ local: true, | ||
manifest, | ||
requiresBuild, | ||
}; | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@pnpm/directory-fetcher", | ||
"version": "7.0.12", | ||
"version": "8.0.0", | ||
"description": "A fetcher for local directory packages", | ||
@@ -14,6 +14,6 @@ "funding": "https://opencollective.com/pnpm", | ||
"engines": { | ||
"node": ">=16.14" | ||
"node": ">=18.12" | ||
}, | ||
"keywords": [ | ||
"pnpm8", | ||
"pnpm9", | ||
"pnpm", | ||
@@ -31,11 +31,12 @@ "fetcher" | ||
"dependencies": { | ||
"@pnpm/fetcher-base": "15.0.7", | ||
"@pnpm/fs.packlist": "1.0.3", | ||
"@pnpm/read-project-manifest": "5.0.11", | ||
"@pnpm/resolver-base": "11.1.0", | ||
"@pnpm/types": "9.4.2" | ||
"@pnpm/exec.pkg-requires-build": "1.0.0", | ||
"@pnpm/fetcher-base": "16.0.0", | ||
"@pnpm/fs.packlist": "2.0.0", | ||
"@pnpm/read-project-manifest": "6.0.0", | ||
"@pnpm/resolver-base": "12.0.0", | ||
"@pnpm/types": "10.0.0" | ||
}, | ||
"devDependencies": { | ||
"@zkochan/rimraf": "^2.1.3", | ||
"@pnpm/directory-fetcher": "7.0.12", | ||
"@pnpm/directory-fetcher": "8.0.0", | ||
"@pnpm/test-fixtures": "0.1.20" | ||
@@ -42,0 +43,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12554
138
7
+ Added@pnpm/constants@8.0.0(transitive)
+ Added@pnpm/error@6.0.0(transitive)
+ Added@pnpm/exec.pkg-requires-build@1.0.0(transitive)
+ Added@pnpm/fetcher-base@16.0.0(transitive)
+ Added@pnpm/fs.packlist@2.0.0(transitive)
+ Added@pnpm/graceful-fs@4.0.0(transitive)
+ Added@pnpm/read-project-manifest@6.0.0(transitive)
+ Added@pnpm/resolver-base@12.0.0(transitive)
+ Added@pnpm/text.comments-parser@3.0.0(transitive)
+ Added@pnpm/types@10.0.0(transitive)
+ Added@pnpm/write-project-manifest@6.0.0(transitive)
- Removed@pnpm/constants@7.1.1(transitive)
- Removed@pnpm/error@5.0.3(transitive)
- Removed@pnpm/fetcher-base@15.0.7(transitive)
- Removed@pnpm/fs.packlist@1.0.3(transitive)
- Removed@pnpm/graceful-fs@3.2.0(transitive)
- Removed@pnpm/read-project-manifest@5.0.11(transitive)
- Removed@pnpm/resolver-base@11.1.0(transitive)
- Removed@pnpm/text.comments-parser@2.0.0(transitive)
- Removed@pnpm/types@9.4.2(transitive)
- Removed@pnpm/write-project-manifest@5.0.6(transitive)
Updated@pnpm/fetcher-base@16.0.0
Updated@pnpm/fs.packlist@2.0.0
Updated@pnpm/resolver-base@12.0.0
Updated@pnpm/types@10.0.0