Skip to content

docs(cloudflare): custom entryfile #11743

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexanderniebuhr
Copy link
Member

@alexanderniebuhr alexanderniebuhr commented May 22, 2025

docs for withastro/astro#13837

I'm not sure if we should a full section which explain the usage of this a bit more, or if it is enough to document the new options like I did? Also maybe the two options should be nested under one common prefix entryfile.path & entryfile.exports, however not to sure 🤔

Copy link

netlify bot commented May 22, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 8d96b18
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/682f561db4dcad000816055b
😎 Deploy Preview https://deploy-preview-11743--astro-docs-2.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 project configuration.

@astrobot-houston
Copy link
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/integrations-guide/cloudflare.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@sarah11918
Copy link
Member

Quick note @alexanderniebuhr that I was waiting on this one since there seemed to be a flurry of activity on the Astro PR, and I wanted to make sure everything shook out there first!

Is the content here still consistent with that PR? And, I know that a changeset is needed on the other PR. Please make sure to loop me in on THAT PR so I can look at the changeset, too! 💜

@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels May 26, 2025
@alexanderniebuhr
Copy link
Member Author

It's still in sync, but I will update it and ping you.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Hey @alexanderniebuhr This looks great! I think you've followed the existing models really well! 🙌

I left some tiny suggestions, plus since these things are new, they will need the <Since> component as well to say in which exact version they appeared in. (Usually this is a minor version as that's normally when new features are added, but I don't yet see a changeset for me to be able to confirm that.)

Tag me on the implementation PR when there's a changeset to review, and we'll make sure that matches what's here! 💜

**Type:** `string`
</p>

The `entryfilePath` option allows you to specify the path to a custom entry file. By default, the adapter uses a generic entry file, which only supports the `fetch` handler, but you can change it to support other [Cloudflare invocation handlers](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) as well. This is useful if you want to use e.g. Durable Objects, Cloudflare Queues, Scheduled Invocations, etc.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The `entryfilePath` option allows you to specify the path to a custom entry file. By default, the adapter uses a generic entry file, which only supports the `fetch` handler, but you can change it to support other [Cloudflare invocation handlers](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) as well. This is useful if you want to use e.g. Durable Objects, Cloudflare Queues, Scheduled Invocations, etc.
The `entryfilePath` option allows you to specify the path to a custom entry file. By default, the adapter uses a generic entry file, which only supports the `fetch` handler, but you can change it to support other [Cloudflare invocation handlers](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs). This is useful if you want to use features that require other handlers (e.g. Durable Objects, Cloudflare Queues, Scheduled Invocations).

OK, I made this up based on your wording, but is there a general way to refer to these things? I said, "feature that require other handlers" because you said the generic only supported the fetch handler. I am totally making this up.

If there is a common grouping/classification we can say here, then it's best if we can give that description, then these become examples of the description we just gave.

(Also noting that e.g. means "for example" and is a non-exhaustive list, so no need to say etc. after it! It's implied that there are more things we are not listing!)

});
```

The custom entry file must export the `createExports` function, with a `default` export including all the handlers. As an template you can use the following example:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The custom entry file must export the `createExports` function, with a `default` export including all the handlers. As an template you can use the following example:
The custom entry file must export the `createExports` function, with a `default` export including all the handlers you need. The following example entry file exports all the necessary handlers required for a custom `console.log`:

I don't love "all the handlers you need", but we need something more precise than "all the handlers" (All the handlers in the universe? What are all the handlers? How do I know what they are?) Can you make that more precise?

Also, again I made up the intro for the example. Can you do something of that style, but make it accurate for what is actually happening? (and even more descriptive than that, like "a custom console.log TO DISPLAY WHAT SPECIFICALLY" is great!)

**Type:** `string[]`
</p>

The `entryfileExports` option allows you to specify the exports from a custom entry file. By default, the adapter uses `["default"]`. If you have defined named exports in your custom entry file, you can specify them here. This is useful if you want to use e.g. Durable Objects, RPC, etc.
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above for the ending of this last sentence!


The custom entry file must export the `createExports` function, with a `default` export including all the handlers. As an template you can use the following example:

```ts title="src/worker.ts"
Copy link
Member

Choose a reason for hiding this comment

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

Are there any lines you want highlighted here? The ones about the handlers? Or, is the whole thing uniformly important?

});
```

The custom entry file must export the `createExports` function, with any named export. As an template you can use the following example:
Copy link
Member

Choose a reason for hiding this comment

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

Same comment for the sentence that introduces this example! Think of these sentences as a "The following example shows" and then explains WHAT the code is doing, rather than just saying, "one looks like this".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants