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

chore: improve support for Workers Assets beta #406

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

Conversation

alexanderniebuhr
Copy link
Member

@alexanderniebuhr alexanderniebuhr commented Sep 27, 2024

Changes

name = ""
compatibility_date = "2024-09-19"
main = "./dist/_worker.js/index.js"
assets = { directory = "./dist/assets", binding = "ASSETS" }

Testing

  • not needed

Docs

  • needs a docs PR, will prepare one

cc @dario-piotrowicz @petebacondarwin

Copy link

changeset-bot bot commented Sep 27, 2024

🦋 Changeset detected

Latest commit: 7d5d92a

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

This PR includes changesets to release 10 packages
Name Type
@astrojs/cloudflare Minor
@test/astro-cloudflare-astro-dev-platform Patch
@test/astro-cloudflare-astro-env Patch
@test/astro-cloudflare-compile-image-service Patch
@test/astro-cloudflare-external-image-service Patch
@test/astro-cloudflare-wasm Patch
@test/astro-cloudflare-no-output Patch
@test/astro-cloudflare-routes-json Patch
@test/astro-cloudflare-with-solid-js Patch
@test/astro-cloudflare-wrangler-preview-platform Patch

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

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

This PR seems to add a new option for the user. This means that this isn't a refactor, but a real minor that requires a changeset and new tests.

@alexanderniebuhr
Copy link
Member Author

I agree with the changeset, however I'm not sure about the test, because this is still beta. So I don't want our tests to fail, just because Cloudflare changes something. I guess it would be better to have tests only added once it is stable in Cloudflare.

@ematipico
Copy link
Member

I guess it would be better to have tests only added once it is stable in Cloudflare.

Can you explain why our tests would fail? I don't see any new dependency added, so I probably miss some context. Nonetheless, I trust your judgment.

If these workers assets are beta, I suppose that even out option should be experimental.

@alexanderniebuhr
Copy link
Member Author

Fail is the wrong term here, sorry. I meant the tests would not represent the stable expectations anymore, if the platform assumptions change.

But I agree the flag should be experimental. I'll change the code.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Left a couple of suggestions (nitpicks). We have some docs before shipping this, I suppose.

.filter(Boolean)
.map((s: string) => {
const syntax = s
.replace(/\/:.*?(?=\/|$)/g, '/*')
Copy link
Member

Choose a reason for hiding this comment

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

nit: Regex created in a for loop are wasteful. They can be created in a top-level function and re-used

const syntax = s
.replace(/\/:.*?(?=\/|$)/g, '/*')
// remove query params as they are not supported by cloudflare
.replace(/\?.*$/, '');
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@alexanderniebuhr alexanderniebuhr self-assigned this Dec 13, 2024
Copy link
Member Author

@alexanderniebuhr alexanderniebuhr left a comment

Choose a reason for hiding this comment

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

Going to add some docs PR and going to address the nitpicks.

Copy link
Member Author

@alexanderniebuhr alexanderniebuhr left a comment

Choose a reason for hiding this comment

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

Going to add some docs PR and going to address the nitpicks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants