feat: expose middleware URL to integrations#7458
feat: expose middleware URL to integrations#7458ematipico merged 6 commits intofeat/vercel-edge-middlewarefrom
Conversation
🦋 Changeset detectedLatest commit: 5462af5 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 |
8eee9e1 to
1375192
Compare
1375192 to
c62ecfa
Compare
| if (chunk.type === 'asset') { | ||
| continue; | ||
| } | ||
| if (chunk.fileName === 'middleware.mjs') { |
There was a problem hiding this comment.
I will put this string in a shared variable in the following PRs
ElianCodes
left a comment
There was a problem hiding this comment.
Awesome! Just left a small formatting nit
| continue; | ||
| } | ||
| if (chunk.fileName === 'middleware.mjs') { | ||
| internals.middlewareEntryPoint = new URL(chunkName, opts.settings.config.outDir); |
There was a problem hiding this comment.
Should we combine outDir + "server" + chunkName here so we don't have to handle constructing the final middlewareEntryPoint again incore/build/index.ts? Otherwise this URL path would also point to a non existent path.
There was a problem hiding this comment.
Technically, at this point of the execution, the path is correct. The files are moved later. If we decided to prefix "server" here, we would create a URL that point to a file that doesn't exist. If, in the future, we decide to expose this information to a hook that is called before the files are moved, we could incur an error.
There was a problem hiding this comment.
That's fair 👍 I'm mostly concerned that the final constructed path takes a lot of work to do so, which might not be great for perf. I won't let this block the PR though, I'm also fine with this for now.
72fdbfb to
fabe9ab
Compare
d6d7076 to
7d1395a
Compare
|
Looks like there's a CI fail, but the direction is good for me. |
7d1395a to
5462af5
Compare
Changes
This is another feature towards the support of Vercel Edge Middleware.
This feature exposes the file path of the middleware file emitted during the astro build.
Testing
I extended the functionality of the test adapter and created a test that makes sure that the file exists and it has content.
Docs
I will document the new payload towards the end of the feature.