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

Markdoc - remove $entry variable #7244

Merged
merged 9 commits into from May 30, 2023
Merged

Markdoc - remove $entry variable #7244

merged 9 commits into from May 30, 2023

Conversation

bholmesdev
Copy link
Contributor

Changes

  • Removes the auto-generated $entry variable for Markdoc entries. This introduced a complex caching layer, leading to complex code comments and race conditions in CI during production builds.
  • Update the getRenderModule() API with additional props to expose debugging information to Markdoc (relied on the "entry" variable for these earlier)
  • Clean up getContentEntryModule() and getDataEntryModule() to align on shared logic

Testing

  • Update entry-prop.test.js to a generic variables test

Docs

  • Update Markdoc README with new instructions for frontmatter access

@bholmesdev bholmesdev requested a review from a team as a code owner May 30, 2023 17:26
@changeset-bot
Copy link

changeset-bot bot commented May 30, 2023

🦋 Changeset detected

Latest commit: 85fb722

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope) labels May 30, 2023
Comment on lines -195 to -206
/**
* There are two content collection plugins that depend on the same entry data:
* - `astro:content-imports` - creates module containing the `getCollection()` result.
* - `astro:content-render-imports` - creates module containing the `collectionEntry.render()` result.
*
* We could run the same transforms to generate the slug and parsed data in each plugin,
* though this would run the user's collection schema _twice_ for each entry.
*
* Instead, we've implemented a cache for all content entry data. To avoid race conditions,
* this may store either the module itself or a queue of promises awaiting this module.
* See the implementations of `getContentEntryModuleFromCache` and `setContentEntryModuleCache`.
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bye bye big comment 👋

throw new MarkdocError({
message: [
`**${String(entry.collection)} → ${String(entry.id)}** contains invalid content:`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The parsed collection and id are no longer passed. For simplicity, just log the file path

@sarah11918 sarah11918 removed the request for review from a team May 30, 2023 19:05
@bholmesdev bholmesdev merged commit bef3a75 into main May 30, 2023
15 checks passed
@bholmesdev bholmesdev deleted the fix/kill-entry branch May 30, 2023 20:18
@astrobot-houston astrobot-houston mentioned this pull request May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants