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

Replace UserConfig typedef with a subpath export (#3460) #3562

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

noelforte
Copy link
Contributor

This is a minimum viable patch that starts work on #3460. Notably, this change removes the requirement of maxNodeModuleJsDepth in tsconfig.json for TS packages that want to import UserConfig API, as mentioned in the mega TS issue.

Since modifying the functionality of exports, imports, and declarations will involve some cleanup, removal and renaming, further work is probably something best left to the next major release.

I've removed the @typedef comment from Eleventy.js, since adding a types subpath export makes exporting it from Eleventy's main file redundant. If backwards compatiblity is needed, then something like this will implement the fuctionality offered by the subpath export:

 /**
  * Eleventy’s programmatic API
  * @module 11ty/eleventy/Eleventy
  *
+ * This line is required for IDE autocomplete in config files
+ * @typedef {import('./UserConfig').default} UserConfig
  */

Also note, declaring ./src/UserConfig.js as a "types" export will still block it from being directly consumed (see #3460), since "." is the only pathname that has a "import/require" key. It's therefore only possible to import it as a type, either from Typescript or from JSDoc.

@noelforte noelforte requested a review from zachleat as a code owner November 26, 2024 23:10
@Ryuno-Ki
Copy link
Contributor

Ryuno-Ki commented Dec 9, 2024

LGTM (as I introduced the original JSDoc comments).

@zachleat zachleat added this to the Eleventy 3.0.1 milestone Dec 9, 2024
@zachleat zachleat merged commit f2e9f4d into 11ty:main Dec 9, 2024
11 checks passed
@zachleat
Copy link
Member

zachleat commented Dec 9, 2024

Thank you! v3.0.1-alpha.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants