Skip to content

Prevent usage of astro:content in the client - #11827

Merged
matthewp merged 7 commits into
nextfrom
no-astro-content-in-client
Aug 27, 2024
Merged

matthewp merged 7 commits into
nextfrom
no-astro-content-in-client

Conversation

@matthewp

@matthewp matthewp commented Aug 23, 2024 •

Copy link
Copy Markdown
Contributor

Changes

  • Previously we warned users who imported it in the client, this changes that to a runtime error.

Testing

  • Hard to test given the build breaks, but willing to do so if we think it's important.

Docs

@changeset-bot

changeset-bot Bot commented Aug 23, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5747564

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) semver: major Change triggers a `major` release labels Aug 23, 2024

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR is blocked because it contains a major changeset. A reviewer will merge this at the next release if approved.

if (!contentEntryType) throw UnexpectedLookupMapError;

const { id, slug: generatedSlug } = await getContentEntryIdAndSlug({
const { id, slug: generatedSlug } = getContentEntryIdAndSlug({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is an unrelated change, but this await is on a sync function, so I removed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

string

@matthewp
matthewp marked this pull request as ready for review August 23, 2024 16:52
@matthewp
matthewp requested a review from sarah11918 August 23, 2024 16:53
Comment thread .changeset/neat-dots-hear.md Resolved
matthewp and others added 2 commits August 27, 2024 10:52
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
if(isClient) {
// Empty exports is probably enough to break the build.
// If for some reason its being imported as a side-effect ala `import 'astro:content';` then throw an error message.
virtualModContents = `export {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this really needed? I think for astro:env I just throw without returning any content

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point, removed

@matthewp
matthewp merged commit a83e362 into next Aug 27, 2024
@matthewp
matthewp deleted the no-astro-content-in-client branch August 27, 2024 20:35
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) semver: major Change triggers a `major` release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

⌂ 换网址