Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Improve Static Server Reliability #11

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

Draft
lilnasy wants to merge 2 commits into NuroDev:main
base: main
Choose a base branch
Loading
from lilnasy:fix-images

Conversation

Copy link

@lilnasy lilnasy commented Dec 23, 2024

Changes

  • Closes Cannot serve .webp image in mdx #4
  • Astro SSR manifest is not exactly public API. If it works it works, but if it doesn't we should use something else.
  • In this case, optimized images are not included in the "assets" list, which the adapter relied upon.
  • Updated the logic to read the client directory on server boot and use the found files instead of the assets list in the SSR manifest.

image

};
}

async function getStaticAssets(clientDir: string) {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
async function getStaticAssets(clientDir: string) {
async function getStaticAssets(clientDir: string): Promise<Set<string>> {

return client;
}

function prependForwardSlash(pth: string) {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
function prependForwardSlash(pth: string) {
function prependForwardSlash(pth: string): string {

return pth.startsWith('/') ? pth : '/' + pth;
}

function appendForwardSlash(pth: string) {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
function appendForwardSlash(pth: string) {
function appendForwardSlash(pth: string): string {

*
* Copyright of withastro/adapters contributors, Reproduced under MIT License
*/
function resolveClientDir(options: InternalOptions) {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
function resolveClientDir(options: InternalOptions) {
function resolveClientDir(options: InternalOptions): string {

const serverURLRaw = new URL(options.server);
const rel = path.relative(url.fileURLToPath(serverURLRaw), url.fileURLToPath(clientURLRaw));

// walk up the parent folders until you find the one that is the root of the server entry folder. This is how we find the client folder relatively.
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
// walk up the parent folders until you find the one that is the root of the server entry folder. This is how we find the client folder relatively.
// Walk up the parent folders until you find the one that is the root of the server entry folder. This is how we find the client folder relatively.

Copy link
Owner

NuroDev commented Dec 23, 2024

It also seems you have based this branch off of your branch used for #10 so the 2 you've put 2 PR's into 1.

Copy link
Author

lilnasy commented Jan 18, 2025
edited
Loading

Marking as draft because it depends on types being corrected in #10.

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

Reviewers

@NuroDev NuroDev NuroDev requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Cannot serve .webp image in mdx

2 participants

AltStyle によって変換されたページ (->オリジナル) /