Skip to content

feat(@astrojs/netlify): add build.split support#7615

Merged
ematipico merged 12 commits intomainfrom
feat/netlify-split-support
Jul 13, 2023
Merged

feat(@astrojs/netlify): add build.split support#7615
ematipico merged 12 commits intomainfrom
feat/netlify-split-support

Conversation

@ematipico
Copy link
Member

Changes

This PR adds build.split support for the @astrojs/netlify adapter.

List of changes:

  • changed @astrojs/underscore-redirects payload to accept a Map instead of an array of routes and a dynamic target. This logically makes more sense compared to the previous logic, because a route is mapped to a dynamic target (even though we could have duplicates);
  • the changes to @astrojs/underscore-redirects allowed me to create redirects correctly using RouteData -> URL entry point
  • I added snapshot testing for netlify redirects, so we can actually see the emitted file in PRs and make sure it's correct

Testing

Added new test cases

Docs

Updated the README.md and added a changeset. It's a copy-paste from the Vercel one.

/cc @withastro/maintainers-docs for feedback!

@ematipico ematipico requested a review from a team as a code owner July 10, 2023 14:02
@changeset-bot
Copy link

changeset-bot bot commented Jul 10, 2023

🦋 Changeset detected

Latest commit: c42b3dc

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jul 10, 2023
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.

Two copy-paste names to address, otherwise, Docs is fine with this! 😄

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

LGTM. Also confirmed that changesets would auto-bump the underscore-redirects dep for the dependants on release.

'./fixtures/split-support/.netlify/functions-internal/src/pages/entry.index.astro.mjs',
import.meta.url
);
const { handler } = await import(entryURL);
Copy link
Member

Choose a reason for hiding this comment

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

The test seems to fail in windows here. using entryURL.toString() or entryURL.href should fix it I think.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it didn't work 🤔 The string should start with file:// on Windows since C:\ or D:\ looks like a protocol to node.

@ematipico ematipico force-pushed the feat/netlify-split-support branch 2 times, most recently from a35d7a5 to 6f086fd Compare July 11, 2023 10:31
@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 11, 2023
@ematipico ematipico force-pushed the feat/netlify-split-support branch from 547e70f to b3a4fcc Compare July 11, 2023 15:02
@github-actions github-actions bot removed the pkg: astro Related to the core `astro` package (scope) label Jul 11, 2023
@ematipico ematipico force-pushed the feat/netlify-split-support branch 3 times, most recently from c256547 to 235a915 Compare July 12, 2023 09:58
Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

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

Docs LGTM, great job! 🚀

@ematipico ematipico force-pushed the feat/netlify-split-support branch 5 times, most recently from b009466 to fedd0fa Compare July 12, 2023 13:42
@ematipico ematipico force-pushed the feat/netlify-split-support branch 4 times, most recently from 916564f to 3365840 Compare July 12, 2023 14:15
@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 12, 2023
@ematipico ematipico force-pushed the feat/netlify-split-support branch from 3365840 to 1d52532 Compare July 12, 2023 14:44
@github-actions github-actions bot removed the pkg: astro Related to the core `astro` package (scope) label Jul 12, 2023
@ematipico ematipico force-pushed the feat/netlify-split-support branch 2 times, most recently from 179db59 to 35491aa Compare July 12, 2023 14:50
@ematipico ematipico force-pushed the feat/netlify-split-support branch from 35491aa to c42b3dc Compare July 12, 2023 14:53
@ematipico ematipico merged commit f21357b into main Jul 13, 2023
@ematipico ematipico deleted the feat/netlify-split-support branch July 13, 2023 08:21
@astrobot-houston astrobot-houston mentioned this pull request Jul 13, 2023
ematipico added a commit that referenced this pull request Feb 6, 2025
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
ematipico added a commit that referenced this pull request Feb 7, 2025
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants