这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ Any static assets, like images, can be placed in the `public/` directory if they

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :-------------------- | :------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run format` | Format codes with Prettier |
| `npm run lint:eslint` | Run Eslint |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| Command | Action |
| :------------------ | :------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run check` | Check your project for errors |
| `npm run fix` | Run Eslint and format codes with Prettier |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |

<br>

Expand Down
15 changes: 14 additions & 1 deletion src/utils/images-optimization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ImageProps extends Omit<HTMLAttributes<'img'>, 'src'> {
layout?: Layout;
widths?: number[] | null;
aspectRatio?: string | number | null;
objectPosition?: string;
}

export type ImagesOptimizer = (
Expand Down Expand Up @@ -259,7 +260,18 @@ export const unpicOptimizer: ImagesOptimizer = async (image, breakpoints, width,
/* ** */
export async function getImagesOptimized(
image: ImageMetadata | string,
{ src: _, width, height, sizes, aspectRatio, widths, layout = 'constrained', style = '', ...rest }: ImageProps,
{
src: _,
width,
height,
sizes,
aspectRatio,
objectPosition,
widths,
layout = 'constrained',
style = '',
...rest
}: ImageProps,
transform: ImagesOptimizer = () => Promise.resolve([])
): Promise<{ src: string; attributes: HTMLAttributes<'img'> }> {
if (typeof image !== 'string') {
Expand Down Expand Up @@ -315,6 +327,7 @@ export async function getImagesOptimized(
width: width,
height: height,
aspectRatio: aspectRatio,
objectPosition: objectPosition,
layout: layout,
})}${style ?? ''}`,
...rest,
Expand Down
2 changes: 1 addition & 1 deletion vendor/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default ({ config: _themeConfig = 'src/config.yaml' } = {}): AstroIntegra
const pattern = /^Sitemap:(.*)$/m;

if (!pattern.test(robotsTxt)) {
fs.appendFileSync(robotsTxtFileInOut, `${os.EOL}${os.EOL}Sitemap: ${sitemapUrl}`, {
fs.writeFileSync(robotsTxtFileInOut, `${robotsTxt}${os.EOL}${os.EOL}Sitemap: ${sitemapUrl}`, {
encoding: 'utf8',
flag: 'w',
});
Expand Down