feat(dynamic-import): support Astro v6 - v7 - #173
Conversation
Widen peer dep to `4 || 5 || 6` and bump the test harness (root, tests, and dynamic-import fixture) to Astro 6 + @astrojs/node 10. No source changes required — scripts now propagate via the v6 direct-render path instead of `collectedScripts`, which is kept as a harmless no-op for v4/v5.
Astro 7 dev serializes colors as hex, Astro 6 as names.
|
|
I'm working on fixing the error |
|
Fyi the last commit was 60% - 80% written by claude, but it looks good to me, I feel like I need to disclose that part. The windows failure looks unrelated to the PR, the failing test is node-websocket.test.ts => build => performs upgrade, which timed out at 511ms against the 500ms budget, that block has had since #108. The websocket fixture still runs astro 5, so with the per-fixture resolution it exercises the exact same path as the last green run. The dev variant of the same test passed in 391ms in the same job and dynamic-import itself passed 12/12 on all platforms, windows included. Would you be open to bumping that build block's timeout from 500 to 1k, matching the dev block? Happy to include it here or in a separate PR. |
|
yes, feel free to include it |
The build "performs upgrade" test timed out at 511ms against the 500ms budget on the Windows CI runner. The dev block already allows 1000ms.
standalone() calls listen() without awaiting it, so beforeAll returned before the port was bound. On Windows the first test connected, was refused, and hung: it has no onerror handler to settle the promise. That looked like a timeout, so raising the budget to 1000ms did not help. Reverted, since these tests do about 7ms of work.
|
The timeout bump didn't help, windows failed again, at 1014ms against the 1000ms budget (previously 511ms against 500ms), the timeout was never the problem, server.server.listen(port, host); // standalone.ts:27
return { server, done: server.closed() };
These are the logs that showed it: That "Server listening" line comes from I reverted the timeout to 500.
The unawaited I couldn't determine what changed to make it start failing now, CI only runs on |
|
@lilnasy as of last commit the pr is ready for you to review and merge it. |
|
Thanks, will try to take a look this week |
lilnasy
left a comment
There was a problem hiding this comment.
This looks great! I would like to exclusively support Astro 7, I'll make that change in a follow up PR before release. Thanks!
Hello, remember me?
A few months ago I asked if I could open this pr and contribute, unfortunately after a few commits I got stuck and forgot about the thing, recently I had a project that needed the package to be updated and so I remembered, in the meanwhile astro v7 got released, I also covered it in the pr.
The issue was #171.
What I did
This lets
astro-dynamic-importwork with Astro 6 and 7. The integration itself didn't need any code changes, it already works on both. What's here is the wider peer dependency range, the test harness moving to Astro 6, and the assertions loosened a bit so they pass on both 6 and 7.7 files:
packages/dynamic-import/package.json4 || 5=>4 || 5 || 6 || 7package.json^5.16.1=>^6.1.6tests/package.json@astrojs/node9 => 10, astro 5 => 6tests/fixtures/dynamic-import/package.jsontests/dynamic-import.test.tspnpm-lock.yaml.gitignore.DS_Store(MacOs junk)Supported Astro versions
Astro 7 caveats
Nothing here is a problem with the integration itself, just stuff I hit along the way:
paleturquoise=>#afeeee) while 6 keeps the name. Only the dev assertions cared, they accept either form now.tests/utils.tsimports astro directly), and moving it to 7 breaks two unrelated packages:server-only-modulesuses theastro/entrypoints/prerenderexport that 7 removed, andemotion-extractchecks a class hash that changed. Getting the whole repo onto 7 felt like its own PR, so the harness stays on 6, the newest version where the full passes.tests/package.jsonandtests/fixtures/dynamic-import/package.json,pnpm install, thenpnpm test dynamic-import.test.ts. Bumping only the harness leaves the fixture on 6 and crashes withCannot read properties of undefined (reading 'enabled'), which looks bad but is just the version skew, not the integration.Testing
pnpm test dynamic-import.test.tspasses 12/12 on Astro 6, and 12/12 on Astro 7 with the local bump from the caveats section.pnpm install --frozen-lockfilepasses too.I also ran a real Astro 7.0.6 site through both build and dev:
#afeeeeand#fff8dc)?astro&type=script)Math.random()"CMS" case