Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/analyzer-tsconfig-extends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lit-labs/analyzer': patch
---

Detect sources when the `tsconfig.json` `extends` from another config.
10 changes: 6 additions & 4 deletions packages/labs/analyzer/src/lib/analyze-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export const createPackageAnalyzer = (
commandLine = ts.parseJsonConfigFileContent(
configFile.config /* json */,
ts.sys /* host */,
packagePath /* basePath */,
undefined /* existingOptions */,
path.relative(packagePath, configFileName) /* configFileName */
isDirectory ? packagePath : path.dirname(packagePath) /* basePath */,
{} /* existingOptions */,
configFileName /* configFileName */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this whole API is really funky, but note early on I had left this comment:

// Note that passing `packageRoot` for `basePath` works, but
// `getOutputFileNames` will fail without passing `configFileName`; once you
// pass that, it looks like paths are relative to the `configFileName`
// location (which is also under `packageRoot`), in which case `basePath`
// shouldn't duplicate `packageRoot`

I believe this empirical finding was why the configFileName argument here was being calculated relative to basePath. But I guess if you're not getting the errors I was having with packagePath show up both in basePath and configFileName and the tests are passing, I probably just misjudged what was going on...?

);
} else if (isDirectory) {
console.info(`No tsconfig.json found; assuming package is JavaScript.`);
Expand Down Expand Up @@ -99,7 +99,9 @@ export const createPackageAnalyzer = (
const program = ts.createProgram(
commandLine.fileNames,
commandLine.options,
compilerHost
compilerHost,
undefined,
commandLine.errors
);

const analyzer = new Analyzer({getProgram: () => program, fs: ts.sys, path});
Expand Down