Skip to content

Commit

Permalink
Fix types missing file detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jul 26, 2023
1 parent c77f5b1 commit af9a18f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,16 @@ export async function publint({ pkgDir, vfs, level, strict, _packedFiles }) {
if (seenResolvedKeys.has(seenKey)) continue
seenResolvedKeys.add(seenKey)

const resolvedPath = vfs.pathJoin(pkgDir, result.value)
// if path doesn't exist, let the missing file error message take over instead
if (!(await vfs.isPathExist(resolvedPath))) continue

if (isDtsFile(result.value)) {
// if we have resolve to a dts file, it might not be ours because typescript requires
// `.d.mts` and `.d.cts` for esm and cjs (`.js` and nearest type: module behaviour applies).
// check if we're hitting this case :(
const dtsActualFormat = await getDtsFilePathFormat(
vfs.pathJoin(pkgDir, result.value),
resolvedPath,
vfs
)
// get the intended format from the conditions. yes, while the `import` condition can actually
Expand Down
1 change: 0 additions & 1 deletion pkg/tests/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ testFixture('glob-deprecated', [
])

testFixture('missing-files', [
'EXPORT_TYPES_INVALID_FORMAT',
...Array(7).fill('FILE_DOES_NOT_EXIST'),
'FILE_NOT_PUBLISHED',
'USE_EXPORTS_BROWSER'
Expand Down

0 comments on commit af9a18f

Please sign in to comment.