Using Export/ Exposing

Export and exposing pertain to the accessibility of external package definitions. When exporting, additional external package definitions become available when the package is imported, allowing their usage in various contexts. On the other hand, exposing allows access to external package definitions solely within the same package, limiting their visibility to other packages.

Export

Exporting allows the use of component definitions, variables, and other elements that are not originally part of the same package but are made accessible for use in other packages or modules when it’s imported elsewhere. By importing this package, users can utilize these exported definitions as if those were part of the same package.

Note: export can only be used with imports.
Using export
;; Inside doc-site
-- import: fastn-community.github.io/typography as tf
export: markdown, h0, h1, h2, h3
Lang:
ftd
Above code shows that certain components (markdown, h0, h1, h2, h3) from typography have been made available to use wherever doc-site is imported.

Exposing

Exposing is similar to export, except for the fact that exposed elements can only be used within the same package. They are not made available when the package is imported by another package. This means that the visibility of exposed elements is limited to the package where they are defined.

Note: exposing can be used with imports and auto-imports.
Using exposing
;; Inside doc-site
-- import: fastn-community.github.io/typography as tf
exposing: markdown, h0, h1, h2, h3
Lang:
ftd

Above code shows that certain components (markdown, h0, h1, h2, h3) from typography have been made available to use within doc-site package.

Note: These components won’t be available for external use wherever doc-site is imported.

Support fastn!

Enjoying fastn? Please consider giving us a star ⭐️ on GitHub to show your support!

Getting Help

Have a question or need help?

Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.

Join our Discord channel and share your thoughts, suggestion, question etc.

Connect with our community!

Found an issue?

If you find some issue, please visit our GitHub issues to tell us about it.

Join us

We welcome you to join our Discord community today.

We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright © 2023 - FifthTry.com