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

Add initial typescript support as well as bundling for ES & CJS #245

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

calinoracation
Copy link
Contributor

This is a slight modification to support typescript type exporting as well as publishing ES & CJS versions along with the published build. It doesn't do auto publishing or tagging mentioned in #57, but might help with figuring a few things out in that process.

// initCSSPolyfill returns true iff the host browser supports SDA
if (initCSSPolyfill()) {
return;
}

if ([...document.styleSheets].filter((s) => s.href !== null).length) {
if ([ ...document.styleSheets ].filter((s) => s.href !== null).length) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I may of had the pretty: true flag turned on momentarily that led to this autoformatting, happy to remove it.

@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "ES2020",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these might not be necessary, I was working through which ones were needed or not but starting from a point where at least it was all working for us.

@@ -25,4 +27,5 @@ export default defineConfig({
},
}
},
plugins: [dts()],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This creates the index.d.ts file for the exported type information. Without this many folks importing through a bundler with typescript would require not-insignificant amounts of changes and no typing information. It's possible to do it without another package, but it helped simplify the output quite a bit.

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.

1 participant