Skip to content
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

Graceful error recovery in the dev server #5198

Merged
merged 8 commits into from
Nov 1, 2022
Merged

Graceful error recovery in the dev server #5198

merged 8 commits into from
Nov 1, 2022

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Oct 26, 2022

Note that this PR is in draft mode and is not ready for review. It is intended to be tested against the current set of known HMR issues before it is marked as ready.

Changes

  • Refactors the vite-plugin-astro-server primary. This is to make it recovery from errors more easily.
  • When an error occurs during a request or during an HMR update we save the state. When another HMR update occurs (hopefully to fix it), we reset the state and refresh the browser.

Issues affected

Testing

  • Unit testing added for the plugin, both for requests and for the new error state concept.
  • Refactor for core/dev, which is meant to encompass all of what dev does. This essentially makes the dev server unit-testable without needing to start the actual dev server and send HTTP requests. You can also define .astro (or other modules) in a virtual filesystem, so no more fixture tests.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2022

🦋 Changeset detected

Latest commit: 278bb7a

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: astro Related to the core `astro` package (scope) label Oct 26, 2022
@matthewp
Copy link
Contributor Author

!preview hmr-recovery

@github-actions
Copy link
Contributor

 > [email protected] release /home/runner/work/astro/astro > pnpm run build && changeset publish "--tag" "next--hmr-recovery" > [email protected] build /home/runner/work/astro/astro > turbo run build --output-logs=new-only --no-deps --filter=astro --filter=create-astro --filter="@astrojs/*" �[2m• Packages in scope: @astrojs/alpinejs, @astrojs/cloudflare, @astrojs/deno, @astrojs/image, @astrojs/lit, @astrojs/markdown-component, @astrojs/markdown-remark, @astrojs/mdx, @astrojs/netlify, @astrojs/node, @astrojs/partytown, @astrojs/preact, @astrojs/prefetch, @astrojs/prism, @astrojs/react, @astrojs/rss, @astrojs/sitemap, @astrojs/solid-js, @astrojs/svelte, @astrojs/tailwind, @astrojs/telemetry, @astrojs/turbolinks, @astrojs/vercel, @astrojs/vue, @astrojs/webapi, astro, create-astro�[0m �[2m• Running�[0m �[2m�[1mbuild�[0m�[0m �[2min 27 packages�[0m �[2m• Remote computation caching enabled (experimental)�[0m �[35m@astrojs/webapi:build: �[0mcache hit, suppressing output �[2ma1aa15257db0e0ab�[0m �[34m@astrojs/prism:build: �[0mcache hit, suppressing output �[2mdfa66152e72352ff�[0m �[33m@astrojs/telemetry:build: �[0mcache hit, suppressing output �[2m7b49f4e26b93cefc�[0m �[36mcreate-astro:build: �[0mcache hit, suppressing output �[2m67f3698e6b5d89fd�[0m �[35m@astrojs/markdown-remark:build: �[0mcache hit, suppressing output �[2mf848b2d679d9f7cc�[0m �[32mastro:build: �[0mcache miss, executing �[2maa5f7eb91c61a669�[0m �[32mastro:build: �[0m �[32mastro:build: �[0m> [email protected] build /home/runner/work/astro/astro/packages/astro �[32mastro:build: �[0m> pnpm run prebuild && astro-scripts build "src/**/*.ts" && tsc �[32mastro:build: �[0m �[32mastro:build: �[0m �[32mastro:build: �[0m> [email protected] prebuild /home/runner/work/astro/astro/packages/astro �[32mastro:build: �[0m> astro-scripts prebuild --to-string "src/runtime/server/astro-island.ts" "src/runtime/client/{idle,load,media,only,visible}.ts" �[32mastro:build: �[0m �[33m@astrojs/alpinejs:build: �[0mcache miss, executing �[2m0549e72e0c2223b4�[0m �[35m@astrojs/turbolinks:build: �[0mcache miss, executing �[2m74376cc338939ece�[0m �[33m@astrojs/rss:build: �[0mcache miss, executing �[2m4794c4e7b5bcb606�[0m �[32m@astrojs/svelte:build: �[0mcache miss, executing �[2m296dc310aed77325�[0m �[36m@astrojs/mdx:build: �[0mcache miss, executing �[2m01984fc83a853491�[0m �[35m@astrojs/lit:build: �[0mcache miss, executing �[2m96698dc6a3b3ddd5�[0m �[36m@astrojs/partytown:build: �[0mcache miss, executing �[2m928c103761a73be0�[0m �[32m@astrojs/cloudflare:build: �[0mcache miss, executing �[2ma563aca7f9128780�[0m �[34m@astrojs/react:build: �[0mcache miss, executing �[2md616a8142f8833f5�[0m �[34m@astrojs/image:build: �[0mcache miss, executing �[2m8847005660562f20�[0m �[33m@astrojs/alpinejs:build: �[0m �[33m@astrojs/alpinejs:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/alpinejs �[33m@astrojs/alpinejs:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/alpinejs:build: �[0m �[33m@astrojs/rss:build: �[0m �[33m@astrojs/rss:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/astro-rss �[33m@astrojs/rss:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/rss:build: �[0m �[35m@astrojs/turbolinks:build: �[0m �[35m@astrojs/turbolinks:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/turbolinks �[35m@astrojs/turbolinks:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/turbolinks:build: �[0m �[32m@astrojs/svelte:build: �[0m �[32m@astrojs/svelte:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/svelte �[32m@astrojs/svelte:build: �[0m> astro-scripts build "src/index.ts" && astro-scripts build "src/editor.cts" --force-cjs --no-clean-dist && tsc �[32m@astrojs/svelte:build: �[0m �[35m@astrojs/lit:build: �[0m �[35m@astrojs/lit:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/lit �[35m@astrojs/lit:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/lit:build: �[0m �[36m@astrojs/partytown:build: �[0m �[36m@astrojs/partytown:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/partytown �[36m@astrojs/partytown:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/partytown:build: �[0m �[34m@astrojs/react:build: �[0m �[34m@astrojs/react:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/react �[34m@astrojs/react:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[34m@astrojs/react:build: �[0m �[36m@astrojs/mdx:build: �[0m �[36m@astrojs/mdx:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/mdx �[36m@astrojs/mdx:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/mdx:build: �[0m �[32m@astrojs/cloudflare:build: �[0m �[32m@astrojs/cloudflare:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/cloudflare �[32m@astrojs/cloudflare:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/cloudflare:build: �[0m �[34m@astrojs/image:build: �[0m �[34m@astrojs/image:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/image �[34m@astrojs/image:build: �[0m> astro-scripts build "src/**/*.ts" && tsc && pnpm run postbuild �[34m@astrojs/image:build: �[0m �[33m@astrojs/netlify:build: �[0mcache miss, executing �[2m7f40c2a1e53d5fd2�[0m �[34m@astrojs/prefetch:build: �[0mcache miss, executing �[2meb6a5fc0fafda544�[0m �[36m@astrojs/solid-js:build: �[0mcache miss, executing �[2m36974665c535406b�[0m �[35m@astrojs/preact:build: �[0mcache miss, executing �[2m01837b793ac6f4e1�[0m �[32m@astrojs/vercel:build: �[0mcache miss, executing �[2ma0483edae9048d4d�[0m �[33m@astrojs/netlify:build: �[0m �[33m@astrojs/netlify:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/netlify �[33m@astrojs/netlify:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/netlify:build: �[0m �[33m@astrojs/sitemap:build: �[0mcache miss, executing �[2m5beb80a6816d5935�[0m �[34m@astrojs/vue:build: �[0mcache miss, executing �[2mb052b453161c144c�[0m �[36m@astrojs/deno:build: �[0mcache miss, executing �[2mcea3c6e8652f6357�[0m �[36m@astrojs/solid-js:build: �[0m �[36m@astrojs/solid-js:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/solid �[36m@astrojs/solid-js:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/solid-js:build: �[0m �[34m@astrojs/prefetch:build: �[0m �[34m@astrojs/prefetch:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/prefetch �[34m@astrojs/prefetch:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[34m@astrojs/prefetch:build: �[0m �[35m@astrojs/preact:build: �[0m �[35m@astrojs/preact:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/preact �[35m@astrojs/preact:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/preact:build: �[0m �[32m@astrojs/vercel:build: �[0m �[32m@astrojs/vercel:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/vercel �[32m@astrojs/vercel:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/vercel:build: �[0m �[33m@astrojs/sitemap:build: �[0m �[33m@astrojs/sitemap:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/sitemap �[33m@astrojs/sitemap:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/sitemap:build: �[0m �[34m@astrojs/vue:build: �[0m �[34m@astrojs/vue:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/vue �[34m@astrojs/vue:build: �[0m> astro-scripts build "src/index.ts" && astro-scripts build "src/editor.cts" --force-cjs --no-clean-dist && tsc �[34m@astrojs/vue:build: �[0m �[36m@astrojs/deno:build: �[0m �[36m@astrojs/deno:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/deno �[36m@astrojs/deno:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/deno:build: �[0m �[35m@astrojs/node:build: �[0mcache miss, executing �[2m8397e0bb29426a0c�[0m �[35m@astrojs/node:build: �[0m �[35m@astrojs/node:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/node �[35m@astrojs/node:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/node:build: �[0m �[33m@astrojs/tailwind:build: �[0mcache miss, executing �[2m8581893532ecbd77�[0m �[33m@astrojs/tailwind:build: �[0m �[33m@astrojs/tailwind:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/tailwind �[33m@astrojs/tailwind:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/tailwind:build: �[0m �[34m@astrojs/image:build: �[0m �[34m@astrojs/image:build: �[0m> @astrojs/[email protected] postbuild /home/runner/work/astro/astro/packages/integrations/image �[34m@astrojs/image:build: �[0m> astro-scripts copy "src/**/*.wasm" �[34m@astrojs/image:build: �[0m Tasks: 26 successful, 26 total Cached: 5 cached, 26 total Time: 1m23.219s 🦋 �[33mwarn�[39m �[31m===============================IMPORTANT!===============================�[39m 🦋 �[33mwarn�[39m Packages will be released under the next--hmr-recovery tag 🦋 �[33mwarn�[39m �[31m----------------------------------------------------------------------�[39m 🦋 �[36minfo�[39m npm info astro 🦋 �[36minfo�[39m npm info @astrojs/prism 🦋 �[36minfo�[39m npm info @astrojs/rss 🦋 �[36minfo�[39m npm info create-astro 🦋 �[36minfo�[39m npm info @astrojs/alpinejs 🦋 �[36minfo�[39m npm info @astrojs/cloudflare 🦋 �[36minfo�[39m npm info @astrojs/deno 🦋 �[36minfo�[39m npm info @astrojs/image 🦋 �[36minfo�[39m npm info @astrojs/lit 🦋 �[36minfo�[39m npm info @astrojs/mdx 🦋 �[36minfo�[39m npm info @astrojs/netlify 🦋 �[36minfo�[39m npm info @astrojs/node 🦋 �[36minfo�[39m npm info @astrojs/partytown 🦋 �[36minfo�[39m npm info @astrojs/preact 🦋 �[36minfo�[39m npm info @astrojs/prefetch 🦋 �[36minfo�[39m npm info @astrojs/react 🦋 �[36minfo�[39m npm info @astrojs/sitemap 🦋 �[36minfo�[39m npm info @astrojs/solid-js 🦋 �[36minfo�[39m npm info @astrojs/svelte 🦋 �[36minfo�[39m npm info @astrojs/tailwind 🦋 �[36minfo�[39m npm info @astrojs/turbolinks 🦋 �[36minfo�[39m npm info @astrojs/vercel 🦋 �[36minfo�[39m npm info @astrojs/vue 🦋 �[36minfo�[39m npm info @astrojs/markdown-component 🦋 �[36minfo�[39m npm info @astrojs/markdown-remark 🦋 �[36minfo�[39m npm info @astrojs/telemetry 🦋 �[36minfo�[39m npm info @astrojs/webapi 🦋 �[36minfo�[39m astro is being published because our local version (0.0.0-hmr-recovery-20221026140530) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/prism is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/rss is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m create-astro is not being published because version 1.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/alpinejs is not being published because version 0.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/cloudflare is not being published because version 3.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/deno is not being published because version 1.2.0 is already published on npm 🦋 �[36minfo�[39m @astrojs/image is being published because our local version (0.0.0-hmr-recovery-20221026140530) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/lit is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/mdx is not being published because version 0.11.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/netlify is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/node is not being published because version 2.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/partytown is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/preact is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prefetch is not being published because version 0.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/react is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/sitemap is not being published because version 1.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/solid-js is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/svelte is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/tailwind is not being published because version 2.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/turbolinks is not being published because version 0.1.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vercel is not being published because version 2.3.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vue is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-component is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-remark is not being published because version 1.1.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/telemetry is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/webapi is not being published because version 1.1.0 is already published on npm 🦋 �[36minfo�[39m Publishing �[36m"astro"�[39m at �[32m"0.0.0-hmr-recovery-20221026140530"�[39m 🦋 �[36minfo�[39m Publishing �[36m"@astrojs/image"�[39m at �[32m"0.0.0-hmr-recovery-20221026140530"�[39m 🦋 �[32msuccess�[39m packages published successfully: 🦋 [email protected] 🦋 @astrojs/[email protected] 🦋 Creating git tags... 🦋 New tag: [email protected] 🦋 New tag: @astrojs/[email protected]

@natemoo-re
Copy link
Member

@matthewp No more fixture tests? That's amazing, very excited to give this a thorough review when I can!

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Looks awesome!

Very curious about the test structure here. I suppose packages/astro/test/units/** is the path of least resistance, but would it make more sense to have unit tests next to the files they are testing? Maybe that's something we can follow-up with.

Edit: Realized this is still a draft, dismissing my approval. Happy to circle back when this is ready!

packages/astro/src/core/errors.ts Outdated Show resolved Hide resolved
packages/astro/test/units/dev/dev.test.js Show resolved Hide resolved
@natemoo-re natemoo-re self-requested a review October 26, 2022 15:46
@matthewp
Copy link
Contributor Author

!preview hmr-recovery

@github-actions
Copy link
Contributor

 > [email protected] release /home/runner/work/astro/astro > pnpm run build && changeset publish "--tag" "next--hmr-recovery" > [email protected] build /home/runner/work/astro/astro > turbo run build --output-logs=new-only --no-deps --filter=astro --filter=create-astro --filter="@astrojs/*" �[2m• Packages in scope: @astrojs/alpinejs, @astrojs/cloudflare, @astrojs/deno, @astrojs/image, @astrojs/lit, @astrojs/markdown-component, @astrojs/markdown-remark, @astrojs/mdx, @astrojs/netlify, @astrojs/node, @astrojs/partytown, @astrojs/preact, @astrojs/prefetch, @astrojs/prism, @astrojs/react, @astrojs/rss, @astrojs/sitemap, @astrojs/solid-js, @astrojs/svelte, @astrojs/tailwind, @astrojs/telemetry, @astrojs/turbolinks, @astrojs/vercel, @astrojs/vue, @astrojs/webapi, astro, create-astro�[0m �[2m• Running�[0m �[2m�[1mbuild�[0m�[0m �[2min 27 packages�[0m �[2m• Remote computation caching enabled (experimental)�[0m �[35m@astrojs/webapi:build: �[0mcache hit, suppressing output �[2ma1aa15257db0e0ab�[0m �[33m@astrojs/prism:build: �[0mcache hit, suppressing output �[2mdfa66152e72352ff�[0m �[35mcreate-astro:build: �[0mcache hit, suppressing output �[2m67f3698e6b5d89fd�[0m �[34m@astrojs/telemetry:build: �[0mcache hit, suppressing output �[2m7b49f4e26b93cefc�[0m �[36m@astrojs/markdown-remark:build: �[0mcache hit, suppressing output �[2mf848b2d679d9f7cc�[0m �[32mastro:build: �[0mcache miss, executing �[2mc9928cf8c2579aa3�[0m �[32mastro:build: �[0m �[32mastro:build: �[0m> [email protected] build /home/runner/work/astro/astro/packages/astro �[32mastro:build: �[0m> pnpm run prebuild && astro-scripts build "src/**/*.ts" && tsc �[32mastro:build: �[0m �[32mastro:build: �[0m �[32mastro:build: �[0m> [email protected] prebuild /home/runner/work/astro/astro/packages/astro �[32mastro:build: �[0m> astro-scripts prebuild --to-string "src/runtime/server/astro-island.ts" "src/runtime/client/{idle,load,media,only,visible}.ts" �[32mastro:build: �[0m �[33m@astrojs/image:build: �[0mcache miss, executing �[2mb89c73743bc78880�[0m �[32m@astrojs/rss:build: �[0mcache miss, executing �[2mb3a02dc19d9803dd�[0m �[34m@astrojs/netlify:build: �[0mcache miss, executing �[2m81bf01e450834abf�[0m �[35m@astrojs/preact:build: �[0mcache miss, executing �[2m54d2716d7e321bbc�[0m �[36m@astrojs/solid-js:build: �[0mcache miss, executing �[2m0fec2d20c710255e�[0m �[36m@astrojs/deno:build: �[0mcache miss, executing �[2m9b6d59ed9e5b0c83�[0m �[34m@astrojs/mdx:build: �[0mcache miss, executing �[2m0ec748d7d2cb431b�[0m �[33m@astrojs/turbolinks:build: �[0mcache miss, executing �[2mccb66ece93ccdcf7�[0m �[35m@astrojs/vue:build: �[0mcache miss, executing �[2m57d76e301dad4636�[0m �[32m@astrojs/tailwind:build: �[0mcache miss, executing �[2mde70b703df357c9a�[0m �[33m@astrojs/image:build: �[0m �[33m@astrojs/image:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/image �[33m@astrojs/image:build: �[0m> astro-scripts build "src/**/*.ts" && tsc && pnpm run postbuild �[33m@astrojs/image:build: �[0m �[35m@astrojs/preact:build: �[0m �[35m@astrojs/preact:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/preact �[35m@astrojs/preact:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/preact:build: �[0m �[32m@astrojs/rss:build: �[0m �[32m@astrojs/rss:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/astro-rss �[32m@astrojs/rss:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/rss:build: �[0m �[34m@astrojs/netlify:build: �[0m �[34m@astrojs/netlify:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/netlify �[34m@astrojs/netlify:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[34m@astrojs/netlify:build: �[0m �[33m@astrojs/turbolinks:build: �[0m �[33m@astrojs/turbolinks:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/turbolinks �[33m@astrojs/turbolinks:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/turbolinks:build: �[0m �[36m@astrojs/deno:build: �[0m �[36m@astrojs/deno:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/deno �[36m@astrojs/deno:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/deno:build: �[0m �[34m@astrojs/mdx:build: �[0m �[34m@astrojs/mdx:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/mdx �[34m@astrojs/mdx:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[34m@astrojs/mdx:build: �[0m �[36m@astrojs/solid-js:build: �[0m �[36m@astrojs/solid-js:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/solid �[36m@astrojs/solid-js:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/solid-js:build: �[0m �[32m@astrojs/tailwind:build: �[0m �[32m@astrojs/tailwind:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/tailwind �[32m@astrojs/tailwind:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/tailwind:build: �[0m �[35m@astrojs/vue:build: �[0m �[35m@astrojs/vue:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/vue �[35m@astrojs/vue:build: �[0m> astro-scripts build "src/index.ts" && astro-scripts build "src/editor.cts" --force-cjs --no-clean-dist && tsc �[35m@astrojs/vue:build: �[0m �[33m@astrojs/react:build: �[0mcache miss, executing �[2m15301ca2a4e76534�[0m �[34m@astrojs/svelte:build: �[0mcache miss, executing �[2ma6f8e94f080fdc4d�[0m �[36m@astrojs/alpinejs:build: �[0mcache miss, executing �[2ma9c8f9a13f853bdb�[0m �[35m@astrojs/lit:build: �[0mcache miss, executing �[2mc4d9465d66aed7b5�[0m �[32m@astrojs/cloudflare:build: �[0mcache miss, executing �[2mc5a61baeb843d875�[0m �[33m@astrojs/react:build: �[0m �[33m@astrojs/react:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/react �[33m@astrojs/react:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/react:build: �[0m �[33m@astrojs/prefetch:build: �[0mcache miss, executing �[2m1e8258b7a80f1fd9�[0m �[34m@astrojs/partytown:build: �[0mcache miss, executing �[2m07eb85151fe967aa�[0m �[34m@astrojs/svelte:build: �[0m �[34m@astrojs/svelte:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/svelte �[34m@astrojs/svelte:build: �[0m> astro-scripts build "src/index.ts" && astro-scripts build "src/editor.cts" --force-cjs --no-clean-dist && tsc �[34m@astrojs/svelte:build: �[0m �[36m@astrojs/alpinejs:build: �[0m �[36m@astrojs/alpinejs:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/alpinejs �[36m@astrojs/alpinejs:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/alpinejs:build: �[0m �[36m@astrojs/vercel:build: �[0mcache miss, executing �[2mfe01f1e249566713�[0m �[35m@astrojs/lit:build: �[0m �[35m@astrojs/lit:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/lit �[35m@astrojs/lit:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/lit:build: �[0m �[32m@astrojs/cloudflare:build: �[0m �[32m@astrojs/cloudflare:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/cloudflare �[32m@astrojs/cloudflare:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/cloudflare:build: �[0m �[33m@astrojs/prefetch:build: �[0m �[33m@astrojs/prefetch:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/prefetch �[33m@astrojs/prefetch:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[33m@astrojs/prefetch:build: �[0m �[34m@astrojs/partytown:build: �[0m �[34m@astrojs/partytown:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/partytown �[34m@astrojs/partytown:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[34m@astrojs/partytown:build: �[0m �[36m@astrojs/vercel:build: �[0m �[36m@astrojs/vercel:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/vercel �[36m@astrojs/vercel:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[36m@astrojs/vercel:build: �[0m �[35m@astrojs/node:build: �[0mcache miss, executing �[2m40da052212b6ddd4�[0m �[35m@astrojs/node:build: �[0m �[35m@astrojs/node:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/node �[35m@astrojs/node:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[35m@astrojs/node:build: �[0m �[32m@astrojs/sitemap:build: �[0mcache miss, executing �[2m8e926bd041b34701�[0m �[33m@astrojs/image:build: �[0m �[33m@astrojs/image:build: �[0m> @astrojs/[email protected] postbuild /home/runner/work/astro/astro/packages/integrations/image �[33m@astrojs/image:build: �[0m> astro-scripts copy "src/**/*.wasm" �[33m@astrojs/image:build: �[0m �[32m@astrojs/sitemap:build: �[0m �[32m@astrojs/sitemap:build: �[0m> @astrojs/[email protected] build /home/runner/work/astro/astro/packages/integrations/sitemap �[32m@astrojs/sitemap:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/sitemap:build: �[0m Tasks: 26 successful, 26 total Cached: 5 cached, 26 total Time: 1m0.194s 🦋 �[33mwarn�[39m �[31m===============================IMPORTANT!===============================�[39m 🦋 �[33mwarn�[39m Packages will be released under the next--hmr-recovery tag 🦋 �[33mwarn�[39m �[31m----------------------------------------------------------------------�[39m 🦋 �[36minfo�[39m npm info astro 🦋 �[36minfo�[39m npm info @astrojs/prism 🦋 �[36minfo�[39m npm info @astrojs/rss 🦋 �[36minfo�[39m npm info create-astro 🦋 �[36minfo�[39m npm info @astrojs/alpinejs 🦋 �[36minfo�[39m npm info @astrojs/cloudflare 🦋 �[36minfo�[39m npm info @astrojs/deno 🦋 �[36minfo�[39m npm info @astrojs/image 🦋 �[36minfo�[39m npm info @astrojs/lit 🦋 �[36minfo�[39m npm info @astrojs/mdx 🦋 �[36minfo�[39m npm info @astrojs/netlify 🦋 �[36minfo�[39m npm info @astrojs/node 🦋 �[36minfo�[39m npm info @astrojs/partytown 🦋 �[36minfo�[39m npm info @astrojs/preact 🦋 �[36minfo�[39m npm info @astrojs/prefetch 🦋 �[36minfo�[39m npm info @astrojs/react 🦋 �[36minfo�[39m npm info @astrojs/sitemap 🦋 �[36minfo�[39m npm info @astrojs/solid-js 🦋 �[36minfo�[39m npm info @astrojs/svelte 🦋 �[36minfo�[39m npm info @astrojs/tailwind 🦋 �[36minfo�[39m npm info @astrojs/turbolinks 🦋 �[36minfo�[39m npm info @astrojs/vercel 🦋 �[36minfo�[39m npm info @astrojs/vue 🦋 �[36minfo�[39m npm info @astrojs/markdown-component 🦋 �[36minfo�[39m npm info @astrojs/markdown-remark 🦋 �[36minfo�[39m npm info @astrojs/telemetry 🦋 �[36minfo�[39m npm info @astrojs/webapi 🦋 �[36minfo�[39m astro is being published because our local version (0.0.0-hmr-recovery-20221027125930) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/prism is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/rss is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m create-astro is not being published because version 1.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/alpinejs is not being published because version 0.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/cloudflare is not being published because version 3.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/deno is not being published because version 1.2.0 is already published on npm 🦋 �[36minfo�[39m @astrojs/image is being published because our local version (0.0.0-hmr-recovery-20221027125930) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/lit is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/mdx is not being published because version 0.11.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/netlify is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/node is not being published because version 2.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/partytown is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/preact is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prefetch is not being published because version 0.1.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/react is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/sitemap is not being published because version 1.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/solid-js is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/svelte is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/tailwind is not being published because version 2.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/turbolinks is not being published because version 0.1.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vercel is not being published because version 2.3.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vue is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-component is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-remark is not being published because version 1.1.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/telemetry is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/webapi is not being published because version 1.1.0 is already published on npm 🦋 �[36minfo�[39m Publishing �[36m"astro"�[39m at �[32m"0.0.0-hmr-recovery-20221027125930"�[39m 🦋 �[36minfo�[39m Publishing �[36m"@astrojs/image"�[39m at �[32m"0.0.0-hmr-recovery-20221027125930"�[39m 🦋 �[32msuccess�[39m packages published successfully: 🦋 [email protected] 🦋 @astrojs/[email protected] 🦋 Creating git tags... 🦋 New tag: [email protected] 🦋 New tag: @astrojs/[email protected]

@matthewp matthewp force-pushed the server-refactor branch 4 times, most recently from 49a3f00 to cd30ef7 Compare October 27, 2022 18:53
/**
* The MIT License (MIT)
* Copyright (c) 2018 Andy Wermke
* https://github.com/andywer/typed-emitter/blob/9a139b6fa0ec6b0db6141b5b756b784e4f7ef4e4/LICENSE
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I brought this package internally because when Vite crawls through package.jsons, this one has a main but the main doesn't export anything so Vite warns about it not being a real ESM module. This is only a (small) types package, so brought it in.

@matthewp matthewp marked this pull request as ready for review October 28, 2022 15:12
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.

Looks great! With the amount of refactor for ModuleLoader, I might've gave up and mock fs directly instead 😄 But it'll be interesting to see how this plays out too.

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Looks straightforward. Nice refactors!

Copy link
Contributor

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

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

Nice! Big fan of the refactor to a loader interface for module resolution and the breakup of the dev server logic, makes for a much cleaner code base 🚀

meta?: Record<string, any>;
}

export function createLoader(overrides: Partial<ModuleLoader>): ModuleLoader {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice, I really like how the loader interface cleaned up the code flow here 👍

matthewp and others added 8 commits November 1, 2022 08:36
Move dev-container to dev

Update for the lockfile

Invalidate modules in an error state

Test invalidation of broken modules

Remove unused error state

Normalize for windows

try a larger timeout

Fixes build

just for testing

more testing

Keep it posix

fully posix
@matthewp matthewp merged commit c77a6cb into main Nov 1, 2022
@matthewp matthewp deleted the server-refactor branch November 1, 2022 12:57
@astrobot-houston astrobot-houston mentioned this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment