-
Couldn't load subscription status.
- Fork 2
feat: add fullTraceInclude option
#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { parseNodeModulePath } from "mlly"; | |
| import { dirname, join, relative, resolve } from "pathe"; | ||
| import { readPackageJSON, writePackageJSON } from "pkg-types"; | ||
| import semver from "semver"; | ||
| import { glob } from "tinyglobby"; | ||
|
|
||
| type TracedFile = { | ||
| path: string; | ||
|
|
@@ -116,6 +117,17 @@ export async function traceNodeModules( | |
| pkgJSON, | ||
| }; | ||
| tracedPackage.versions[pkgJSON.version || "0.0.0"] = tracedPackageVersion; | ||
|
|
||
| if (opts.fullTraceInclude) { | ||
| const allFiles = await glob("**/*", { | ||
| cwd: tracedFile.pkgPath, | ||
| ignore: ["node_modules/**"], | ||
| }); | ||
|
|
||
| for (const file of allFiles) { | ||
| tracedPackageVersion.files.push(file); | ||
| } | ||
| } | ||
|
Comment on lines
+120
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this only adds all the files from a package detected by NFT. This does not account for new files discovered by nft. Not sure how to approach that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With option bein array, we can pre-resolve them here |
||
| } | ||
| tracedPackageVersion.files.push(tracedFile.path); | ||
| tracedFile.pkgName = pkgName; | ||
|
|
@@ -190,9 +202,9 @@ export async function traceNodeModules( | |
| // Utility to find package parents | ||
| const findPackageParents = (pkg: TracedPackage, version: string) => { | ||
| // Try to find parent packages | ||
| const versionFiles: TracedFile[] = pkg.versions[version]!.files.map( | ||
| (path) => tracedFiles[path]!, | ||
| ); | ||
| const versionFiles = pkg.versions[version]!.files.map( | ||
| (path) => tracedFiles[path], | ||
| ).filter((x): x is TracedFile => x !== undefined); | ||
| const parentPkgs = [ | ||
| ...new Set( | ||
| versionFiles.flatMap((file) => | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option could be more granular by giving an array of problematic packages to full trace.