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

feat: separating non-react specific utils and type definitions into it's own package. #2751

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ValeryG
Copy link

@ValeryG ValeryG commented Dec 10, 2024

Separation of presentation and helper code

Both elements and elements-core are presentation level specific. They depend on react and their bundles they publish have client side polyfills and references to document/window and globalThis. This makes it hard to use code exported from those packages to be used in non-react or ssr running projects.

And there is an excellent code. Eg:

  • http-spec is producing AST, but the layer that creates TableOfContent structure is backed into presentation package.
  • string definitions to decipher security section are also very helpful on it's own without being tided to react components.
  • validations and guards on AST nodes

So the idea of this PR is to introduce new package, elements-utils make it be presentation framework agnostic (no dependency on react, no browser specific code in the bundle), and move the implementation described above into this package. So essentially make it a helper on top of http-spec, and keep elements and elements-core hold presentation level.

Other Available PR Templates:

TODO:

as new package @stoplight/elements-utls is not published, there are some temperately changes introduced to prevent CI from failing. Those changes needed to be rolled back after package is published:

@ValeryG ValeryG requested a review from a team as a code owner December 10, 2024 15:05
@ValeryG ValeryG requested a review from Relionnn December 10, 2024 15:05
Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for stoplight-elements ready!

Name Link
🔨 Latest commit b11a101
🔍 Latest deploy log https://app.netlify.com/sites/stoplight-elements/deploys/675b0f90e0febf000872bd52
😎 Deploy Preview https://deploy-preview-2751--stoplight-elements.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 configuration.

Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for stoplight-elements-demo ready!

Name Link
🔨 Latest commit b11a101
🔍 Latest deploy log https://app.netlify.com/sites/stoplight-elements-demo/deploys/675b0f900d7843000868ae71
😎 Deploy Preview https://deploy-preview-2751--stoplight-elements-demo.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 configuration.

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