Skip to content
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

cannot use symlinked entry points with 'packages' strategy #2130

Closed
boneskull opened this issue Dec 28, 2022 · 2 comments · Fixed by #2134
Closed

cannot use symlinked entry points with 'packages' strategy #2130

boneskull opened this issue Dec 28, 2022 · 2 comments · Fixed by #2134
Labels
bug Functionality does not match expectation

Comments

@boneskull
Copy link
Contributor

Search terms

symlink

Expected Behavior

It should find the entry point in e.g., node_modules/foo when foo is a symlink to a package that contains a tsconfig.json and/or a typedoc.entryPoint in its package.json

Actual Behavior

TypeDoc does not find the entry point.

Steps to reproduce the bug

  1. Create package foo w/ typedoc.json containing an entry point that is a symlinked package (e.g., via npm link).
  2. Create a tsconfig.json and appropriate entry point in foo
  3. Set entryPointStrategy to packages.
  4. Run typedoc --logLevel Verbose; note that it only finds the entry point from foo.

Environment

  • Typedoc version: 0.23.23
  • TypeScript version: 4.7.4
  • Node.js version: 18.12.1
  • OS: macOS

I would be willing to open a PR to address this, but I'm of the opinion that a battle-tested external library should probably be pulled in rather than add further complexity to the current implementation. What do you think?

@boneskull boneskull added the bug Functionality does not match expectation label Dec 28, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 28, 2022

I'm of the opinion that a battle-tested external library should probably be pulled in rather than add further complexity to the current implementation

We used to depend on glob - I got rid of it when it had an open CVE due to depending on an ancient version of minimatch. I tend towards avoiding third party libraries if it's a "small" amount of code, so I'd rather go with the patch to TypeDoc's glob at this point.

@boneskull
Copy link
Contributor Author

My reasoning for using a 3p package is the test coverage and handling of edge cases, which I prioritize over often-of-dubious-impact CVEs. Anyway, I can see it from both angles, so I'll just do what you prefer here.

boneskull added a commit to boneskull/typedoc that referenced this issue Dec 29, 2022
Closes TypeStrong#2130

This adds a `followSymlinks` option to the `glob()` function, and enables it when searching for entry points.

If `true`, and a symbolic link is encountered, a stat will be taken of the symlink's target. If a dir or file, the symlink is handled like any other dir or file.  If a symbolic link itself (symlink to a symlink), we take a stat of the next until we find a dir or file, then handle it.

There is a little bit of caching to avoid extra I/O, and protection from recursive symlinks.  However, it's possible (though unlikely) that the FS could cause a "max call stack exceeded" exception.  If someone runs into this, we can change the implementation to a loop instead of a recursive function.

Apologies for blasting the `do..while`.  I love a good `do` myself, but splitting out the lambda functions make it untenable.
boneskull added a commit to appium/appium that referenced this issue Jan 4, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
boneskull added a commit to boneskull/typedoc that referenced this issue Jan 4, 2023
Closes TypeStrong#2130

This adds a `followSymlinks` option to the `glob()` function, and enables it when searching for entry points.

If `true`, and a symbolic link is encountered, a stat will be taken of the symlink's target. If a dir or file, the symlink is handled like any other dir or file.  If a symbolic link itself (symlink to a symlink), we take a stat of the next until we find a dir or file, then handle it.

There is a little bit of caching to avoid extra I/O, and protection from recursive symlinks.  However, it's possible (though unlikely) that the FS could cause a "max call stack exceeded" exception.  If someone runs into this, we can change the implementation to a loop instead of a recursive function.

Apologies for blasting the `do..while`.  I love a good `do` myself, but splitting out the lambda functions make it untenable.
boneskull added a commit to appium/appium that referenced this issue Jan 4, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
- Update peer dependencies; the other plugins must be peer deps or typedoc will be unable to auto-discover them
boneskull added a commit to appium/appium that referenced this issue Jan 5, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
- Update peer dependencies; the other plugins must be peer deps or typedoc will be unable to auto-discover them
boneskull added a commit to appium/appium that referenced this issue Jan 10, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
- Update peer dependencies; the other plugins must be peer deps or typedoc will be unable to auto-discover them
pacozaa pushed a commit to pacozaa/appium that referenced this issue Jan 13, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
- Update peer dependencies; the other plugins must be peer deps or typedoc will be unable to auto-discover them
pacozaa pushed a commit to pacozaa/appium that referenced this issue Jan 14, 2023
E2E tests are quasi-blocking on merge & release of TypeStrong/typedoc#2130; it is a huge pain to test without this.

- Adds some options to control output
- Rename `CommandsReflection` to `ExtensionReflection` due to poor granular control over the display name
- Rename the custom "kinds"; add kinds for drivers and plugins (which affects display titles)
- Remove namespace from "kinds" for same reason
- Refactors, reformatting
- Rename entry point from `plugin.ts` to `index.ts`
- Update keywords in `package.json` for auto-discovery
- Remove cruft from root `typedoc.json`
- Update `README.md`
- Update peer dependencies; the other plugins must be peer deps or typedoc will be unable to auto-discover them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants