-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
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! 💜 |
It's still in sync, but I will update it and ping you. |
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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".
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 🤔