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

Remove site and projectRoot options #693

Merged
merged 4 commits into from
Jan 9, 2023
Merged

Remove site and projectRoot options #693

merged 4 commits into from
Jan 9, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jan 6, 2023

Changes

Closes #692

Remove site and projectRoot options, in favour of injectGlobals option which is more generic (Name could be changed 🤔 ), e.g.

transform(source, {
  injectGlobals: JSON.stringify(astroConfig.site)
})

The compiler would output $$createAstro("https://astro.build"). This allows us to pass params dynamically to createAstro without leaking business logic that gets added to, e.g. Astro.site.

Further discussion on discord: https://discord.com/channels/830184174198718474/1060212452756815954/1060564993768169542

Note this change goes in hand to this Astro code: https://github.com/withastro/astro/blob/6a95790b45114e2e9fae65f513c6c9381ccdf376/packages/astro/src/runtime/server/astro-global.ts#L19-L32

Testing

Updated the test to cover this new option.

Docs

n/a

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2023

🦋 Changeset detected

Latest commit: d35f8dd

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

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Minor

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

@matthewp
Copy link
Contributor

matthewp commented Jan 6, 2023

lgtm, you'll need to create a follow-up PR relatively soon to use this new option astro.

@bluwy
Copy link
Member Author

bluwy commented Jan 9, 2023

I've created withastro/astro#5803 👍 Running the tests locally it seems to work fine.

@natemoo-re I'd love to have your eyes on this too if you have thoughts on it.

@bluwy bluwy requested a review from natemoo-re January 9, 2023 07:45
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

LGTM! Only comment is around naming, but non-blocking and I leave the final decision up to you.

cmd/astro-wasm/astro-wasm.go Outdated Show resolved Hide resolved
@bluwy bluwy merged commit 2ca86f6 into main Jan 9, 2023
@bluwy bluwy deleted the deprecate-site-and-root branch January 9, 2023 16:15
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.

Remove createAstro unused params
3 participants