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

Support Astro #16659

Closed
3 of 4 tasks
kt3k opened this issue Nov 16, 2022 · 19 comments
Closed
3 of 4 tasks

Support Astro #16659

kt3k opened this issue Nov 16, 2022 · 19 comments

Comments

@kt3k
Copy link
Member

kt3k commented Nov 16, 2022

Tracking issue for supporting astro.

Known issues:

@brenelz
Copy link
Contributor

brenelz commented Nov 17, 2022

Now it gets by that error and I get the following:

Expected string at position 0
TypeError: Expected string at position 0
at createRequire (deno:ext/node/02_require.js:823:31)
at new DependencyWalker (file:https:///Users/brenelz/Desktop/denoland/deno/node_modules/.deno/[email protected]/node_modules/astro/dist/core/create-vite.js:129:20)

@kt3k
Copy link
Member Author

kt3k commented Nov 17, 2022

TypeError: Expected string at position 0

Added it to the issue list. (createRequire doesn't accept URL)

@kt3k
Copy link
Member Author

kt3k commented Dec 16, 2022

The 2nd issue disappeared. Added the 4th and 5th issues.

@brenelz
Copy link
Contributor

brenelz commented Dec 17, 2022

So I played around with it and it seems to be some kind of bug with ReadableStream. If i turn off streaming it works fine.

https://github.com/withastro/astro/blob/main/packages/astro/src/core/render/dev/environment.ts#L35

@brenelz
Copy link
Contributor

brenelz commented Dec 17, 2022

So I think the issue is it sending a 0 length UIntArray which is screwing up ReadableStream

@kt3k
Copy link
Member Author

kt3k commented Dec 27, 2022

@brenelz I looked into your fix in details, and it looked like 0 length Uint8Array is ok for ReadableStream, but it causes an issue in our server implementation (Deno.serve) #17194. I created an workaround in deno_std denoland/std#3062. Thanks for your research!

@brenelz
Copy link
Contributor

brenelz commented Dec 27, 2022

@kt3k should I close my pr then? Hopefully it at least helped put you on the right track. I would test it but not sure how to use in progress deno_std

@kt3k
Copy link
Member Author

kt3k commented Dec 27, 2022

@brenelz

I would test it but not sure how to use in progress deno_std

You can replace std/node implementation with your local one, by setting DENO_NODE_COMPAT_URL env var, like:

DENO_NODE_COMPAT_URL=file:https:///path/to/deno_std/ deno run -A --node-modules-dir npm:astro dev

You can also replace it with one in a remote branch, like:

DENO_NODE_COMPAT_URL=https://raw.githubusercontent.com/kt3k/deno_std/workaround-empty-chunk-issue/ deno run -A --node-modules-dir npm:astro dev

@brenelz
Copy link
Contributor

brenelz commented Dec 27, 2022

Works great from what I can tell. Thanks!

@kt3k
Copy link
Member Author

kt3k commented Feb 24, 2023

Now astro dev command seems working.

(The below steps work with 1.31.0)

deno run -A npm:create-astro my-app
cd my-app
deno task dev

astro build still fails with the error Relative import path "html-escaper" not prefixed with / or ./ or ../

@lilnasy
Copy link

lilnasy commented May 1, 2023

There seems to have been a regression since 1.31, there are multiple other dependencies that fail to resolve now.
Screenshot (119)

@lilnasy
Copy link

lilnasy commented May 1, 2023

Deno can run dev for an older version of Astro
Screenshot (120)

Newer versions fail in a variety of ways
Screenshot (121)
Screenshot (122)
Screenshot (123)

@bartlomieju
Copy link
Member

@lilnasy the problem you with the latest Deno version should be fixed by #18948 and will be released in Deno 1.32.2 later this week.

@lilnasy
Copy link

lilnasy commented May 1, 2023

@bartlomieju I built and ran deno from your branch, and I can cofirm those issues are gone, but there are others blocking astro support still. In particular, detecting package.json breaks module graph resolution.
Screenshot (125)
Screenshot (126)
Screenshot (127)

@bartlomieju
Copy link
Member

Thanks for the report. I will take a deeper look at Astro in the coming days.

@lilnasy
Copy link

lilnasy commented May 18, 2023

There was more progress in 1.33.4. Now seems to be blocked on createBrotliDecompress.
Screenshot (173)

@lilnasy
Copy link

lilnasy commented May 18, 2023

Thanks to @bartlomieju, astro is really close to working on deno again. The one blocker is undici, which isn't even necessary on deno, and planned for removal with node 16 EOL.

Screenshot (179)

@bartlomieju
Copy link
Member

@lilnasy thanks for keeping tabs. We did not manage to complete createBrotliDecompress for v1.33.4 but we'll try to ship it for v1.34 next week. If you find any more quirks, make sure to let me know!

@bartlomieju
Copy link
Member

With #19223 landed Astro should now work in Deno. I'm gonna close this issue, please open new issues if you hit any more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants