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

fix(*): make TypeScript realize that each plugin package has a default export #7294

Merged
merged 1 commit into from
May 3, 2022

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented May 3, 2022

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Our types setup is so weird, we sometimes run into weird issues. For example, because many packages use a handwritten d.ts file as the types entry point, TS doesn't realize there's a default export at all! This problem is not huge, because most of the time people don't directly import plugin packages, but it can be absurdly problematic if you write an enhancement plugin.

For declaration files with ambient modules, I've kept them ambient for now, but we should figure out a way to use tsconfig paths option so we don't need to hand-write module declarations; for those without any ambient modules, I simply pointed the types entry point to the compiled output. This is how any sane TS package is supposed to be structured anyways.

It's not perfect because I still didn't hand-write declarations for named exports like validateOptions, but that should be used much less frequently than the default export. This change would unblock me from writing my enhancement plugins.

These types being in the main entry point should not make them public API, though: we still retain the right to break them and change our internal data structures.

@Josh-Cena Josh-Cena added the pr: bug fix This PR fixes a bug in a past release. label May 3, 2022
@Josh-Cena Josh-Cena requested review from slorber and lex111 as code owners May 3, 2022 09:54
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 3, 2022
@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

1 similar comment
@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented May 3, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 59
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7294--docusaurus-2.netlify.app/

@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

2 similar comments
@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Josh-Cena Josh-Cena force-pushed the jc/fix-plugin-import branch from 099c646 to 11bb4fe Compare May 3, 2022 10:02
@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 099c646
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fbcf1f5fc50009bcac32
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Josh-Cena
Copy link
Collaborator Author

Hey, chill netlify bot

@netlify
Copy link

netlify bot commented May 3, 2022

[V2]

Name Link
🔨 Latest commit 11bb4fe
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6270fdd31f5fc50009bd1f29
😎 Deploy Preview https://deploy-preview-7294--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented May 3, 2022

Size Change: 0 B

Total Size: 805 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 50.5 kB
website/build/assets/css/styles.********.css 107 kB
website/build/assets/js/main.********.js 609 kB
website/build/index.html 38.8 kB

compressed-size-action

@Josh-Cena Josh-Cena merged commit a2c993b into main May 3, 2022
@Josh-Cena Josh-Cena deleted the jc/fix-plugin-import branch May 3, 2022 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants