skillfullstack 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.skillsRegistry/catalog.json +231 -0
- package/AGENTS.md +89 -0
- package/README.md +210 -2
- package/bin/index.js +508 -0
- package/package.json +57 -4
- package/skills/backend/apiEngineering/SKILL.md +102 -0
- package/skills/backend/apiEngineering/evals/evalApiEngineering.py +81 -0
- package/skills/backend/apiEngineering/evals/fixtures/invalid/sampleInvalidOpenApi.json +40 -0
- package/skills/backend/apiEngineering/evals/fixtures/valid/sampleValidOpenApi.json +47 -0
- package/skills/backend/apiEngineering/policies/compatibility.md +42 -0
- package/skills/backend/apiEngineering/policies/mandatory.md +48 -0
- package/skills/backend/apiEngineering/policies/performance.md +39 -0
- package/skills/backend/apiEngineering/policies/security.md +36 -0
- package/skills/backend/apiEngineering/references/apiObservability.md +39 -0
- package/skills/backend/apiEngineering/references/apiReference.md +3 -0
- package/skills/backend/apiEngineering/references/apiSecurityOwasp.md +47 -0
- package/skills/backend/apiEngineering/references/contractCompatibility.md +26 -0
- package/skills/backend/apiEngineering/references/databaseTransactions.md +40 -0
- package/skills/backend/apiEngineering/references/distributedReliability.md +26 -0
- package/skills/backend/apiEngineering/references/multiTenancy.md +27 -0
- package/skills/backend/apiEngineering/references/openApi32Standards.md +58 -0
- package/skills/backend/apiEngineering/references/paginationVersioning.md +57 -0
- package/skills/backend/apiEngineering/references/responseStandards.md +94 -0
- package/skills/backend/apiEngineering/scripts/auditApiContract.py +123 -0
- package/skills/backend/apiEngineering/scripts/checkBreakingChanges.py +77 -0
- package/skills/backend/apiEngineering/scripts/generateResponseEnvelope.py +88 -0
- package/skills/backend/apiEngineering/templates/apiChecklist.md +27 -0
- package/skills/backend/apiEngineering/templates/openapi.yaml +125 -0
- package/skills/backend/apiEngineering/templates/problemDetails.json +44 -0
- package/skills/backend/databaseArchitecture/SKILL.md +118 -0
- package/skills/backend/databaseArchitecture/evals/evalDatabaseArchitecture.py +85 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/dangerousMigration.sql +4 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/invalidSchema.sql +23 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/safeMigration.sql +3 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/validSchema.sql +37 -0
- package/skills/backend/databaseArchitecture/policies/integrity.md +25 -0
- package/skills/backend/databaseArchitecture/policies/mandatory.md +32 -0
- package/skills/backend/databaseArchitecture/policies/migration.md +22 -0
- package/skills/backend/databaseArchitecture/policies/normalization.md +25 -0
- package/skills/backend/databaseArchitecture/policies/performance.md +26 -0
- package/skills/backend/databaseArchitecture/policies/recovery.md +23 -0
- package/skills/backend/databaseArchitecture/policies/security.md +26 -0
- package/skills/backend/databaseArchitecture/policies/tableCreationChecklist.md +70 -0
- package/skills/backend/databaseArchitecture/references/analyticsWarehousing.md +32 -0
- package/skills/backend/databaseArchitecture/references/apiReference.md +3 -0
- package/skills/backend/databaseArchitecture/references/backupDisasterRecovery.md +27 -0
- package/skills/backend/databaseArchitecture/references/dataModelingLifecycle.md +30 -0
- package/skills/backend/databaseArchitecture/references/databaseTaxonomy.md +32 -0
- package/skills/backend/databaseArchitecture/references/indexingOptimization.md +32 -0
- package/skills/backend/databaseArchitecture/references/normalizationTheory.md +61 -0
- package/skills/backend/databaseArchitecture/references/scalabilitySharding.md +37 -0
- package/skills/backend/databaseArchitecture/references/transactionConcurrency.md +39 -0
- package/skills/backend/databaseArchitecture/scripts/analyzeMigration.py +99 -0
- package/skills/backend/databaseArchitecture/scripts/auditDatabaseSchema.py +177 -0
- package/skills/backend/databaseArchitecture/scripts/inspectDatabaseIndexes.py +149 -0
- package/skills/backend/databaseArchitecture/templates/adrTemplate.md +32 -0
- package/skills/backend/databaseArchitecture/templates/databaseChecklist.md +29 -0
- package/skills/backend/databaseArchitecture/templates/migrationPlan.md +40 -0
- package/skills/backend/durableBackgroundJobs/SKILL.md +112 -0
- package/skills/backend/durableBackgroundJobs/evals/durableJobVerification.json +14 -0
- package/skills/backend/durableBackgroundJobs/references/apiReference.md +3 -0
- package/skills/backend/durableBackgroundJobs/references/durableStepPatterns.md +6 -0
- package/skills/backend/durableBackgroundJobs/references/idempotencyKeys.md +5 -0
- package/skills/backend/durableBackgroundJobs/scripts/testWorkflowDispatch.py +24 -0
- package/skills/backend/golangStandard/SKILL.md +155 -0
- package/skills/backend/golangStandard/evals/goVerification.json +14 -0
- package/skills/backend/golangStandard/references/apiReference.md +3 -0
- package/skills/backend/golangStandard/references/layoutGuide.md +26 -0
- package/skills/backend/golangStandard/references/slogPatterns.md +26 -0
- package/skills/backend/golangStandard/scripts/scaffoldGoModule.py +105 -0
- package/skills/backend/pythonStandard/SKILL.md +138 -0
- package/skills/backend/pythonStandard/evals/pythonVerification.json +14 -0
- package/skills/backend/pythonStandard/references/apiReference.md +3 -0
- package/skills/backend/pythonStandard/references/pydanticPatterns.md +16 -0
- package/skills/backend/pythonStandard/references/pyprojectSpecs.md +37 -0
- package/skills/backend/pythonStandard/scripts/scaffoldUvProject.py +79 -0
- package/skills/backend/upstash/SKILL.md +98 -0
- package/skills/backend/upstash/evals/upstashVerification.json +14 -0
- package/skills/backend/upstash/references/apiReference.md +3 -0
- package/skills/backend/upstash/references/qstashFlowControl.md +34 -0
- package/skills/backend/upstash/references/ratelimitPatterns.md +53 -0
- package/skills/backend/upstash/references/workflowPatterns.md +35 -0
- package/skills/backend/upstash/scripts/testRedisConnection.py +36 -0
- package/skills/cicdDevops/cicdPipeline/SKILL.md +148 -0
- package/skills/cicdDevops/cicdPipeline/evals/evalCicd.py +37 -0
- package/skills/cicdDevops/cicdPipeline/references/apiReference.md +3 -0
- package/skills/cicdDevops/cicdPipeline/references/cicdDeploymentPatterns.md +27 -0
- package/skills/cicdDevops/cicdPipeline/scripts/auditDockerfileSecurity.py +56 -0
- package/skills/dataAi/mcpServerDevelopment/SKILL.md +123 -0
- package/skills/dataAi/mcpServerDevelopment/evals/mcpVerification.json +14 -0
- package/skills/dataAi/mcpServerDevelopment/references/apiReference.md +3 -0
- package/skills/dataAi/mcpServerDevelopment/references/mcpClientConfigs.md +38 -0
- package/skills/dataAi/mcpServerDevelopment/references/toolSchemaDesign.md +6 -0
- package/skills/dataAi/mcpServerDevelopment/scripts/runFastMcpBoilerplate.py +36 -0
- package/skills/dataAi/ragPipelineProduction/SKILL.md +113 -0
- package/skills/dataAi/ragPipelineProduction/evals/ragVerification.json +14 -0
- package/skills/dataAi/ragPipelineProduction/references/apiReference.md +3 -0
- package/skills/dataAi/ragPipelineProduction/references/chunkingStrategies.md +10 -0
- package/skills/dataAi/ragPipelineProduction/references/rrfAlgorithm.md +13 -0
- package/skills/dataAi/ragPipelineProduction/scripts/runHybridRrfSearch.py +33 -0
- package/skills/devopsCloud/cloudflare/SKILL.md +282 -0
- package/skills/devopsCloud/cloudflare/assets/README.md +48 -0
- package/skills/devopsCloud/cloudflare/assets/ai/agents-sdk.md +118 -0
- package/skills/devopsCloud/cloudflare/assets/ai/ai-gateway.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/ai/ai-search.md +129 -0
- package/skills/devopsCloud/cloudflare/assets/ai/workers-ai.md +127 -0
- package/skills/devopsCloud/cloudflare/assets/cli/c3.md +292 -0
- package/skills/devopsCloud/cloudflare/assets/cli/cf-cli.md +90 -0
- package/skills/devopsCloud/cloudflare/assets/cli/wrangler.md +43 -0
- package/skills/devopsCloud/cloudflare/assets/compute/cron-triggers.md +486 -0
- package/skills/devopsCloud/cloudflare/assets/compute/service-bindings.md +251 -0
- package/skills/devopsCloud/cloudflare/assets/compute/smart-placement.md +435 -0
- package/skills/devopsCloud/cloudflare/assets/compute/static-assets.md +220 -0
- package/skills/devopsCloud/cloudflare/assets/compute/workers.md +129 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/d1.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/durable-objects.md +122 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/hyperdrive.md +210 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/kv.md +198 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/queues.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/r2.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/vectorize.md +97 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/workflows.md +141 -0
- package/skills/devopsCloud/cloudflare/assets/llms.txt +143 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/cache-cdn.md +109 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/dns.md +71 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/rate-limiting.md +130 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/tunnels.md +57 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/waf.md +143 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/1xxx-errors.md +209 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/5xx-errors.md +111 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/http-status-codes.md +38 -0
- package/skills/devopsCloud/cloudflare/evals/evals.json +75 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/README.md +27 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/dynamic-routing.md +15 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/features.md +22 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/sdk-integration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/troubleshooting.md +16 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/README.md +25 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/gotchas.md +13 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/bindings/README.md +16 -0
- package/skills/devopsCloud/cloudflare/references/bindings/api.md +19 -0
- package/skills/devopsCloud/cloudflare/references/bindings/configuration.md +20 -0
- package/skills/devopsCloud/cloudflare/references/bindings/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/bindings/patterns.md +20 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/README.md +18 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/api.md +12 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/configuration.md +12 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/patterns.md +12 -0
- package/skills/devopsCloud/cloudflare/references/cliComparison.md +93 -0
- package/skills/devopsCloud/cloudflare/references/containers/README.md +23 -0
- package/skills/devopsCloud/cloudflare/references/containers/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/containers/configuration.md +15 -0
- package/skills/devopsCloud/cloudflare/references/containers/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/containers/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/README.md +15 -0
- package/skills/devopsCloud/cloudflare/references/d1/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/frameworkCompatibility.md +110 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/README.md +28 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/api.md +26 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/configuration.md +34 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/gotchas.md +20 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/images/README.md +12 -0
- package/skills/devopsCloud/cloudflare/references/images/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/images/configuration.md +17 -0
- package/skills/devopsCloud/cloudflare/references/images/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/images/patterns.md +16 -0
- package/skills/devopsCloud/cloudflare/references/kv/README.md +15 -0
- package/skills/devopsCloud/cloudflare/references/kv/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/kv/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/kv/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/kv/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/patterns.md +19 -0
- package/skills/devopsCloud/cloudflare/references/observability/README.md +27 -0
- package/skills/devopsCloud/cloudflare/references/observability/api.md +20 -0
- package/skills/devopsCloud/cloudflare/references/observability/configuration.md +23 -0
- package/skills/devopsCloud/cloudflare/references/observability/gotchas.md +25 -0
- package/skills/devopsCloud/cloudflare/references/observability/patterns.md +14 -0
- package/skills/devopsCloud/cloudflare/references/pages/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/pages/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/pages/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/pages/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/pages/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/configuration.md +14 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/patterns.md +16 -0
- package/skills/devopsCloud/cloudflare/references/productSelectionMatrix.md +54 -0
- package/skills/devopsCloud/cloudflare/references/queues/README.md +24 -0
- package/skills/devopsCloud/cloudflare/references/queues/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/queues/configuration.md +20 -0
- package/skills/devopsCloud/cloudflare/references/queues/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/queues/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/r2/README.md +26 -0
- package/skills/devopsCloud/cloudflare/references/r2/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/r2/configuration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/r2/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/r2/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/api.md +21 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/configuration.md +25 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/patterns.md +27 -0
- package/skills/devopsCloud/cloudflare/references/skill-feedback.md +41 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/patterns.md +17 -0
- package/skills/devopsCloud/cloudflare/references/stream/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/stream/api-live.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/api.md +21 -0
- package/skills/devopsCloud/cloudflare/references/stream/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/patterns.md +22 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/configuration.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/api.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/configuration.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/networking.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/configuration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/patterns.md +24 -0
- package/skills/devopsCloud/cloudflare/references/waf/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/waf/api.md +17 -0
- package/skills/devopsCloud/cloudflare/references/waf/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/waf/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/waf/patterns.md +17 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/README.md +24 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/patterns.md +14 -0
- package/skills/devopsCloud/cloudflare/references/workflows/README.md +23 -0
- package/skills/devopsCloud/cloudflare/references/workflows/api.md +17 -0
- package/skills/devopsCloud/cloudflare/references/workflows/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/workflows/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/workflows/patterns.md +30 -0
- package/skills/devopsCloud/cloudflare/scripts/auditCloudflareProduction.py +95 -0
- package/skills/foundation/promptEvalTesting/SKILL.md +114 -0
- package/skills/foundation/promptEvalTesting/evals/promptEvalVerification.json +14 -0
- package/skills/foundation/promptEvalTesting/references/apiReference.md +3 -0
- package/skills/foundation/promptEvalTesting/references/evalMetricsCatalog.md +7 -0
- package/skills/foundation/promptEvalTesting/references/promptfooConfigSpecs.md +16 -0
- package/skills/foundation/promptEvalTesting/scripts/runPromptEvalSuite.py +29 -0
- package/skills/frontend/astro/SKILL.md +327 -0
- package/skills/frontend/astro/assets/README.md +71 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/content-collections.md +1061 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/data-fetching.md +109 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/images.md +719 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/markdown.md +725 -0
- package/skills/frontend/astro/assets/build-your-ui/components.md +402 -0
- package/skills/frontend/astro/assets/build-your-ui/fonts.md +437 -0
- package/skills/frontend/astro/assets/build-your-ui/front-end-frameworks.md +245 -0
- package/skills/frontend/astro/assets/build-your-ui/layouts.md +267 -0
- package/skills/frontend/astro/assets/build-your-ui/scripts-and-event-handling.md +229 -0
- package/skills/frontend/astro/assets/build-your-ui/styles-and-css.md +782 -0
- package/skills/frontend/astro/assets/build-your-ui/syntax-highlighting.md +269 -0
- package/skills/frontend/astro/assets/configuration/build-with-ai.md +389 -0
- package/skills/frontend/astro/assets/configuration/configuration-overview.md +122 -0
- package/skills/frontend/astro/assets/configuration/dev-toolbar.md +86 -0
- package/skills/frontend/astro/assets/configuration/editor-setup.md +166 -0
- package/skills/frontend/astro/assets/configuration/environment-variables.md +352 -0
- package/skills/frontend/astro/assets/configuration/typescript.md +379 -0
- package/skills/frontend/astro/assets/configuration/working-with-integrations.md +606 -0
- package/skills/frontend/astro/assets/reference/adapter-reference.md +1242 -0
- package/skills/frontend/astro/assets/reference/cli-reference.md +575 -0
- package/skills/frontend/astro/assets/reference/configuration-reference.md +3144 -0
- package/skills/frontend/astro/assets/reference/content-loader-reference.md +1682 -0
- package/skills/frontend/astro/assets/reference/directives-reference.md +324 -0
- package/skills/frontend/astro/assets/reference/image-service-reference.md +346 -0
- package/skills/frontend/astro/assets/reference/integrations-reference.md +2813 -0
- package/skills/frontend/astro/assets/reference/modules/astro-actions.md +604 -0
- package/skills/frontend/astro/assets/reference/modules/astro-app.md +460 -0
- package/skills/frontend/astro/assets/reference/modules/astro-assets.md +1657 -0
- package/skills/frontend/astro/assets/reference/modules/astro-config.md +395 -0
- package/skills/frontend/astro/assets/reference/modules/astro-content.md +720 -0
- package/skills/frontend/astro/assets/reference/modules/astro-env.md +46 -0
- package/skills/frontend/astro/assets/reference/modules/astro-fetch.md +346 -0
- package/skills/frontend/astro/assets/reference/modules/astro-hono.md +37 -0
- package/skills/frontend/astro/assets/reference/modules/astro-i18n.md +462 -0
- package/skills/frontend/astro/assets/reference/modules/astro-middleware.md +292 -0
- package/skills/frontend/astro/assets/reference/modules/astro-static-paths.md +74 -0
- package/skills/frontend/astro/assets/reference/modules/astro-transitions.md +595 -0
- package/skills/frontend/astro/assets/reference/modules/astro-zod.md +120 -0
- package/skills/frontend/astro/assets/reference/session-driver-reference.md +205 -0
- package/skills/frontend/astro/assets/routing-and-navigation/endpoints.md +251 -0
- package/skills/frontend/astro/assets/routing-and-navigation/internationalization.md +374 -0
- package/skills/frontend/astro/assets/routing-and-navigation/middleware.md +288 -0
- package/skills/frontend/astro/assets/routing-and-navigation/pages.md +205 -0
- package/skills/frontend/astro/assets/routing-and-navigation/prefetch.md +273 -0
- package/skills/frontend/astro/assets/routing-and-navigation/routing.md +760 -0
- package/skills/frontend/astro/assets/routing-and-navigation/view-transitions.md +792 -0
- package/skills/frontend/astro/assets/server-rendering/actions.md +770 -0
- package/skills/frontend/astro/assets/server-rendering/caching.md +255 -0
- package/skills/frontend/astro/assets/server-rendering/on-demand-rendering.md +289 -0
- package/skills/frontend/astro/assets/server-rendering/server-islands.md +126 -0
- package/skills/frontend/astro/assets/server-rendering/sessions.md +270 -0
- package/skills/frontend/astro/assets/start-a-new-project/develop-and-build.md +147 -0
- package/skills/frontend/astro/assets/start-a-new-project/installation.md +342 -0
- package/skills/frontend/astro/assets/start-a-new-project/project-structure.md +137 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/testing.md +412 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/troubleshooting.md +229 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/upgrade-astro.md +205 -0
- package/skills/frontend/astro/assets/welcome/courses.md +46 -0
- package/skills/frontend/astro/assets/welcome/islands-architecture.md +135 -0
- package/skills/frontend/astro/assets/welcome/why-astro.md +90 -0
- package/skills/frontend/astro/evals/evals.json +66 -0
- package/skills/frontend/astro/references/contentCollections.md +164 -0
- package/skills/frontend/astro/references/islandsArchitecture.md +128 -0
- package/skills/frontend/astro/references/serverIslandsAndActions.md +187 -0
- package/skills/frontend/astro/scripts/auditAstroProduction.py +78 -0
- package/skills/frontend/generativeUi/SKILL.md +128 -0
- package/skills/frontend/generativeUi/evals/generativeUiVerification.json +14 -0
- package/skills/frontend/generativeUi/references/apiReference.md +3 -0
- package/skills/frontend/generativeUi/references/clientToolComponentMapping.md +8 -0
- package/skills/frontend/generativeUi/references/dataStreamProtocol.md +10 -0
- package/skills/frontend/generativeUi/scripts/generateUiComponentStub.py +46 -0
- package/skills/frontend/nextjs/SKILL.md +138 -0
- package/skills/frontend/nextjs/assets/README.md +67 -0
- package/skills/frontend/nextjs/assets/api-reference/cli/create-next-app.md +210 -0
- package/skills/frontend/nextjs/assets/api-reference/cli/next.md +484 -0
- package/skills/frontend/nextjs/assets/api-reference/components/font.md +952 -0
- package/skills/frontend/nextjs/assets/api-reference/components/form.md +387 -0
- package/skills/frontend/nextjs/assets/api-reference/components/image.md +1372 -0
- package/skills/frontend/nextjs/assets/api-reference/components/link.md +954 -0
- package/skills/frontend/nextjs/assets/api-reference/components/script.md +421 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-private.md +211 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-remote.md +652 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache.md +848 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-client.md +149 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-server.md +234 -0
- package/skills/frontend/nextjs/assets/api-reference/edge-runtime.md +188 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/default.md +80 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/dynamic-routes.md +417 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/error.md +361 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/forbidden.md +75 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation-client.md +308 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation.md +177 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/intercepting-routes.md +78 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/layout.md +803 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/loading.md +209 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/mdx-components.md +84 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/app-icons.md +302 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/manifest.md +90 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/opengraph-image.md +580 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/robots.md +234 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/sitemap.md +459 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/not-found.md +278 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/page.md +283 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/parallel-routes.md +517 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/proxy.md +857 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/public-folder.md +47 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-groups.md +40 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/dynamicParams.md +40 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/ensureStatic.md +195 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/instant.md +204 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/maxDuration.md +42 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/preferredRegion.md +55 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/prefetch.md +113 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/runtime.md +43 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route.md +772 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/src-folder.md +42 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/template.md +174 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/unauthorized.md +143 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/after.md +332 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cacheLife.md +642 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cacheTag.md +272 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/catchError.md +267 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/connection.md +114 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cookies.md +349 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/draft-mode.md +173 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/fetch.md +141 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/forbidden.md +327 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-image-metadata.md +311 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-metadata.md +1510 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-sitemaps.md +102 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-static-params.md +606 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-viewport.md +347 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/headers.md +92 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/image-response.md +225 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/io.md +131 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/navigation.md +220 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-request.md +116 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-response.md +219 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-root-params.md +479 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/not-found.md +269 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/permanentRedirect.md +92 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/prefetch.md +202 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/redirect.md +255 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/refresh.md +91 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/revalidatePath.md +248 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/revalidateTag.md +175 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unauthorized.md +389 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_cache.md +131 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_noStore.md +61 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_rethrow.md +79 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/updateTag.md +173 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-link-status.md +268 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-offline.md +222 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-params.md +102 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-pathname.md +189 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-report-web-vitals.md +175 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-router.md +214 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-search-params.md +416 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segment.md +214 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segments.md +116 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-server-inserted-html.md +145 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/userAgent.md +95 -0
- package/skills/frontend/nextjs/assets/api-reference/turbopack.md +552 -0
- package/skills/frontend/nextjs/assets/architecture/accessibility.md +47 -0
- package/skills/frontend/nextjs/assets/architecture/fast-refresh.md +122 -0
- package/skills/frontend/nextjs/assets/architecture/nextjs-compiler.md +376 -0
- package/skills/frontend/nextjs/assets/architecture/supported-browsers.md +146 -0
- package/skills/frontend/nextjs/assets/community/contribution-guide.md +459 -0
- package/skills/frontend/nextjs/assets/community/rspack.md +25 -0
- package/skills/frontend/nextjs/assets/getting-started/caching.md +626 -0
- package/skills/frontend/nextjs/assets/getting-started/css.md +336 -0
- package/skills/frontend/nextjs/assets/getting-started/deploying.md +115 -0
- package/skills/frontend/nextjs/assets/getting-started/error-handling.md +485 -0
- package/skills/frontend/nextjs/assets/getting-started/fetching-data.md +743 -0
- package/skills/frontend/nextjs/assets/getting-started/fonts.md +232 -0
- package/skills/frontend/nextjs/assets/getting-started/images.md +272 -0
- package/skills/frontend/nextjs/assets/getting-started/installation.md +446 -0
- package/skills/frontend/nextjs/assets/getting-started/layouts-and-pages.md +386 -0
- package/skills/frontend/nextjs/assets/getting-started/linking-and-navigating.md +475 -0
- package/skills/frontend/nextjs/assets/getting-started/metadata-and-og-images.md +370 -0
- package/skills/frontend/nextjs/assets/getting-started/mutating-data.md +679 -0
- package/skills/frontend/nextjs/assets/getting-started/project-structure.md +290 -0
- package/skills/frontend/nextjs/assets/getting-started/proxy.md +107 -0
- package/skills/frontend/nextjs/assets/getting-started/revalidating.md +241 -0
- package/skills/frontend/nextjs/assets/getting-started/route-handlers.md +233 -0
- package/skills/frontend/nextjs/assets/getting-started/server-and-client-components.md +683 -0
- package/skills/frontend/nextjs/assets/getting-started/upgrading.md +137 -0
- package/skills/frontend/nextjs/assets/glossary.md +315 -0
- package/skills/frontend/nextjs/evals/nextjsVerification.json +14 -0
- package/skills/frontend/nextjs/references/apiReference.md +3 -0
- package/skills/frontend/nextjs/references/dataAccessLayer.md +39 -0
- package/skills/frontend/nextjs/references/nextjsFeatureMap.md +276 -0
- package/skills/frontend/nextjs/references/productionChecklist.md +49 -0
- package/skills/frontend/nextjs/references/securityHeadersCsp.md +44 -0
- package/skills/frontend/nextjs/scripts/auditProductionReadiness.py +85 -0
- package/skills/frontend/shadcn-ui/SKILL.md +102 -0
- package/skills/frontend/shadcn-ui/assets/README.md +82 -0
- package/skills/frontend/shadcn-ui/assets/advanced/javascript.md +44 -0
- package/skills/frontend/shadcn-ui/assets/advanced/monorepo.md +254 -0
- package/skills/frontend/shadcn-ui/assets/advanced/react-19.md +166 -0
- package/skills/frontend/shadcn-ui/assets/advanced/tailwind-v4.md +333 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/chain-of-thought.md +519 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/chat.md +581 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/checkpoint.md +243 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/confirmation.md +382 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/context.md +188 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/file-tree.md +248 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/index.md +307 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/inline-citation.md +219 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/message.md +298 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/model-selector.md +368 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/plan.md +398 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/prompt-input.md +403 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/queue.md +517 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/reasoning.md +349 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/sources.md +303 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/stack-trace.md +514 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/subagent.md +551 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/suggestion.md +246 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/task.md +380 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/terminal.md +463 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/test-results.md +641 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/tool.md +915 -0
- package/skills/frontend/shadcn-ui/assets/components/accordion.md +490 -0
- package/skills/frontend/shadcn-ui/assets/components/alert-dialog.md +520 -0
- package/skills/frontend/shadcn-ui/assets/components/alert.md +351 -0
- package/skills/frontend/shadcn-ui/assets/components/aspect-ratio.md +206 -0
- package/skills/frontend/shadcn-ui/assets/components/attachment.md +715 -0
- package/skills/frontend/shadcn-ui/assets/components/avatar.md +581 -0
- package/skills/frontend/shadcn-ui/assets/components/badge.md +276 -0
- package/skills/frontend/shadcn-ui/assets/components/breadcrumb.md +556 -0
- package/skills/frontend/shadcn-ui/assets/components/bubble.md +706 -0
- package/skills/frontend/shadcn-ui/assets/components/button-group.md +969 -0
- package/skills/frontend/shadcn-ui/assets/components/button.md +523 -0
- package/skills/frontend/shadcn-ui/assets/components/calendar.md +959 -0
- package/skills/frontend/shadcn-ui/assets/components/card.md +684 -0
- package/skills/frontend/shadcn-ui/assets/components/carousel.md +643 -0
- package/skills/frontend/shadcn-ui/assets/components/chart.md +1295 -0
- package/skills/frontend/shadcn-ui/assets/components/checkbox.md +553 -0
- package/skills/frontend/shadcn-ui/assets/components/code-block.md +2041 -0
- package/skills/frontend/shadcn-ui/assets/components/collapsible.md +504 -0
- package/skills/frontend/shadcn-ui/assets/components/combobox.md +1102 -0
- package/skills/frontend/shadcn-ui/assets/components/command.md +682 -0
- package/skills/frontend/shadcn-ui/assets/components/context-menu.md +949 -0
- package/skills/frontend/shadcn-ui/assets/components/data-table.md +1667 -0
- package/skills/frontend/shadcn-ui/assets/components/date-picker.md +698 -0
- package/skills/frontend/shadcn-ui/assets/components/dialog.md +454 -0
- package/skills/frontend/shadcn-ui/assets/components/direction.md +205 -0
- package/skills/frontend/shadcn-ui/assets/components/drawer.md +806 -0
- package/skills/frontend/shadcn-ui/assets/components/dropdown-menu.md +1315 -0
- package/skills/frontend/shadcn-ui/assets/components/empty.md +562 -0
- package/skills/frontend/shadcn-ui/assets/components/field.md +1321 -0
- package/skills/frontend/shadcn-ui/assets/components/hover-card.md +342 -0
- package/skills/frontend/shadcn-ui/assets/components/index.md +82 -0
- package/skills/frontend/shadcn-ui/assets/components/input-group.md +980 -0
- package/skills/frontend/shadcn-ui/assets/components/input-otp.md +551 -0
- package/skills/frontend/shadcn-ui/assets/components/input.md +555 -0
- package/skills/frontend/shadcn-ui/assets/components/item.md +937 -0
- package/skills/frontend/shadcn-ui/assets/components/kbd.md +290 -0
- package/skills/frontend/shadcn-ui/assets/components/label.md +327 -0
- package/skills/frontend/shadcn-ui/assets/components/marker.md +445 -0
- package/skills/frontend/shadcn-ui/assets/components/menubar.md +804 -0
- package/skills/frontend/shadcn-ui/assets/components/message-scroller.md +2770 -0
- package/skills/frontend/shadcn-ui/assets/components/message.md +618 -0
- package/skills/frontend/shadcn-ui/assets/components/native-select.md +321 -0
- package/skills/frontend/shadcn-ui/assets/components/navigation-menu.md +568 -0
- package/skills/frontend/shadcn-ui/assets/components/pagination.md +425 -0
- package/skills/frontend/shadcn-ui/assets/components/popover.md +402 -0
- package/skills/frontend/shadcn-ui/assets/components/progress.md +240 -0
- package/skills/frontend/shadcn-ui/assets/components/questionnaire.md +2055 -0
- package/skills/frontend/shadcn-ui/assets/components/radio-group.md +440 -0
- package/skills/frontend/shadcn-ui/assets/components/resizable.md +302 -0
- package/skills/frontend/shadcn-ui/assets/components/scroll-area.md +226 -0
- package/skills/frontend/shadcn-ui/assets/components/select.md +647 -0
- package/skills/frontend/shadcn-ui/assets/components/separator.md +235 -0
- package/skills/frontend/shadcn-ui/assets/components/sheet.md +354 -0
- package/skills/frontend/shadcn-ui/assets/components/sidebar.md +1156 -0
- package/skills/frontend/shadcn-ui/assets/components/skeleton.md +217 -0
- package/skills/frontend/shadcn-ui/assets/components/slider.md +253 -0
- package/skills/frontend/shadcn-ui/assets/components/spinner.md +352 -0
- package/skills/frontend/shadcn-ui/assets/components/switch.md +296 -0
- package/skills/frontend/shadcn-ui/assets/components/table.md +572 -0
- package/skills/frontend/shadcn-ui/assets/components/tabs.md +425 -0
- package/skills/frontend/shadcn-ui/assets/components/textarea.md +218 -0
- package/skills/frontend/shadcn-ui/assets/components/toast.md +260 -0
- package/skills/frontend/shadcn-ui/assets/components/toggle-group.md +419 -0
- package/skills/frontend/shadcn-ui/assets/components/toggle.md +220 -0
- package/skills/frontend/shadcn-ui/assets/components/tooltip.md +332 -0
- package/skills/frontend/shadcn-ui/assets/components/trace.md +1890 -0
- package/skills/frontend/shadcn-ui/assets/components/typography.md +561 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/next.md +108 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/overview.md +75 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/vite.md +144 -0
- package/skills/frontend/shadcn-ui/assets/forms/next.md +716 -0
- package/skills/frontend/shadcn-ui/assets/forms/overview.md +60 -0
- package/skills/frontend/shadcn-ui/assets/forms/react-hook-form.md +2055 -0
- package/skills/frontend/shadcn-ui/assets/forms/tanstack-form.md +2236 -0
- package/skills/frontend/shadcn-ui/assets/installation/astro.md +252 -0
- package/skills/frontend/shadcn-ui/assets/installation/manual.md +255 -0
- package/skills/frontend/shadcn-ui/assets/installation/next.md +256 -0
- package/skills/frontend/shadcn-ui/assets/installation/react-router.md +226 -0
- package/skills/frontend/shadcn-ui/assets/installation/remix.md +52 -0
- package/skills/frontend/shadcn-ui/assets/installation/vite.md +314 -0
- package/skills/frontend/shadcn-ui/assets/mcp/mcp.md +338 -0
- package/skills/frontend/shadcn-ui/assets/overview/changelog.md +6 -0
- package/skills/frontend/shadcn-ui/assets/overview/cli.md +738 -0
- package/skills/frontend/shadcn-ui/assets/overview/components-json.md +379 -0
- package/skills/frontend/shadcn-ui/assets/overview/directory.md +74 -0
- package/skills/frontend/shadcn-ui/assets/overview/introduction.md +77 -0
- package/skills/frontend/shadcn-ui/assets/overview/skills.md +71 -0
- package/skills/frontend/shadcn-ui/assets/overview/theming.md +304 -0
- package/skills/frontend/shadcn-ui/assets/overview/typeset.md +242 -0
- package/skills/frontend/shadcn-ui/assets/registry/getting-started.md +648 -0
- package/skills/frontend/shadcn-ui/assets/registry/overview.md +90 -0
- package/skills/frontend/shadcn-ui/assets/registry/registry-item-json.md +483 -0
- package/skills/frontend/shadcn-ui/assets/registry/registry-json.md +178 -0
- package/skills/frontend/shadcn-ui/evals/componentVerification.json +19 -0
- package/skills/frontend/shadcn-ui/references/aiComponentsCatalog.md +51 -0
- package/skills/frontend/shadcn-ui/references/apiReference.md +3 -0
- package/skills/frontend/shadcn-ui/references/blocksCatalog.md +32 -0
- package/skills/frontend/shadcn-ui/references/cliCommands.md +47 -0
- package/skills/frontend/shadcn-ui/references/componentMarkdownSources.md +48 -0
- package/skills/frontend/shadcn-ui/scripts/fetchComponentDocs.py +43 -0
- package/skills/frontend/tsxReactStandard/SKILL.md +150 -0
- package/skills/frontend/tsxReactStandard/evals/tsxVerification.json +14 -0
- package/skills/frontend/tsxReactStandard/references/apiReference.md +3 -0
- package/skills/frontend/tsxReactStandard/references/discriminatedUnions.md +31 -0
- package/skills/frontend/tsxReactStandard/references/tsconfigStrict.md +36 -0
- package/skills/frontend/tsxReactStandard/scripts/validateTsxTypes.py +44 -0
- package/skills/gitVersionControl/gitWorkflow/SKILL.md +128 -0
- package/skills/gitVersionControl/gitWorkflow/assets/README.md +23 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-environment.md +87 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-formatting.md +156 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-reference.md +2363 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-git.md +156 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-remote-repositories.md +65 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/associating-text-editors-with-git.md +93 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/caching-your-github-credentials.md +115 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/getting-changes-from-a-remote-repository.md +76 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/ignoring-files.md +51 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/managing-remote-repositories.md +231 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/pushing-commits-to-a-remote-repository.md +119 -0
- package/skills/gitVersionControl/gitWorkflow/evals/evalGitWorkflow.py +43 -0
- package/skills/gitVersionControl/gitWorkflow/references/apiReference.md +3 -0
- package/skills/gitVersionControl/gitWorkflow/references/branchingModels.md +32 -0
- package/skills/gitVersionControl/gitWorkflow/scripts/diagnoseGitGraph.py +68 -0
- package/skills/github/assets/README.md +39 -0
- package/skills/github/assets/cli/gh-environment.md +87 -0
- package/skills/github/assets/cli/gh-formatting.md +156 -0
- package/skills/github/assets/cli/gh-reference.md +2363 -0
- package/skills/github/assets/docs-api/github-docs-api.md +60 -0
- package/skills/github/assets/rest-api/actions-secrets.md +1272 -0
- package/skills/github/assets/rest-api/actions-variables.md +1247 -0
- package/skills/github/assets/rest-api/actions-workflow-runs.md +1697 -0
- package/skills/github/assets/rest-api/actions-workflows.md +348 -0
- package/skills/github/assets/rest-api/authenticating.md +174 -0
- package/skills/github/assets/rest-api/branches.md +727 -0
- package/skills/github/assets/rest-api/checks-runs.md +1013 -0
- package/skills/github/assets/rest-api/checks-suites.md +1142 -0
- package/skills/github/assets/rest-api/code-scanning.md +2957 -0
- package/skills/github/assets/rest-api/collaborators.md +547 -0
- package/skills/github/assets/rest-api/commits.md +957 -0
- package/skills/github/assets/rest-api/dependabot-alerts.md +895 -0
- package/skills/github/assets/rest-api/orgs.md +1172 -0
- package/skills/github/assets/rest-api/overview.md +875 -0
- package/skills/github/assets/rest-api/pull-reviews.md +722 -0
- package/skills/github/assets/rest-api/pulls.md +1605 -0
- package/skills/github/assets/rest-api/quickstart.md +344 -0
- package/skills/github/assets/rest-api/releases.md +650 -0
- package/skills/github/assets/rest-api/repos.md +2957 -0
- package/skills/github/assets/rest-api/rules.md +1507 -0
- package/skills/github/assets/rest-api/secret-scanning.md +947 -0
- package/skills/github/assets/rest-api/teams.md +1690 -0
- package/skills/github/githubAction/SKILL.md +159 -0
- package/skills/github/githubAction/assets/README.md +38 -0
- package/skills/github/githubAction/assets/reference/contexts.md +918 -0
- package/skills/github/githubAction/assets/reference/dependency-caching.md +393 -0
- package/skills/github/githubAction/assets/reference/events-that-trigger-workflows.md +1348 -0
- package/skills/github/githubAction/assets/reference/expressions.md +441 -0
- package/skills/github/githubAction/assets/reference/metadata-syntax.md +803 -0
- package/skills/github/githubAction/assets/reference/variables.md +149 -0
- package/skills/github/githubAction/assets/reference/workflow-cancellation.md +22 -0
- package/skills/github/githubAction/assets/reference/workflow-commands.md +1056 -0
- package/skills/github/githubAction/assets/reference/workflow-syntax.md +1721 -0
- package/skills/github/githubAction/assets/rest-api/secrets.md +1272 -0
- package/skills/github/githubAction/assets/rest-api/workflow-runs.md +1697 -0
- package/skills/github/githubAction/assets/rest-api/workflows.md +348 -0
- package/skills/github/githubAction/assets/starter-workflows/automation/stale.yml +27 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/blank.yml +36 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/docker-image.yml +18 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/go.yml +28 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/maven.yml +35 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/node.js.yml +31 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/python-app.yml +39 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/rust.yml +22 -0
- package/skills/github/githubAction/assets/starter-workflows/code-scanning/codeql.yml +97 -0
- package/skills/github/githubAction/evals/actionVerification.json +14 -0
- package/skills/github/githubAction/references/apiReference.md +3 -0
- package/skills/github/githubAction/references/workflowPatterns.md +81 -0
- package/skills/github/githubAction/scripts/validateWorkflowYaml.py +53 -0
- package/skills/github/githubQuality/SKILL.md +136 -0
- package/skills/github/githubQuality/assets/README.md +24 -0
- package/skills/github/githubQuality/assets/pull-requests/about-code-owners.md +178 -0
- package/skills/github/githubQuality/assets/pull-requests/about-merge-methods.md +48 -0
- package/skills/github/githubQuality/assets/pull-requests/creating-a-pull-request.md +170 -0
- package/skills/github/githubQuality/assets/pull-requests/giving-reviews.md +48 -0
- package/skills/github/githubQuality/assets/pull-requests/managing-a-merge-queue.md +134 -0
- package/skills/github/githubQuality/assets/pull-requests/merging-a-pull-request.md +101 -0
- package/skills/github/githubQuality/assets/pull-requests/resolving-reviews.md +59 -0
- package/skills/github/githubQuality/assets/pull-requests/status-checks.md +135 -0
- package/skills/github/githubQuality/assets/rest-api/checks-runs.md +1013 -0
- package/skills/github/githubQuality/assets/rest-api/checks-suites.md +1142 -0
- package/skills/github/githubQuality/assets/rest-api/commits.md +957 -0
- package/skills/github/githubQuality/assets/rest-api/pulls.md +1605 -0
- package/skills/github/githubQuality/assets/rest-api/reviews.md +722 -0
- package/skills/github/githubQuality/evals/qualityVerification.json +14 -0
- package/skills/github/githubQuality/references/apiReference.md +3 -0
- package/skills/github/githubQuality/references/codeownersExample.md +26 -0
- package/skills/github/githubQuality/references/prTemplate.md +20 -0
- package/skills/github/githubQuality/scripts/auditPrQuality.py +52 -0
- package/skills/github/githubSecurity/SKILL.md +170 -0
- package/skills/github/githubSecurity/assets/README.md +32 -0
- package/skills/github/githubSecurity/assets/code-scanning/code-scanning-alerts.md +133 -0
- package/skills/github/githubSecurity/assets/code-scanning/code-scanning.md +67 -0
- package/skills/github/githubSecurity/assets/code-scanning/codeql-code-scanning.md +79 -0
- package/skills/github/githubSecurity/assets/code-scanning/configure-code-scanning.md +121 -0
- package/skills/github/githubSecurity/assets/dependabot/about-the-dependabot-yml-file.md +74 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-alerts.md +133 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-security-updates.md +95 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-version-updates.md +80 -0
- package/skills/github/githubSecurity/assets/rest-api/code-scanning.md +2957 -0
- package/skills/github/githubSecurity/assets/rest-api/dependabot-alerts.md +895 -0
- package/skills/github/githubSecurity/assets/rest-api/secret-scanning.md +947 -0
- package/skills/github/githubSecurity/assets/secret-scanning/enable-secret-scanning.md +59 -0
- package/skills/github/githubSecurity/assets/secret-scanning/secret-scanning.md +105 -0
- package/skills/github/githubSecurity/assets/security-advisories/github-advisory-database.md +148 -0
- package/skills/github/githubSecurity/evals/securityVerification.json +14 -0
- package/skills/github/githubSecurity/references/apiReference.md +3 -0
- package/skills/github/githubSecurity/references/codeqlAnalysis.yml +42 -0
- package/skills/github/githubSecurity/references/dependabotConfig.yml +27 -0
- package/skills/github/githubSecurity/scripts/auditRepoSecurity.py +47 -0
- package/skills/github/githubSetup/SKILL.md +137 -0
- package/skills/github/githubSetup/assets/README.md +40 -0
- package/skills/github/githubSetup/assets/branches/about-protected-branches.md +198 -0
- package/skills/github/githubSetup/assets/branches/changing-the-default-branch.md +49 -0
- package/skills/github/githubSetup/assets/branches/deleting-and-restoring-branches.md +44 -0
- package/skills/github/githubSetup/assets/branches/managing-a-branch-protection-rule.md +115 -0
- package/skills/github/githubSetup/assets/branches/renaming-a-branch.md +74 -0
- package/skills/github/githubSetup/assets/branches/viewing-branches-in-your-repository.md +30 -0
- package/skills/github/githubSetup/assets/repositories/about-repositories.md +127 -0
- package/skills/github/githubSetup/assets/repositories/cloning-a-repository.md +114 -0
- package/skills/github/githubSetup/assets/repositories/creating-a-new-repository.md +82 -0
- package/skills/github/githubSetup/assets/repositories/creating-a-repository-from-a-template.md +51 -0
- package/skills/github/githubSetup/assets/repositories/deleting-a-repository.md +34 -0
- package/skills/github/githubSetup/assets/repositories/managing-teams-and-people-with-access.md +69 -0
- package/skills/github/githubSetup/assets/repositories/renaming-a-repository.md +47 -0
- package/skills/github/githubSetup/assets/repositories/restoring-a-deleted-repository.md +61 -0
- package/skills/github/githubSetup/assets/repositories/setting-repository-visibility.md +137 -0
- package/skills/github/githubSetup/assets/rest-api/branches.md +727 -0
- package/skills/github/githubSetup/assets/rest-api/quickstart.md +344 -0
- package/skills/github/githubSetup/assets/rest-api/repos.md +2957 -0
- package/skills/github/githubSetup/assets/rulesets/about-rulesets.md +72 -0
- package/skills/github/githubSetup/assets/rulesets/available-rules-for-rulesets.md +383 -0
- package/skills/github/githubSetup/assets/rulesets/converting-branch-protections-to-rulesets.md +92 -0
- package/skills/github/githubSetup/assets/rulesets/creating-rulesets-for-a-repository.md +108 -0
- package/skills/github/githubSetup/assets/rulesets/managing-rulesets-for-a-repository.md +149 -0
- package/skills/github/githubSetup/assets/rulesets/troubleshooting-rules.md +122 -0
- package/skills/github/githubSetup/evals/setupVerification.json +14 -0
- package/skills/github/githubSetup/references/apiReference.md +3 -0
- package/skills/github/githubSetup/references/repoSettingsBlueprint.md +13 -0
- package/skills/github/githubSetup/references/rulesetTemplates.json +42 -0
- package/skills/github/githubSetup/scripts/configureRepoBaseline.py +46 -0
- package/skills/github/githubTeam/SKILL.md +115 -0
- package/skills/github/githubTeam/assets/README.md +21 -0
- package/skills/github/githubTeam/assets/organizations/about-organizations.md +69 -0
- package/skills/github/githubTeam/assets/organizations/repository-roles-for-an-organization.md +94 -0
- package/skills/github/githubTeam/assets/rest-api/collaborators.md +547 -0
- package/skills/github/githubTeam/assets/rest-api/orgs.md +1172 -0
- package/skills/github/githubTeam/assets/rest-api/teams.md +1690 -0
- package/skills/github/githubTeam/assets/teams/about-teams.md +82 -0
- package/skills/github/githubTeam/assets/teams/adding-members-to-a-team.md +55 -0
- package/skills/github/githubTeam/evals/teamVerification.json +14 -0
- package/skills/github/githubTeam/references/apiReference.md +3 -0
- package/skills/github/githubTeam/references/permissionMatrix.md +17 -0
- package/skills/github/githubTeam/references/reviewAssignment.md +17 -0
- package/skills/github/githubTeam/scripts/manageTeamSync.py +31 -0
- package/skills/securityQa/llmSecurityRedteaming/SKILL.md +86 -0
- package/skills/securityQa/llmSecurityRedteaming/evals/securityRedteamVerification.json +14 -0
- package/skills/securityQa/llmSecurityRedteaming/references/apiReference.md +3 -0
- package/skills/securityQa/llmSecurityRedteaming/references/jailbreakTaxonomy.md +6 -0
- package/skills/securityQa/llmSecurityRedteaming/references/owaspLlmTopTen.md +12 -0
- package/skills/securityQa/llmSecurityRedteaming/scripts/testPromptInjection.py +34 -0
- package/skills/softwareDevelopment/requirementsEngineering/SKILL.md +110 -0
- package/skills/softwareDevelopment/requirementsEngineering/evals/evalRequirements.py +33 -0
- package/skills/softwareDevelopment/requirementsEngineering/references/apiReference.md +3 -0
- package/skills/softwareDevelopment/requirementsEngineering/references/requirementsAnalysisModels.md +34 -0
- package/skills/softwareDevelopment/requirementsEngineering/scripts/validateUserStories.py +49 -0
- package/skills/testing/testDrivenDevelopment/SKILL.md +122 -0
- package/skills/testing/testDrivenDevelopment/evals/evalTdd.py +25 -0
- package/skills/testing/testDrivenDevelopment/references/apiReference.md +3 -0
- package/skills/testing/testDrivenDevelopment/references/testPyramidDoubles.md +35 -0
- package/skills/testing/testDrivenDevelopment/scripts/auditTestPyramid.py +58 -0
|
@@ -0,0 +1,1657 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Image and Assets API Reference
|
|
3
|
+
sidebar:
|
|
4
|
+
label: 'astro:assets'
|
|
5
|
+
i18nReady: true
|
|
6
|
+
tableOfContents:
|
|
7
|
+
minHeadingLevel: 2
|
|
8
|
+
maxHeadingLevel: 3
|
|
9
|
+
---
|
|
10
|
+
import Since from '~/components/Since.astro';
|
|
11
|
+
import ReadMore from '~/components/ReadMore.astro';
|
|
12
|
+
|
|
13
|
+
<p><Since v="3.0.0" /></p>
|
|
14
|
+
|
|
15
|
+
Astro provides built-in components and helper functions for optimizing and displaying your images. For features and usage examples, [see our image guide](/en/guides/images/).
|
|
16
|
+
|
|
17
|
+
## Imports from `astro:assets`
|
|
18
|
+
|
|
19
|
+
The following helpers are imported from the virtual assets module:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import {
|
|
23
|
+
Image,
|
|
24
|
+
Picture,
|
|
25
|
+
Font,
|
|
26
|
+
getImage,
|
|
27
|
+
inferRemoteSize,
|
|
28
|
+
getConfiguredImageService,
|
|
29
|
+
imageConfig,
|
|
30
|
+
fontData,
|
|
31
|
+
experimental_getFontFileURL,
|
|
32
|
+
} from 'astro:assets';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### `<Image />`
|
|
36
|
+
|
|
37
|
+
The `<Image />` component optimizes and transforms images.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
```astro title="src/components/MyComponent.astro"
|
|
41
|
+
---
|
|
42
|
+
// import the Image component and the image
|
|
43
|
+
import { Image } from 'astro:assets';
|
|
44
|
+
import myImage from "../assets/my_image.png"; // Image is 1600x900
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<!-- `alt` is mandatory on the Image component -->
|
|
48
|
+
<Image src={myImage} alt="A description of my image." />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- Output -->
|
|
53
|
+
<!-- Image is optimized, proper attributes are enforced -->
|
|
54
|
+
<img
|
|
55
|
+
src="/_astro/my_image.hash.webp"
|
|
56
|
+
width="1600"
|
|
57
|
+
height="900"
|
|
58
|
+
decoding="async"
|
|
59
|
+
loading="lazy"
|
|
60
|
+
alt="A description of my image."
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `<Image />` component accepts the following listed properties in addition to all properties accepted by the HTML `<img>` tag.
|
|
65
|
+
|
|
66
|
+
#### `src` (required)
|
|
67
|
+
|
|
68
|
+
<p>
|
|
69
|
+
|
|
70
|
+
**Type:** <code><a href="#imagemetadata-1">ImageMetadata</a> | string | Promise\<\{ default: ImageMetadata \}\></code>
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
The format of the `src` value of your image file depends on where your image file is located:
|
|
74
|
+
|
|
75
|
+
- **Local images in `src/`** - you must **also import the image** using a relative file path or configure and use an [import alias](/en/guides/imports/#aliases). Then use the import name as the `src` value:
|
|
76
|
+
|
|
77
|
+
```astro title="src/pages/index.astro" "myImportedImage" "{myImportedImage}"
|
|
78
|
+
---
|
|
79
|
+
import { Image } from 'astro:assets';
|
|
80
|
+
import myImportedImage from '../assets/my-local-image.png';
|
|
81
|
+
---
|
|
82
|
+
<Image src={myImportedImage} alt="descriptive text" />
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- **Images in the `public/` folder** - use the image's **file path relative to the public folder**:
|
|
86
|
+
|
|
87
|
+
```astro title="src/pages/index.astro" '"/images/my-public-image.png"'
|
|
88
|
+
---
|
|
89
|
+
import { Image } from 'astro:assets';
|
|
90
|
+
---
|
|
91
|
+
<Image
|
|
92
|
+
src="/images/my-public-image.png"
|
|
93
|
+
alt="descriptive text"
|
|
94
|
+
width="200"
|
|
95
|
+
height="150"
|
|
96
|
+
/>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- **Remote images** - use the image's **full URL** as the property value:
|
|
100
|
+
|
|
101
|
+
```astro title="src/pages/index.astro" '"https://example.com/remote-image.jpg"'
|
|
102
|
+
---
|
|
103
|
+
import { Image } from 'astro:assets';
|
|
104
|
+
---
|
|
105
|
+
<Image
|
|
106
|
+
src="https://example.com/remote-image.jpg"
|
|
107
|
+
alt="descriptive text"
|
|
108
|
+
width="200"
|
|
109
|
+
height="150"
|
|
110
|
+
/>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### `alt` (required)
|
|
114
|
+
|
|
115
|
+
<p>
|
|
116
|
+
|
|
117
|
+
**Type:** `string`
|
|
118
|
+
</p>
|
|
119
|
+
|
|
120
|
+
Use the required `alt` attribute to provide a string of [descriptive alt text](https://www.w3.org/WAI/tutorials/images/) for images.
|
|
121
|
+
|
|
122
|
+
If an image is merely decorative (i.e. doesn't contribute to the understanding of the page), set `alt=""` so that screen readers and other assistive technologies know to ignore the image.
|
|
123
|
+
|
|
124
|
+
#### `width` and `height` (required for images in `public/`)
|
|
125
|
+
|
|
126
|
+
<p>
|
|
127
|
+
|
|
128
|
+
**Type:** ``number | `${number}` | undefined``
|
|
129
|
+
</p>
|
|
130
|
+
|
|
131
|
+
These properties define the dimensions to use for the image.
|
|
132
|
+
|
|
133
|
+
When a `layout` type is set, these are automatically generated based on the image's dimensions and in most cases should not be set manually.
|
|
134
|
+
|
|
135
|
+
When using images in their original aspect ratio, `width` and `height` are optional. These dimensions can be automatically inferred from image files located in `src/`. For remote images, add [the `inferSize` attribute set to `true`](#infersize) on the `<Image />` or `<Picture />` component or use [`inferRemoteSize()` function](#inferremotesize).
|
|
136
|
+
|
|
137
|
+
However, both of these properties are required for images stored in your `public/` folder as Astro is unable to analyze these files.
|
|
138
|
+
|
|
139
|
+
#### `densities`
|
|
140
|
+
|
|
141
|
+
<p>
|
|
142
|
+
|
|
143
|
+
**Type:** ``(number | `${number}x`)[] | undefined``<br />
|
|
144
|
+
<Since v="3.3.0" />
|
|
145
|
+
</p>
|
|
146
|
+
|
|
147
|
+
A list of pixel densities to generate for the image.
|
|
148
|
+
|
|
149
|
+
The `densities` attribute is not compatible with having the `layout` prop or `image.layout` config set, and will be ignored if set.
|
|
150
|
+
|
|
151
|
+
If provided, this value will be used to generate a `srcset` attribute on the `<img>` tag. Do not provide a value for `widths` when using this value.
|
|
152
|
+
|
|
153
|
+
Densities that are equal to widths larger than the original image will be ignored to avoid upscaling the image.
|
|
154
|
+
|
|
155
|
+
```astro title="src/components/MyComponent.astro"
|
|
156
|
+
---
|
|
157
|
+
import { Image } from 'astro:assets';
|
|
158
|
+
import myImage from '../assets/my_image.png';
|
|
159
|
+
---
|
|
160
|
+
<Image
|
|
161
|
+
src={myImage}
|
|
162
|
+
width={myImage.width / 2}
|
|
163
|
+
densities={[1.5, 2]}
|
|
164
|
+
alt="A description of my image."
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<!-- Output -->
|
|
170
|
+
<img
|
|
171
|
+
src="/_astro/my_image.hash.webp"
|
|
172
|
+
srcset="
|
|
173
|
+
/_astro/my_image.hash.webp 1.5x
|
|
174
|
+
/_astro/my_image.hash.webp 2x
|
|
175
|
+
"
|
|
176
|
+
alt="A description of my image."
|
|
177
|
+
width="800"
|
|
178
|
+
height="450"
|
|
179
|
+
loading="lazy"
|
|
180
|
+
decoding="async"
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### `widths`
|
|
185
|
+
|
|
186
|
+
<p>
|
|
187
|
+
|
|
188
|
+
**Type:** `number[] | undefined`<br />
|
|
189
|
+
<Since v="3.3.0" />
|
|
190
|
+
</p>
|
|
191
|
+
|
|
192
|
+
A list of widths to generate for the image.
|
|
193
|
+
|
|
194
|
+
If provided, this value will be used to generate a `srcset` attribute on the `<img>` tag. A [`sizes` property](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes) must also be provided.
|
|
195
|
+
|
|
196
|
+
The `widths` and `sizes` attributes will be automatically generated for images using a `layout` property. Providing these values is generally not needed, but can be used to override any automatically generated values.
|
|
197
|
+
|
|
198
|
+
Do not provide a value for `densities` when using this value. Only one of these two values can be used to generate a `srcset`.
|
|
199
|
+
|
|
200
|
+
Widths that are larger than the original image will be ignored to avoid upscaling the image.
|
|
201
|
+
|
|
202
|
+
```astro title="src/components/MyComponent.astro"
|
|
203
|
+
---
|
|
204
|
+
import { Image } from 'astro:assets';
|
|
205
|
+
import myImage from '../assets/my_image.png'; // Image is 1600x900
|
|
206
|
+
---
|
|
207
|
+
<Image
|
|
208
|
+
src={myImage}
|
|
209
|
+
widths={[240, 540, 720, myImage.width]}
|
|
210
|
+
sizes={`(max-width: 360px) 240px, (max-width: 720px) 540px, (max-width: 1600px) 720px, ${myImage.width}px`}
|
|
211
|
+
alt="A description of my image."
|
|
212
|
+
/>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<!-- Output -->
|
|
217
|
+
<img
|
|
218
|
+
src="/_astro/my_image.hash.webp"
|
|
219
|
+
srcset="
|
|
220
|
+
/_astro/my_image.hash.webp 240w,
|
|
221
|
+
/_astro/my_image.hash.webp 540w,
|
|
222
|
+
/_astro/my_image.hash.webp 720w,
|
|
223
|
+
/_astro/my_image.hash.webp 1600w
|
|
224
|
+
"
|
|
225
|
+
sizes="
|
|
226
|
+
(max-width: 360px) 240px,
|
|
227
|
+
(max-width: 720px) 540px,
|
|
228
|
+
(max-width: 1600px) 720px,
|
|
229
|
+
1600px
|
|
230
|
+
"
|
|
231
|
+
alt="A description of my image."
|
|
232
|
+
width="1600"
|
|
233
|
+
height="900"
|
|
234
|
+
loading="lazy"
|
|
235
|
+
decoding="async"
|
|
236
|
+
/>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### `sizes`
|
|
240
|
+
|
|
241
|
+
<p>
|
|
242
|
+
|
|
243
|
+
**Type:** `string | undefined`<br />
|
|
244
|
+
<Since v="3.3.0" />
|
|
245
|
+
</p>
|
|
246
|
+
|
|
247
|
+
Specifies the layout width of the image for each of a list of media conditions. Must be provided when specifying `widths`.
|
|
248
|
+
|
|
249
|
+
The `widths` and `sizes` attributes will be automatically generated for images using a `layout` property. Providing these values is generally not needed, but can be used to override any automatically generated values.
|
|
250
|
+
|
|
251
|
+
The generated `sizes` attribute for `constrained` and `full-width` images is based on the assumption that the image is displayed close to the full width of the screen when the viewport is smaller than the image's width. If it is significantly different (e.g. if it's in a multi-column layout on small screens), you may need to adjust the `sizes` attribute manually for best results.
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
#### `format`
|
|
255
|
+
|
|
256
|
+
<p>
|
|
257
|
+
|
|
258
|
+
**Type:** <code><a href="#imageoutputformat">ImageOutputFormat</a> | undefined</code>
|
|
259
|
+
</p>
|
|
260
|
+
|
|
261
|
+
You can optionally state the [image file type](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#common_image_file_types) output to be used.
|
|
262
|
+
|
|
263
|
+
By default, the `<Image />` component will produce a `.webp` file.
|
|
264
|
+
|
|
265
|
+
#### `quality`
|
|
266
|
+
|
|
267
|
+
<p>
|
|
268
|
+
|
|
269
|
+
**Type:** <code><a href="#imagequality">ImageQuality</a> | undefined</code>
|
|
270
|
+
</p>
|
|
271
|
+
|
|
272
|
+
`quality` is an optional property that can either be:
|
|
273
|
+
- a preset (`low`, `mid`, `high`, `max`) that is automatically normalized between formats.
|
|
274
|
+
- a number from `0` to `100` (interpreted differently between formats).
|
|
275
|
+
|
|
276
|
+
#### `inferSize`
|
|
277
|
+
|
|
278
|
+
<p>
|
|
279
|
+
|
|
280
|
+
**Type:** `boolean`<br />
|
|
281
|
+
**Default:** `false`<br />
|
|
282
|
+
<Since v="4.4.0" />
|
|
283
|
+
</p>
|
|
284
|
+
|
|
285
|
+
Allows you to set the original `width` and `height` of a remote image automatically.
|
|
286
|
+
|
|
287
|
+
By default, this value is set to `false` and you must manually specify both dimensions for your remote image.
|
|
288
|
+
|
|
289
|
+
Add `inferSize` to the `<Image />` component (or `inferSize: true` to `getImage()`) to infer these values from the image content when fetched. This is helpful if you don't know the dimensions of the remote image, or if they might change:
|
|
290
|
+
|
|
291
|
+
```astro title="src/components/MyComponent.astro" "inferSize"
|
|
292
|
+
---
|
|
293
|
+
import { Image } from 'astro:assets';
|
|
294
|
+
---
|
|
295
|
+
<Image src="https://example.com/cat.png" inferSize alt="A cat sleeping in the sun." />
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
As of Astro 5.17.3, `inferSize` only fetches dimensions for [authorized remote image domains](/en/guides/images/#authorizing-remote-images). Remote images outside the allowlist are not fetched.
|
|
299
|
+
|
|
300
|
+
#### `priority`
|
|
301
|
+
|
|
302
|
+
<p>
|
|
303
|
+
|
|
304
|
+
**Type:** `boolean`<br />
|
|
305
|
+
**Default:** `false`<br />
|
|
306
|
+
<Since v="5.10.0" />
|
|
307
|
+
</p>
|
|
308
|
+
|
|
309
|
+
Allows you to automatically set the `loading`, `decoding`, and `fetchpriority` attributes to their optimal values for above-the-fold images.
|
|
310
|
+
|
|
311
|
+
```astro title="src/components/MyComponent.astro" "priority"
|
|
312
|
+
---
|
|
313
|
+
import { Image } from 'astro:assets';
|
|
314
|
+
import myImage from '../assets/my_image.png';
|
|
315
|
+
---
|
|
316
|
+
<Image src={myImage} priority alt="A description of my image" />
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
When `priority="true"` (or the shorthand syntax `priority`) is added to the `<Image />` or `<Picture />` component, it will add the following attributes to instruct the browser to load the image immediately:
|
|
320
|
+
|
|
321
|
+
```html
|
|
322
|
+
loading="eager"
|
|
323
|
+
decoding="sync"
|
|
324
|
+
fetchpriority="high"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
These individual attributes can still be set manually if you need to customize them further.
|
|
328
|
+
|
|
329
|
+
#### `layout`
|
|
330
|
+
|
|
331
|
+
<p>
|
|
332
|
+
|
|
333
|
+
**Type:** `'constrained' | 'full-width' | 'fixed' | 'none'` <br />
|
|
334
|
+
**Default:** `image.layout | 'none'` <br />
|
|
335
|
+
<Since v="5.10.0" />
|
|
336
|
+
</p>
|
|
337
|
+
|
|
338
|
+
Determines how the image should resize when its container changes size. Can be used to override the default configured value for [`image.layout`](/en/reference/configuration-reference/#imagelayout).
|
|
339
|
+
|
|
340
|
+
```astro title=MyComponent.astro
|
|
341
|
+
---
|
|
342
|
+
import { Image } from 'astro:assets';
|
|
343
|
+
import myImage from '../assets/my_image.png';
|
|
344
|
+
---
|
|
345
|
+
<Image src={myImage} alt="A description of my image." layout='constrained' width={800} height={600} />
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
When a layout is set, `srcset` and `sizes` attributes are automatically generated based on the image's dimensions and the layout type. The previous `<Image />` component will generate the following HTML output:
|
|
349
|
+
|
|
350
|
+
```html
|
|
351
|
+
<img
|
|
352
|
+
src="/_astro/my_image.hash3.webp"
|
|
353
|
+
srcset="/_astro/my_image.hash1.webp 640w,
|
|
354
|
+
/_astro/my_image.hash2.webp 750w,
|
|
355
|
+
/_astro/my_image.hash3.webp 800w,
|
|
356
|
+
/_astro/my_image.hash4.webp 828w,
|
|
357
|
+
/_astro/my_image.hash5.webp 1080w,
|
|
358
|
+
/_astro/my_image.hash6.webp 1280w,
|
|
359
|
+
/_astro/my_image.hash7.webp 1600w"
|
|
360
|
+
alt="A description of my image"
|
|
361
|
+
sizes="(min-width: 800px) 800px, 100vw"
|
|
362
|
+
loading="lazy"
|
|
363
|
+
decoding="async"
|
|
364
|
+
fetchpriority="auto"
|
|
365
|
+
width="800"
|
|
366
|
+
height="600"
|
|
367
|
+
style="--fit: cover; --pos: center;"
|
|
368
|
+
data-astro-image="constrained"
|
|
369
|
+
>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
`layout` supports the following values:
|
|
373
|
+
|
|
374
|
+
- `constrained` - The image will scale down to fit the container, maintaining its aspect ratio, but will not scale up beyond the specified `width` and `height`, or the image's original dimensions.
|
|
375
|
+
|
|
376
|
+
Use this if you want the image to display at the requested size where possible, but shrink to fit smaller screens. This matches the default behavior for images when using Tailwind. If you're not sure, this is probably the layout you should choose.
|
|
377
|
+
|
|
378
|
+
- `full-width` - The image will scale to fit the width of the container, maintaining its aspect ratio.
|
|
379
|
+
|
|
380
|
+
Use this for hero images or other images that should take up the full width of the page.
|
|
381
|
+
|
|
382
|
+
- `fixed` - The image will maintain the requested dimensions and not resize. It will generate a `srcset` to support high density displays, but not for different screen sizes.
|
|
383
|
+
|
|
384
|
+
Use this if the image will not resize, for example icons or logos smaller than any screen width, or other images in a fixed-width container.
|
|
385
|
+
|
|
386
|
+
- `none` - The image will not be responsive. No `srcset` or `sizes` will be automatically generated, and no styles will be applied.
|
|
387
|
+
|
|
388
|
+
This is useful if you have enabled a default layout, but want to disable it for a specific image.
|
|
389
|
+
|
|
390
|
+
For example, with `constrained` set as the default layout, you can override any individual image's `layout` property:
|
|
391
|
+
|
|
392
|
+
```astro title="src/components/MyComponent.astro"
|
|
393
|
+
---
|
|
394
|
+
import { Image } from 'astro:assets';
|
|
395
|
+
import myImage from '../assets/my_image.png';
|
|
396
|
+
---
|
|
397
|
+
<Image src={myImage} alt="This will use constrained layout" width={800} height={600} />
|
|
398
|
+
<Image src={myImage} alt="This will use full-width layout" layout="full-width" />
|
|
399
|
+
<Image src={myImage} alt="This will disable responsive images" layout="none" />
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
The value for `layout` also defines the default styles applied to the `<img>` tag to determine how the image should resize according to its container:
|
|
403
|
+
|
|
404
|
+
```css title="Responsive Image Styles"
|
|
405
|
+
:where([data-astro-image]) {
|
|
406
|
+
object-fit: var(--fit);
|
|
407
|
+
object-position: var(--pos);
|
|
408
|
+
}
|
|
409
|
+
:where([data-astro-image='full-width']) {
|
|
410
|
+
width: 100%;
|
|
411
|
+
}
|
|
412
|
+
:where([data-astro-image='constrained']) {
|
|
413
|
+
max-width: 100%;
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### `fit`
|
|
418
|
+
|
|
419
|
+
<p>
|
|
420
|
+
|
|
421
|
+
**Type:** `'contain' | 'cover' | 'fill' | 'none' | 'scale-down'` <br />
|
|
422
|
+
**Default:** `image.objectFit | 'cover'` <br />
|
|
423
|
+
<Since v="5.10.0" />
|
|
424
|
+
</p>
|
|
425
|
+
|
|
426
|
+
Defines how an image should be cropped if its aspect ratio is changed.
|
|
427
|
+
|
|
428
|
+
Values match those of CSS `object-fit`. Defaults to `cover`, or the value of [`image.objectFit`](/en/reference/configuration-reference/#imageobjectfit) if set. Can be used to override the default `object-fit` styles.
|
|
429
|
+
|
|
430
|
+
#### `position`
|
|
431
|
+
|
|
432
|
+
<p>
|
|
433
|
+
|
|
434
|
+
**Type:** `string` <br />
|
|
435
|
+
**Default:** `image.objectPosition | 'center'` <br />
|
|
436
|
+
<Since v="5.10.0" />
|
|
437
|
+
</p>
|
|
438
|
+
|
|
439
|
+
Defines the position of the image crop for an image if the aspect ratio is changed.
|
|
440
|
+
|
|
441
|
+
Values match those of CSS `object-position`. Defaults to `center`, or the value of [`image.objectPosition`](/en/reference/configuration-reference/#imageobjectposition) if set. Can be used to override the default `object-position` styles.
|
|
442
|
+
|
|
443
|
+
#### `background`
|
|
444
|
+
|
|
445
|
+
<p>
|
|
446
|
+
|
|
447
|
+
**Type:** `string | undefined`<br />
|
|
448
|
+
<Since v="5.17.0" />
|
|
449
|
+
</p>
|
|
450
|
+
|
|
451
|
+
The background color to use when flattening an image to transform it into the requested output `format`.
|
|
452
|
+
|
|
453
|
+
By default, Sharp uses a black background when flattening an image. Specifying a different background color is especially useful when transforming images with transparent backgrounds to a format that does not support transparency (e.g. `.jpeg`):
|
|
454
|
+
|
|
455
|
+
```astro title="src/components/MyComponent.astro" "background"
|
|
456
|
+
---
|
|
457
|
+
import { Image } from 'astro:assets';
|
|
458
|
+
import myImage from '../assets/my_image.png';
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
<Image
|
|
462
|
+
src={myImage}
|
|
463
|
+
alt="A description of my image"
|
|
464
|
+
format="jpeg"
|
|
465
|
+
background="#ffffff"
|
|
466
|
+
/>
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Values are passed directly to the image service. Sharp accepts [any value the `color-string` package can parse](https://github.com/Qix-/color-string/blob/master/README.md#parsing).
|
|
470
|
+
|
|
471
|
+
### `<Picture />`
|
|
472
|
+
|
|
473
|
+
<p><Since v="3.3.0" /></p>
|
|
474
|
+
|
|
475
|
+
The `<Picture />` component generates an optimized image with multiple formats and/or sizes.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
```astro title="src/pages/index.astro"
|
|
479
|
+
---
|
|
480
|
+
import { Picture } from 'astro:assets';
|
|
481
|
+
import myImage from "../assets/my_image.png"; // Image is 1600x900
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
<!-- `alt` is mandatory on the Picture component -->
|
|
485
|
+
<Picture src={myImage} formats={['avif', 'webp']} alt="A description of my image." />
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
```html
|
|
489
|
+
<!-- Output -->
|
|
490
|
+
<picture>
|
|
491
|
+
<source srcset="/_astro/my_image.hash.avif" type="image/avif" />
|
|
492
|
+
<source srcset="/_astro/my_image.hash.webp" type="image/webp" />
|
|
493
|
+
<img
|
|
494
|
+
src="/_astro/my_image.hash.png"
|
|
495
|
+
width="1600"
|
|
496
|
+
height="900"
|
|
497
|
+
decoding="async"
|
|
498
|
+
loading="lazy"
|
|
499
|
+
alt="A description of my image."
|
|
500
|
+
/>
|
|
501
|
+
</picture>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
`<Picture />` accepts all the properties of [the `<Image />` component](#image-) plus the following:
|
|
505
|
+
|
|
506
|
+
#### `formats`
|
|
507
|
+
|
|
508
|
+
<p>
|
|
509
|
+
|
|
510
|
+
**Type:** <code><a href="#imageoutputformat">ImageOutputFormat</a>[]</code>
|
|
511
|
+
</p>
|
|
512
|
+
|
|
513
|
+
An array of image formats to use for the `<source>` tags. Entries will be added as `<source>` elements in the order they are listed, and this order determines which format is displayed. For the best performance, list the most modern format first (e.g. `webp` or `avif`). By default, this is set to `['webp']`.
|
|
514
|
+
|
|
515
|
+
#### `fallbackFormat`
|
|
516
|
+
|
|
517
|
+
<p>
|
|
518
|
+
|
|
519
|
+
**Type:** [`ImageOutputFormat`](#imageoutputformat)
|
|
520
|
+
</p>
|
|
521
|
+
|
|
522
|
+
Format to use as a fallback value for the `<img>` tag. Defaults to `.png` for static images (or `.jpg` if the image is a JPG), `.gif` for animated images, and `.svg` for SVG files.
|
|
523
|
+
|
|
524
|
+
#### `pictureAttributes`
|
|
525
|
+
|
|
526
|
+
<p>
|
|
527
|
+
|
|
528
|
+
**Type:** `HTMLAttributes<'picture'>`
|
|
529
|
+
</p>
|
|
530
|
+
|
|
531
|
+
An object of attributes to be added to the `<picture>` tag.
|
|
532
|
+
|
|
533
|
+
Use this property to apply attributes to the outer `<picture>` element itself. Attributes applied to the `<Picture />` component directly will apply to the inner `<img>` element, except for those used for image transformation.
|
|
534
|
+
|
|
535
|
+
```astro title="src/components/MyComponent.astro"
|
|
536
|
+
---
|
|
537
|
+
import { Picture } from "astro:assets";
|
|
538
|
+
import myImage from "../my_image.png"; // Image is 1600x900
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
<Picture
|
|
542
|
+
src={myImage}
|
|
543
|
+
alt="A description of my image."
|
|
544
|
+
pictureAttributes={{ style: "background-color: red;" }}
|
|
545
|
+
/>
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
```html
|
|
549
|
+
<!-- Output -->
|
|
550
|
+
<picture style="background-color: red;">
|
|
551
|
+
<source srcset="/_astro/my_image.hash.webp" type="image/webp" />
|
|
552
|
+
<img
|
|
553
|
+
src="/_astro/my_image.hash.png"
|
|
554
|
+
alt="A description of my image."
|
|
555
|
+
width="1600"
|
|
556
|
+
height="900"
|
|
557
|
+
loading="lazy"
|
|
558
|
+
decoding="async"
|
|
559
|
+
/>
|
|
560
|
+
</picture>
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### `<Font />`
|
|
564
|
+
|
|
565
|
+
<p><Since v="6.0.0" /></p>
|
|
566
|
+
|
|
567
|
+
The `<Font />` component outputs style tags and can optionally output preload links for a given font family.
|
|
568
|
+
|
|
569
|
+
It must be imported and added to your page `<head>`. This is commonly done in a component such as `Head.astro` that is used in a common site layout for global use but may be added to individual pages as needed.
|
|
570
|
+
|
|
571
|
+
With this component, you have control over which font family is used on which page, and which fonts are preloaded.
|
|
572
|
+
|
|
573
|
+
```astro title="src/components/Head.astro"
|
|
574
|
+
---
|
|
575
|
+
import { Font } from "astro:assets";
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
<Font cssVariable="--font-roboto" />
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
The `<Font />` component accepts the following properties:
|
|
582
|
+
|
|
583
|
+
#### `cssVariable` (required)
|
|
584
|
+
|
|
585
|
+
<p>
|
|
586
|
+
|
|
587
|
+
**Type:** `CssVariable`<br />
|
|
588
|
+
**Example type:** `"--font-roboto" | "--font-comic-sans" | ...`
|
|
589
|
+
</p>
|
|
590
|
+
|
|
591
|
+
The [`cssVariable`](/en/reference/configuration-reference/#fontcssvariable) registered in your Astro configuration:
|
|
592
|
+
|
|
593
|
+
```astro title="src/components/Head.astro" "cssVariable"
|
|
594
|
+
---
|
|
595
|
+
import { Font } from "astro:assets";
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
<Font cssVariable="--font-roboto" />
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
#### `preload`
|
|
602
|
+
|
|
603
|
+
<p>
|
|
604
|
+
|
|
605
|
+
**Type:** `boolean | { weight?: string | number; style?: string; subset?: string }[]`<br />
|
|
606
|
+
**Default:** `false`
|
|
607
|
+
</p>
|
|
608
|
+
|
|
609
|
+
Whether to output [preload links](https://web.dev/learn/performance/optimize-web-fonts#preload) or not. With the `preload` directive, the browser will immediately begin downloading all possible font links during page load:
|
|
610
|
+
|
|
611
|
+
```astro title="src/components/Head.astro" "preload"
|
|
612
|
+
---
|
|
613
|
+
import { Font } from "astro:assets";
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
<Font cssVariable="--font-roboto" preload />
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Be very intentional about which fonts you preload. Preloading too many fonts can impact performance, as this can block loading other important resources or may download fonts that are not needed for the current page.
|
|
620
|
+
|
|
621
|
+
To selectively control which font files are preloaded, you can provide an array of objects describing any combination of font `weight`, `style`, or `subset` to preload:
|
|
622
|
+
|
|
623
|
+
```astro title="src/components/Head.astro" {7-10}
|
|
624
|
+
---
|
|
625
|
+
import { Font } from "astro:assets";
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
<Font
|
|
629
|
+
cssVariable="--font-roboto"
|
|
630
|
+
preload={[
|
|
631
|
+
{ subset: "latin", style: "normal" },
|
|
632
|
+
{ weight: "400" },
|
|
633
|
+
]}
|
|
634
|
+
/>
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Variable weight font files will be preloaded if any weight within its range is requested. For example, a font file for font weight `100 900` will be included when `400` is specified in a `preload` object.
|
|
638
|
+
|
|
639
|
+
### `getImage()`
|
|
640
|
+
|
|
641
|
+
<p>
|
|
642
|
+
|
|
643
|
+
**Type:** <code>(options: <a href="#unresolvedimagetransform">UnresolvedImageTransform</a>) => Promise\<<a href="#getimageresult">GetImageResult</a>\></code>
|
|
644
|
+
</p>
|
|
645
|
+
|
|
646
|
+
:::caution
|
|
647
|
+
`getImage()` relies on server-only APIs and will throw an error on the client.
|
|
648
|
+
|
|
649
|
+
If you need the resulting image URL client-side, you can [pass the `src` from a server-rendered `getImage()` call to the client](/en/guides/images/#generating-images-with-getimage).
|
|
650
|
+
:::
|
|
651
|
+
|
|
652
|
+
The `getImage()` function is intended for generating images destined to be used somewhere else than directly in HTML, for example in an [API Route](/en/guides/endpoints/#server-endpoints-api-routes). It also allows you to create your own custom `<Image />` component.
|
|
653
|
+
|
|
654
|
+
This takes an options object with the [same properties as the Image component](#image-) (except `alt` and `sizes`) and returns a [`GetImageResult` object](#getimageresult).
|
|
655
|
+
|
|
656
|
+
The following example generates an AVIF `background-image` for a `<div />`:
|
|
657
|
+
|
|
658
|
+
```astro title="src/components/Background.astro"
|
|
659
|
+
---
|
|
660
|
+
import { getImage } from "astro:assets";
|
|
661
|
+
import myBackground from "../background.png"
|
|
662
|
+
|
|
663
|
+
const optimizedBackground = await getImage({src: myBackground, format: 'avif'})
|
|
664
|
+
---
|
|
665
|
+
|
|
666
|
+
<div style={`background-image: url(${optimizedBackground.src});`}><slot /></div>
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### `inferRemoteSize()`
|
|
670
|
+
|
|
671
|
+
<p>
|
|
672
|
+
|
|
673
|
+
**Type:** <code>(url: string) => Promise\<Omit\<<a href="#imagemetadata-1">ImageMetadata</a>, 'src' | 'fsPath'\>\></code><br />
|
|
674
|
+
<Since v="4.12.0" />
|
|
675
|
+
</p>
|
|
676
|
+
|
|
677
|
+
A function to set the original `width` and `height` of a remote image automatically. This can be used as an alternative to passing the [`inferSize` ](#infersize) property.
|
|
678
|
+
|
|
679
|
+
```ts
|
|
680
|
+
import { inferRemoteSize } from 'astro:assets';
|
|
681
|
+
const { width, height } = await inferRemoteSize("https://example.com/cat.png");
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### `getConfiguredImageService()`
|
|
685
|
+
|
|
686
|
+
<p>
|
|
687
|
+
|
|
688
|
+
**Type:** <code>() => Promise\<<a href="#imageservice">ImageService</a>\></code><br />
|
|
689
|
+
<Since v="2.1.3" />
|
|
690
|
+
</p>
|
|
691
|
+
|
|
692
|
+
Retrieves the resolved [image service](/en/reference/configuration-reference/#imageservice).
|
|
693
|
+
|
|
694
|
+
### `imageConfig`
|
|
695
|
+
|
|
696
|
+
<p>
|
|
697
|
+
|
|
698
|
+
**Type:** [`AstroConfig["image"]`](/en/reference/configuration-reference/#image-options)<br />
|
|
699
|
+
<Since v="3.0.9" />
|
|
700
|
+
</p>
|
|
701
|
+
|
|
702
|
+
The [configuration options for images](/en/reference/configuration-reference/#image-options) set by the user and merged with all defaults.
|
|
703
|
+
|
|
704
|
+
### `fontData`
|
|
705
|
+
|
|
706
|
+
<p>
|
|
707
|
+
|
|
708
|
+
**Type:** <code>Record\<CssVariable, Array\<<a href="#fontdata-1">FontData</a>\>\></code><br />
|
|
709
|
+
<Since v="6.0.0" />
|
|
710
|
+
</p>
|
|
711
|
+
|
|
712
|
+
An object where each key is a [`cssVariable`](/en/reference/configuration-reference/#fontcssvariable) and the value is an array describing the associated fonts. Each font is an object containing an array of `src` available for that font and the following optional properties: `weight` and `style`:
|
|
713
|
+
|
|
714
|
+
```ts
|
|
715
|
+
import { fontData } from "astro:assets"
|
|
716
|
+
|
|
717
|
+
const data = fontData["--font-roboto"]
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### `experimental_getFontFileURL()`
|
|
721
|
+
|
|
722
|
+
<p>
|
|
723
|
+
|
|
724
|
+
**Type:** `(url: string, requestUrl?: URL) => Promise<string>`
|
|
725
|
+
<Since v="6.2.0" />
|
|
726
|
+
</p>
|
|
727
|
+
|
|
728
|
+
Resolves a font file URL obtained from [`fontData`](#fontdata):
|
|
729
|
+
|
|
730
|
+
```ts " experimental_getFontFileURL " {9}
|
|
731
|
+
import { fontData, experimental_getFontFileURL } from "astro:assets";
|
|
732
|
+
|
|
733
|
+
const fontPath = fontData["--font-roboto"][0]?.src[0]?.url;
|
|
734
|
+
|
|
735
|
+
if (fontPath === undefined) {
|
|
736
|
+
throw new Error("Cannot find the font path.");
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const url = experimental_getFontFileURL(fontPath);
|
|
740
|
+
const buffer = await fetch(url).then((res) => res.arrayBuffer());
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
When called on a route [rendered on-demand](/en/guides/on-demand-rendering/), the request URL needs to be provided:
|
|
744
|
+
|
|
745
|
+
```ts "context.url"
|
|
746
|
+
import type { APIRoute } from "astro";
|
|
747
|
+
import { fontData, experimental_getFontFileURL } from "astro:assets";
|
|
748
|
+
|
|
749
|
+
export const prerender = false; // Not needed in 'server' mode
|
|
750
|
+
|
|
751
|
+
export const GET: APIRoute = async (context) => {
|
|
752
|
+
// ...
|
|
753
|
+
const fontPath = fontData["--font-roboto"][0]?.src[0]?.url;
|
|
754
|
+
const url = experimental_getFontFileURL(fontPath, context.url);
|
|
755
|
+
// ...
|
|
756
|
+
};
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
## `astro:assets` types
|
|
760
|
+
|
|
761
|
+
The following types are imported from the virtual assets module:
|
|
762
|
+
|
|
763
|
+
```ts
|
|
764
|
+
import type {
|
|
765
|
+
LocalImageProps,
|
|
766
|
+
RemoteImageProps,
|
|
767
|
+
FontData
|
|
768
|
+
} from "astro/assets";
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
### `LocalImageProps`
|
|
772
|
+
|
|
773
|
+
<p>
|
|
774
|
+
|
|
775
|
+
**Type:** <code>ImageSharedProps\<T\> & \{ src: <a href="#imagemetadata-1">ImageMetadata</a> | Promise\<\{ default: ImageMetadata; \}\> }</code>
|
|
776
|
+
</p>
|
|
777
|
+
|
|
778
|
+
Describes the [properties of a local image](#image-). This ensures that [`src`](#src-required) matches the shape of an imported image.
|
|
779
|
+
|
|
780
|
+
<ReadMore>Learn more about [imported images in `src/`](/en/guides/images/#images-in-src) with an example usage.</ReadMore>
|
|
781
|
+
|
|
782
|
+
### `RemoteImageProps`
|
|
783
|
+
|
|
784
|
+
<p>
|
|
785
|
+
|
|
786
|
+
**Types:**
|
|
787
|
+
* `ImageSharedProps<T> & { src: string; inferSize: true; }`
|
|
788
|
+
* `ImageSharedProps<T> & { src: string; inferSize?: false | undefined; }`
|
|
789
|
+
</p>
|
|
790
|
+
|
|
791
|
+
Describes the [properties of a remote image](#image-). This ensures that when [`inferSize`](#infersize) is not provided or is set to `false`, both [`width` and `height`](#width-and-height-required-for-images-in-public) are required.
|
|
792
|
+
|
|
793
|
+
### `FontData`
|
|
794
|
+
|
|
795
|
+
<p>
|
|
796
|
+
|
|
797
|
+
**Type:** `{ src: Array<{ url: string; format?: string; tech?: string }>; weight?: string; style?: string; subset?: string; }`<br />
|
|
798
|
+
<Since v="6.0.0" />
|
|
799
|
+
</p>
|
|
800
|
+
|
|
801
|
+
Describes the font data associated with a given font family.
|
|
802
|
+
|
|
803
|
+
#### `FontData.src`
|
|
804
|
+
|
|
805
|
+
<p>
|
|
806
|
+
|
|
807
|
+
**Type:** `Array<{ url: string; format?: string; tech?: string }>`
|
|
808
|
+
</p>
|
|
809
|
+
|
|
810
|
+
An array of objects describing the available font files for a given font family. Each object contains a `url` and, optionally, the associated [`format`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_formats) and [`tech`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/src#font_technologies).
|
|
811
|
+
|
|
812
|
+
#### `FontData.weight`
|
|
813
|
+
|
|
814
|
+
<p>
|
|
815
|
+
|
|
816
|
+
**Type:** `string`
|
|
817
|
+
</p>
|
|
818
|
+
|
|
819
|
+
Specifies the font weight (e.g. `400`, `600`).
|
|
820
|
+
|
|
821
|
+
#### `FontData.style`
|
|
822
|
+
|
|
823
|
+
<p>
|
|
824
|
+
|
|
825
|
+
**Type:** `string`
|
|
826
|
+
</p>
|
|
827
|
+
|
|
828
|
+
Specifies the font style (e.g. `normal`, `italic`).
|
|
829
|
+
|
|
830
|
+
#### `FontData.subset`
|
|
831
|
+
|
|
832
|
+
<p>
|
|
833
|
+
|
|
834
|
+
**Type:** `string`
|
|
835
|
+
<Since v="7.0.0" />
|
|
836
|
+
</p>
|
|
837
|
+
|
|
838
|
+
Specifies the font subset (e.g. `latin`, `cyrillic`).
|
|
839
|
+
|
|
840
|
+
## Imports from `astro/assets`
|
|
841
|
+
|
|
842
|
+
The following helpers are imported from the regular assets module:
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
import {
|
|
846
|
+
baseService,
|
|
847
|
+
getConfiguredImageService,
|
|
848
|
+
getImage,
|
|
849
|
+
isLocalService,
|
|
850
|
+
} from "astro/assets";
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
### `baseService`
|
|
854
|
+
|
|
855
|
+
<p>
|
|
856
|
+
|
|
857
|
+
**Type:** <code>Omit\<<a href="#localimageservice">LocalImageService</a>, 'transform'\></code>
|
|
858
|
+
</p>
|
|
859
|
+
|
|
860
|
+
The built-in local image service which can be extended to [create a custom image service](/en/reference/image-service-reference/).
|
|
861
|
+
|
|
862
|
+
The following example reuses the `baseService` to create a new image service:
|
|
863
|
+
|
|
864
|
+
```ts title="src/image-service.ts"
|
|
865
|
+
import { baseService } from "astro/assets";
|
|
866
|
+
|
|
867
|
+
const newImageService = {
|
|
868
|
+
getURL: baseService.getURL,
|
|
869
|
+
parseURL: baseService.parseURL,
|
|
870
|
+
getHTMLAttributes: baseService.getHTMLAttributes,
|
|
871
|
+
async transform(inputBuffer, transformOptions) {
|
|
872
|
+
/* ... */
|
|
873
|
+
},
|
|
874
|
+
};
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
### `getConfiguredImageService()`
|
|
878
|
+
|
|
879
|
+
See [`getConfiguredImageService()`](#getconfiguredimageservice) from `astro:assets`.
|
|
880
|
+
|
|
881
|
+
### `getImage()`
|
|
882
|
+
|
|
883
|
+
<p>
|
|
884
|
+
|
|
885
|
+
**Type:** <code>(options: <a href="#unresolvedimagetransform">UnresolvedImageTransform</a>, imageConfig: <a href="/en/reference/configuration-reference/#image-options">AstroConfig['image']</a>) => Promise\<<a href="#getimageresult">GetImageResult</a>\></code>
|
|
886
|
+
</p>
|
|
887
|
+
|
|
888
|
+
A function similar to [`getImage()`](#getimage) from `astro:assets` with two required arguments: an `options` object with [the same properties as the Image component](#image-) and a second object for the [image configuration](/en/reference/configuration-reference/#image-options).
|
|
889
|
+
|
|
890
|
+
### `isLocalService()`
|
|
891
|
+
|
|
892
|
+
<p>
|
|
893
|
+
|
|
894
|
+
**Type:** <code>(service: <a href="#imageservice">ImageService</a> | undefined) => boolean</code>
|
|
895
|
+
</p>
|
|
896
|
+
|
|
897
|
+
Checks the type of an image service and returns `true` when this is a [local service](#localimageservice).
|
|
898
|
+
|
|
899
|
+
## `astro/assets` types
|
|
900
|
+
|
|
901
|
+
The following types are imported from the regular assets module:
|
|
902
|
+
|
|
903
|
+
```ts
|
|
904
|
+
import type {
|
|
905
|
+
LocalImageProps,
|
|
906
|
+
RemoteImageProps,
|
|
907
|
+
} from "astro/assets";
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
### `LocalImageProps`
|
|
911
|
+
|
|
912
|
+
See [`LocalImageProps`](#localimageprops) from `astro:assets`.
|
|
913
|
+
|
|
914
|
+
### `RemoteImageProps`
|
|
915
|
+
|
|
916
|
+
See [`RemoteImageProps`](#remoteimageprops) from `astro:assets`.
|
|
917
|
+
|
|
918
|
+
## Imports from `astro/assets/utils`
|
|
919
|
+
|
|
920
|
+
The following helpers are imported from the `utils` directory in the regular assets module and can be used to [build an image service](/en/reference/image-service-reference/):
|
|
921
|
+
|
|
922
|
+
```ts
|
|
923
|
+
import {
|
|
924
|
+
isRemoteAllowed,
|
|
925
|
+
matchHostname,
|
|
926
|
+
matchPathname,
|
|
927
|
+
matchPattern,
|
|
928
|
+
matchPort,
|
|
929
|
+
matchProtocol,
|
|
930
|
+
isESMImportedImage,
|
|
931
|
+
isRemoteImage,
|
|
932
|
+
resolveSrc,
|
|
933
|
+
imageMetadata,
|
|
934
|
+
emitImageMetadata,
|
|
935
|
+
emitClientAsset,
|
|
936
|
+
getOrigQueryParams,
|
|
937
|
+
inferRemoteSize,
|
|
938
|
+
propsToFilename,
|
|
939
|
+
hashTransform,
|
|
940
|
+
} from "astro/assets/utils";
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
### `isRemoteAllowed()`
|
|
944
|
+
|
|
945
|
+
<p>
|
|
946
|
+
|
|
947
|
+
**Type:** <code>(src: string, \{ domains, remotePatterns \}: \{ domains: string[], remotePatterns: <a href="#remotepattern">RemotePattern</a>[] \}) => boolean</code><br />
|
|
948
|
+
<Since v="4.0.0" />
|
|
949
|
+
</p>
|
|
950
|
+
|
|
951
|
+
Determines whether a given remote resource, identified by its source URL, is allowed based on specified domains and remote patterns.
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
```ts
|
|
955
|
+
import { isRemoteAllowed } from 'astro/assets/utils';
|
|
956
|
+
|
|
957
|
+
const url = new URL('https://example.com/images/test.jpg');
|
|
958
|
+
const domains = ['example.com', 'anotherdomain.com'];
|
|
959
|
+
const remotePatterns = [
|
|
960
|
+
{
|
|
961
|
+
protocol: 'https',
|
|
962
|
+
hostname: 'images.example.com',
|
|
963
|
+
pathname: '/**', // Allow any path under this hostname
|
|
964
|
+
}
|
|
965
|
+
];
|
|
966
|
+
|
|
967
|
+
isRemoteAllowed(url.href, { domains, remotePatterns }); // Output: `true`
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
### `matchHostname()`
|
|
971
|
+
|
|
972
|
+
<p>
|
|
973
|
+
|
|
974
|
+
**Type:** `(url: URL, hostname?: string, allowWildcard = false) => boolean`<br />
|
|
975
|
+
<Since v="4.0.0" />
|
|
976
|
+
</p>
|
|
977
|
+
|
|
978
|
+
Matches a given URL's hostname against a specified hostname, with optional support for wildcard patterns.
|
|
979
|
+
|
|
980
|
+
```ts
|
|
981
|
+
import { matchHostname } from 'astro/assets/utils';
|
|
982
|
+
|
|
983
|
+
const url = new URL('https://sub.example.com/path/to/resource');
|
|
984
|
+
|
|
985
|
+
matchHostname(url, 'example.com'); // Output: `false`
|
|
986
|
+
matchHostname(url, 'example.com', true); // Output: `true`
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
### `matchPathname()`
|
|
990
|
+
|
|
991
|
+
<p>
|
|
992
|
+
|
|
993
|
+
**Type:** `(url: URL, pathname?: string, allowWildcard = false) => boolean`<br />
|
|
994
|
+
<Since v="4.0.0" />
|
|
995
|
+
</p>
|
|
996
|
+
|
|
997
|
+
Matches a given URL's pathname against a specified pattern, with optional support for wildcards.
|
|
998
|
+
|
|
999
|
+
```ts
|
|
1000
|
+
import { matchPathname } from 'astro/assets/utils';
|
|
1001
|
+
|
|
1002
|
+
const testURL = new URL('https://example.com/images/photo.jpg');
|
|
1003
|
+
|
|
1004
|
+
matchPathname(testURL, '/images/photo.jpg'); // Output: `true`
|
|
1005
|
+
matchPathname(testURL, '/images/'); // Output: `false`
|
|
1006
|
+
matchPathname(testURL, '/images/*', true); // Output: `true`
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### `matchPattern()`
|
|
1010
|
+
|
|
1011
|
+
<p>
|
|
1012
|
+
|
|
1013
|
+
**Type:** <code>(url: URL, remotePattern: <a href="#remotepattern">RemotePattern</a>) => boolean</code><br />
|
|
1014
|
+
<Since v="4.0.0" />
|
|
1015
|
+
</p>
|
|
1016
|
+
|
|
1017
|
+
Evaluates whether a given URL matches the specified remote pattern based on protocol, hostname, port, and pathname.
|
|
1018
|
+
|
|
1019
|
+
```ts
|
|
1020
|
+
import { matchPattern } from 'astro/assets/utils';
|
|
1021
|
+
|
|
1022
|
+
const url = new URL('https://images.example.com/photos/test.jpg');
|
|
1023
|
+
const remotePattern = {
|
|
1024
|
+
protocol: 'https',
|
|
1025
|
+
hostname: 'images.example.com',
|
|
1026
|
+
pathname: '/photos/**', // Allow all files under /photos/
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
matchPattern(url, remotePattern); // Output: `true`
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
### `matchPort()`
|
|
1033
|
+
|
|
1034
|
+
<p>
|
|
1035
|
+
|
|
1036
|
+
**Type:** `(url: URL, port?: string) => boolean`<br />
|
|
1037
|
+
**Default:** `true`<br />
|
|
1038
|
+
<Since v="4.0.0" />
|
|
1039
|
+
</p>
|
|
1040
|
+
|
|
1041
|
+
Checks if the given URL's port matches the specified port. If no port is provided, it returns `true`.
|
|
1042
|
+
|
|
1043
|
+
```ts
|
|
1044
|
+
import { matchPort } from 'astro/assets/utils';
|
|
1045
|
+
|
|
1046
|
+
const urlWithPort = new URL('https://example.com:8080/resource');
|
|
1047
|
+
const urlWithoutPort = new URL('https://example.com/resource');
|
|
1048
|
+
|
|
1049
|
+
matchPort(urlWithPort, '8080'); // Output: `true`
|
|
1050
|
+
matchPort(urlWithoutPort, '8080'); // Output: `false`
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
### `matchProtocol()`
|
|
1054
|
+
|
|
1055
|
+
<p>
|
|
1056
|
+
|
|
1057
|
+
**Type:** `(url: URL, protocol?: string) => boolean`<br />
|
|
1058
|
+
**Default:** `true`<br />
|
|
1059
|
+
<Since v="4.0.0" />
|
|
1060
|
+
</p>
|
|
1061
|
+
|
|
1062
|
+
Compares the protocol of the provided URL with a specified protocol. This returns `true` if the protocol matches or if no protocol is provided.
|
|
1063
|
+
|
|
1064
|
+
```ts
|
|
1065
|
+
import { matchProtocol } from 'astro/assets/utils';
|
|
1066
|
+
|
|
1067
|
+
const secureUrl = new URL('https://example.com/resource');
|
|
1068
|
+
const regularUrl = new URL('http://example.com/resource');
|
|
1069
|
+
|
|
1070
|
+
matchProtocol(secureUrl, 'https'); // Output: `true`
|
|
1071
|
+
matchProtocol(regularUrl, 'https'); // Output: `false`
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
### `isESMImportedImage()`
|
|
1075
|
+
|
|
1076
|
+
<p>
|
|
1077
|
+
|
|
1078
|
+
**Type:** <code>(src: <a href="#imagemetadata-1">ImageMetadata</a> | string) => boolean</code><br />
|
|
1079
|
+
<Since v="4.0.0" />
|
|
1080
|
+
</p>
|
|
1081
|
+
|
|
1082
|
+
Determines if the given source is an ECMAScript Module (ESM) imported image.
|
|
1083
|
+
|
|
1084
|
+
```ts
|
|
1085
|
+
import { isESMImportedImage } from 'astro/assets/utils';
|
|
1086
|
+
|
|
1087
|
+
const imageMetadata = {
|
|
1088
|
+
src: '/images/photo.jpg',
|
|
1089
|
+
width: 800,
|
|
1090
|
+
height: 600,
|
|
1091
|
+
format: 'jpg',
|
|
1092
|
+
};
|
|
1093
|
+
const filePath = '/images/photo.jpg';
|
|
1094
|
+
|
|
1095
|
+
isESMImportedImage(imageMetadata); // Output: `true`
|
|
1096
|
+
isESMImportedImage(filePath); // Output: `false`
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
### `isRemoteImage()`
|
|
1100
|
+
|
|
1101
|
+
<p>
|
|
1102
|
+
|
|
1103
|
+
**Type:** <code>(src: <a href="#imagemetadata-1">ImageMetadata</a> | string) => boolean</code><br />
|
|
1104
|
+
<Since v="4.0.0" />
|
|
1105
|
+
</p>
|
|
1106
|
+
|
|
1107
|
+
Determines if the provided source is a remote image URL in the form of a string.
|
|
1108
|
+
|
|
1109
|
+
```ts
|
|
1110
|
+
import { isRemoteImage } from 'astro/assets/utils';
|
|
1111
|
+
|
|
1112
|
+
const imageUrl = 'https://example.com/images/photo.jpg';
|
|
1113
|
+
const localImage = {
|
|
1114
|
+
src: '/images/photo.jpg',
|
|
1115
|
+
width: 800,
|
|
1116
|
+
height: 600,
|
|
1117
|
+
format: 'jpg',
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
isRemoteImage(imageUrl); // Output: `true`
|
|
1121
|
+
isRemoteImage(localImage); // Output: `false`
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
### `resolveSrc()`
|
|
1125
|
+
|
|
1126
|
+
<p>
|
|
1127
|
+
|
|
1128
|
+
**Type:** <code>(src: <a href="#unresolvedimagetransformsrc">UnresolvedImageTransform['src']</a>) => Promise\<string | <a href="#imagemetadata-1">ImageMetadata</a>\></code><br />
|
|
1129
|
+
<Since v="4.0.0" />
|
|
1130
|
+
</p>
|
|
1131
|
+
|
|
1132
|
+
Returns the image source. This function ensures that if `src` is a Promise (e.g., a dynamic `import()`), it is awaited and the correct `src` is extracted. If `src` is already a resolved value, it is returned as-is.
|
|
1133
|
+
|
|
1134
|
+
```ts
|
|
1135
|
+
import { resolveSrc } from 'astro/assets/utils';
|
|
1136
|
+
import localImage from "./images/photo.jpg";
|
|
1137
|
+
|
|
1138
|
+
const resolvedLocal = await resolveSrc(localImage);
|
|
1139
|
+
// Example value: `{ src: '/@fs/home/username/dev/astro-project/src/images/photo.jpg', width: 800, height: 600, format: 'jpg' }`
|
|
1140
|
+
|
|
1141
|
+
const resolvedRemote = await resolveSrc("https://example.com/remote-img.jpg");
|
|
1142
|
+
// Value: `"https://example.com/remote-img.jpg"`
|
|
1143
|
+
|
|
1144
|
+
const resolvedDynamic = await resolveSrc(import("./images/dynamic-image.jpg"))
|
|
1145
|
+
// Example value: `{ src: '/@fs/home/username/dev/astro-project/src/images/dynamic-image.jpg', width: 800, height: 600, format: 'jpg' }`
|
|
1146
|
+
```
|
|
1147
|
+
|
|
1148
|
+
### `imageMetadata()`
|
|
1149
|
+
|
|
1150
|
+
<p>
|
|
1151
|
+
|
|
1152
|
+
**Type:** <code>(data: Uint8Array, src?: string) => Promise\<Omit\<<a href="#imagemetadata-1">ImageMetadata</a>, 'src' | 'fsPath'\>\></code><br />
|
|
1153
|
+
<Since v="4.0.0" />
|
|
1154
|
+
</p>
|
|
1155
|
+
|
|
1156
|
+
Extracts image metadata such as dimensions, format, and orientation from the provided image data.
|
|
1157
|
+
|
|
1158
|
+
```ts
|
|
1159
|
+
import { imageMetadata } from 'astro/assets/utils';
|
|
1160
|
+
|
|
1161
|
+
const binaryImage = new Uint8Array([/* ...binary image data... */]);
|
|
1162
|
+
const sourcePath = '/images/photo.jpg';
|
|
1163
|
+
|
|
1164
|
+
const metadata = await imageMetadata(binaryImage, sourcePath);
|
|
1165
|
+
// Example value:
|
|
1166
|
+
// {
|
|
1167
|
+
// width: 800,
|
|
1168
|
+
// height: 600,
|
|
1169
|
+
// format: 'jpg',
|
|
1170
|
+
// orientation: undefined
|
|
1171
|
+
// }
|
|
1172
|
+
```
|
|
1173
|
+
|
|
1174
|
+
### `emitImageMetadata()`
|
|
1175
|
+
|
|
1176
|
+
<p>
|
|
1177
|
+
|
|
1178
|
+
**Type:** <code>(id: string | undefined, fileEmitter?: Rollup.EmitFile) => Promise\<(<a href="#imagemetadata-1">ImageMetadata</a> & \{ contents?: Buffer \}) | undefined\></code><br />
|
|
1179
|
+
<Since v="5.7.0" />
|
|
1180
|
+
</p>
|
|
1181
|
+
|
|
1182
|
+
Processes an image file and emits its metadata and optionally its contents. In build mode, the function uses `fileEmitter` to generate an asset reference. In development mode, it resolves to a local file URL with query parameters for metadata.
|
|
1183
|
+
|
|
1184
|
+
```ts
|
|
1185
|
+
import { emitImageMetadata } from 'astro/assets/utils';
|
|
1186
|
+
|
|
1187
|
+
const imageId = '/images/photo.jpg';
|
|
1188
|
+
const metadata = await emitImageMetadata(imageId);
|
|
1189
|
+
// Example value:
|
|
1190
|
+
// {
|
|
1191
|
+
// src: '/@fs/home/username/dev/astro-project/src/images/photo.jpg?origWidth=800&origHeight=600&origFormat=jpg',
|
|
1192
|
+
// width: 800,
|
|
1193
|
+
// height: 600,
|
|
1194
|
+
// format: 'jpg',
|
|
1195
|
+
// contents: Uint8Array([...])
|
|
1196
|
+
// }
|
|
1197
|
+
```
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
### `emitClientAsset()`
|
|
1201
|
+
|
|
1202
|
+
<p>
|
|
1203
|
+
|
|
1204
|
+
**Type:** <code>(pluginContext: <a href="https://rollupjs.org/plugin-development/#plugin-context">Rollup.PluginContext</a>, options: Rollup.EmitFile) => string</code><br />
|
|
1205
|
+
|
|
1206
|
+
<Since v="6.0.0" />
|
|
1207
|
+
</p>
|
|
1208
|
+
|
|
1209
|
+
Emits a client asset that will be moved to the client directory for assets (e.g. `dist/client/_astro/`) during SSR builds. This function is intended for integration authors who need to emit assets (such as images) from server-rendered content that should be available on the client.
|
|
1210
|
+
|
|
1211
|
+
Use this instead of [Rollup `pluginContext.emitFile()`](https://rollupjs.org/plugin-development/#this-emitfile) directly when working in a Vite plugin context and you need the emitted asset to be moved to the client output directory.
|
|
1212
|
+
|
|
1213
|
+
```ts
|
|
1214
|
+
import { emitClientAsset } from 'astro/assets/utils';
|
|
1215
|
+
|
|
1216
|
+
function myVitePlugin() {
|
|
1217
|
+
return {
|
|
1218
|
+
name: 'my-plugin',
|
|
1219
|
+
transform(code, id) {
|
|
1220
|
+
const handle = emitClientAsset(this, {
|
|
1221
|
+
type: 'asset',
|
|
1222
|
+
name: 'my-image.png',
|
|
1223
|
+
source: imageBuffer,
|
|
1224
|
+
});
|
|
1225
|
+
// Returns the asset handle similar to `emitFile()`
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
### `getOrigQueryParams()`
|
|
1232
|
+
|
|
1233
|
+
<p>
|
|
1234
|
+
|
|
1235
|
+
**Type:** <code>(params: URLSearchParams) => Pick\<<a href="#imagemetadata-1">ImageMetadata</a>, 'width' | 'height' | 'format'\> | undefined</code><br />
|
|
1236
|
+
<Since v="4.0.0" />
|
|
1237
|
+
</p>
|
|
1238
|
+
|
|
1239
|
+
Retrieves the `width`, `height`, and `format` of an image from a [`URLSearchParams` object](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). If any of these parameters are missing or invalid, the function returns `undefined`.
|
|
1240
|
+
|
|
1241
|
+
```ts
|
|
1242
|
+
import { getOrigQueryParams } from 'astro/assets/utils';
|
|
1243
|
+
|
|
1244
|
+
const url = new URL('https://example.com/image.jpg?width=800&height=600&format=jpg');
|
|
1245
|
+
const origParams = getOrigQueryParams(url.searchParams);
|
|
1246
|
+
// Example value:
|
|
1247
|
+
// {
|
|
1248
|
+
// width: 800,
|
|
1249
|
+
// height: 600,
|
|
1250
|
+
// format: 'jpg'
|
|
1251
|
+
// }
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
### `inferRemoteSize()`
|
|
1255
|
+
|
|
1256
|
+
<p>
|
|
1257
|
+
|
|
1258
|
+
**Type:** <code>(url: string) => Promise\<Omit\<<a href="#imagemetadata-1">ImageMetadata</a>, 'src' | 'fsPath'\>\></code><br />
|
|
1259
|
+
<Since v="4.0.0" />
|
|
1260
|
+
</p>
|
|
1261
|
+
|
|
1262
|
+
Infers the dimensions of a remote image by streaming its data and analyzing it progressively until sufficient metadata is available.
|
|
1263
|
+
|
|
1264
|
+
```ts
|
|
1265
|
+
import { inferRemoteSize } from 'astro/assets/utils';
|
|
1266
|
+
|
|
1267
|
+
const remoteImageUrl = 'https://example.com/image.jpg';
|
|
1268
|
+
const imageSize = await inferRemoteSize(remoteImageUrl);
|
|
1269
|
+
// Example value:
|
|
1270
|
+
// {
|
|
1271
|
+
// width: 1920,
|
|
1272
|
+
// height: 1080,
|
|
1273
|
+
// format: 'jpg'
|
|
1274
|
+
// }
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
### `propsToFilename()`
|
|
1278
|
+
|
|
1279
|
+
<p>
|
|
1280
|
+
|
|
1281
|
+
**Type:** <code>(filePath: string, transform: <a href="#imagetransform">ImageTransform</a>, hash: string) => string</code><br />
|
|
1282
|
+
<Since v="4.0.0" />
|
|
1283
|
+
</p>
|
|
1284
|
+
|
|
1285
|
+
Generates a formatted filename for an image based on its source path, transformation properties, and a unique hash.
|
|
1286
|
+
|
|
1287
|
+
The formatted filename follows this structure:
|
|
1288
|
+
|
|
1289
|
+
`<prefixDirname>/<baseFilename>_<hash><outputExtension>`
|
|
1290
|
+
|
|
1291
|
+
- `prefixDirname`: If the image is an ESM imported image, this is the directory name of the original file path; otherwise, it will be an empty string.
|
|
1292
|
+
- `baseFilename`: The base name of the file or a hashed short name if the file is a `data:` URI.
|
|
1293
|
+
- `hash`: A unique hash string generated to distinguish the transformed file.
|
|
1294
|
+
- `outputExtension`: The desired output file extension derived from the `transform.format` or the original file extension.
|
|
1295
|
+
|
|
1296
|
+
```ts
|
|
1297
|
+
import { propsToFilename } from 'astro/assets/utils';
|
|
1298
|
+
|
|
1299
|
+
const filePath = '/images/photo.jpg';
|
|
1300
|
+
const transform = { format: 'png', src: filePath };
|
|
1301
|
+
const hash = 'abcd1234';
|
|
1302
|
+
|
|
1303
|
+
const filename = propsToFilename(filePath, transform, hash);
|
|
1304
|
+
// Example value: '/images/photo_abcd1234.png'
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
### `hashTransform()`
|
|
1308
|
+
|
|
1309
|
+
<p>
|
|
1310
|
+
|
|
1311
|
+
**Type:** <code>(transform: <a href="#imagetransform">ImageTransform</a>, imageService: string, propertiesToHash: string[]) => string</code><br />
|
|
1312
|
+
<Since v="4.0.0" />
|
|
1313
|
+
</p>
|
|
1314
|
+
|
|
1315
|
+
Transforms the provided `transform` object into a hash string based on selected properties and the specified `imageService`.
|
|
1316
|
+
|
|
1317
|
+
```ts
|
|
1318
|
+
import { hashTransform } from 'astro/assets/utils';
|
|
1319
|
+
|
|
1320
|
+
const transform = {
|
|
1321
|
+
src: '/images/photo.jpg',
|
|
1322
|
+
width: 800,
|
|
1323
|
+
height: 600,
|
|
1324
|
+
format: 'jpg',
|
|
1325
|
+
};
|
|
1326
|
+
const imageService = 'astro/assets/services/sharp';
|
|
1327
|
+
const propertiesToHash = ['width', 'height', 'format'];
|
|
1328
|
+
|
|
1329
|
+
const hash = hashTransform(transform, imageService, propertiesToHash);
|
|
1330
|
+
// Example value: 'd41d8cd98f00b204e9800998ecf8427e'
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
## `astro` types
|
|
1334
|
+
|
|
1335
|
+
```ts
|
|
1336
|
+
import type {
|
|
1337
|
+
GetImageResult,
|
|
1338
|
+
ImageTransform,
|
|
1339
|
+
UnresolvedImageTransform,
|
|
1340
|
+
ImageMetadata,
|
|
1341
|
+
ImageInputFormat,
|
|
1342
|
+
ImageOutputFormat,
|
|
1343
|
+
ImageQuality,
|
|
1344
|
+
ImageQualityPreset,
|
|
1345
|
+
RemotePattern,
|
|
1346
|
+
ImageService,
|
|
1347
|
+
ExternalImageService,
|
|
1348
|
+
LocalImageService,
|
|
1349
|
+
ImageServiceConfig,
|
|
1350
|
+
} from "astro";
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
### `GetImageResult`
|
|
1354
|
+
|
|
1355
|
+
<p>
|
|
1356
|
+
|
|
1357
|
+
**Type:** `object`<br />
|
|
1358
|
+
<Since v="2.2.0" />
|
|
1359
|
+
</p>
|
|
1360
|
+
|
|
1361
|
+
Describes the result of the transformation after the call to [`getImage()`](/en/reference/modules/astro-assets/#getimage).
|
|
1362
|
+
|
|
1363
|
+
#### `GetImageResult.attributes`
|
|
1364
|
+
|
|
1365
|
+
<p>
|
|
1366
|
+
|
|
1367
|
+
**Type:** `Record<string, any>`
|
|
1368
|
+
</p>
|
|
1369
|
+
|
|
1370
|
+
Defines the additional HTML attributes needed to render the image (e.g. width, height, style).
|
|
1371
|
+
|
|
1372
|
+
#### `GetImageResult.options`
|
|
1373
|
+
|
|
1374
|
+
<p>
|
|
1375
|
+
|
|
1376
|
+
**Type:** [`ImageTransform`](#imagetransform)
|
|
1377
|
+
</p>
|
|
1378
|
+
|
|
1379
|
+
Describes the transformation settings after validation.
|
|
1380
|
+
|
|
1381
|
+
#### `GetImageResult.rawOptions`
|
|
1382
|
+
|
|
1383
|
+
<p>
|
|
1384
|
+
|
|
1385
|
+
**Type:** [`ImageTransform`](#imagetransform)
|
|
1386
|
+
</p>
|
|
1387
|
+
|
|
1388
|
+
Describes the original transformation settings.
|
|
1389
|
+
|
|
1390
|
+
#### `GetImageResult.src`
|
|
1391
|
+
|
|
1392
|
+
<p>
|
|
1393
|
+
|
|
1394
|
+
**Type:** `string`
|
|
1395
|
+
</p>
|
|
1396
|
+
|
|
1397
|
+
The path to the generated image.
|
|
1398
|
+
|
|
1399
|
+
#### `GetImageResult.srcSet`
|
|
1400
|
+
|
|
1401
|
+
<p>
|
|
1402
|
+
|
|
1403
|
+
**Type:** <code>\{ values: \{ transform: <a href="#imagetransform">ImageTransform</a>; descriptor?: string; attributes?: Record\<string, any\>; url: string; \}[]; attribute: string; \}</code><br />
|
|
1404
|
+
<Since v="3.3.0" />
|
|
1405
|
+
</p>
|
|
1406
|
+
|
|
1407
|
+
An object describing how to render the [`srcset` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#srcset).
|
|
1408
|
+
|
|
1409
|
+
##### `GetImageResult.srcSet.values`
|
|
1410
|
+
|
|
1411
|
+
<p>
|
|
1412
|
+
|
|
1413
|
+
**Type:** <code>\{ transform: <a href="#imagetransform">ImageTransform</a>; descriptor?: string; attributes?: Record\<string, any\>; url: string; \}[]</code>
|
|
1414
|
+
</p>
|
|
1415
|
+
|
|
1416
|
+
An array of generated values where each entry includes a URL and a size descriptor. This can be used to manually generate the value of the `srcset` attribute.
|
|
1417
|
+
|
|
1418
|
+
##### `GetImageResult.srcSet.attribute`
|
|
1419
|
+
|
|
1420
|
+
<p>
|
|
1421
|
+
|
|
1422
|
+
**Type:** `string`
|
|
1423
|
+
</p>
|
|
1424
|
+
|
|
1425
|
+
A value ready to use in the `srcset` attribute.
|
|
1426
|
+
|
|
1427
|
+
### `ImageTransform`
|
|
1428
|
+
|
|
1429
|
+
<p>
|
|
1430
|
+
|
|
1431
|
+
**Type:** `object`
|
|
1432
|
+
</p>
|
|
1433
|
+
|
|
1434
|
+
Defines the options accepted by the image transformation service. This contains a required `src` property, optional predefined properties, and any additional properties required by the image service.
|
|
1435
|
+
|
|
1436
|
+
The predefined properties match those accepted by the [`<Image />` component](#image-), except for `alt` and `sizes`. The following properties use different types.
|
|
1437
|
+
|
|
1438
|
+
#### `ImageTransform.src`
|
|
1439
|
+
|
|
1440
|
+
<p>
|
|
1441
|
+
|
|
1442
|
+
**Type:** <code><a href="#imagemetadata-1">ImageMetadata</a> | string</code>
|
|
1443
|
+
</p>
|
|
1444
|
+
|
|
1445
|
+
Defines the path to a local image in the `public` directory, the URL of a remote image, or the data from an imported image.
|
|
1446
|
+
|
|
1447
|
+
#### `ImageTransform.width`
|
|
1448
|
+
|
|
1449
|
+
<p>
|
|
1450
|
+
|
|
1451
|
+
**Type:** `number | undefined`
|
|
1452
|
+
</p>
|
|
1453
|
+
|
|
1454
|
+
The width of the image.
|
|
1455
|
+
|
|
1456
|
+
#### `ImageTransform.height`
|
|
1457
|
+
|
|
1458
|
+
<p>
|
|
1459
|
+
|
|
1460
|
+
**Type:** `number | undefined`
|
|
1461
|
+
</p>
|
|
1462
|
+
|
|
1463
|
+
The height of the image.
|
|
1464
|
+
|
|
1465
|
+
### `UnresolvedImageTransform`
|
|
1466
|
+
|
|
1467
|
+
<p>
|
|
1468
|
+
|
|
1469
|
+
**Type:** <code>Omit\<<a href="#imagetransform">ImageTransform</a>, "src"\> & \{ src: <a href="#imagemetadata-1">ImageMetadata</a> | string | Promise\<\{ default: ImageMetadata \}\>; inferSize?: boolean; \}</code>
|
|
1470
|
+
</p>
|
|
1471
|
+
|
|
1472
|
+
Represents an image with transformation options. This contains the same properties as the [`ImageTransform` type](#imagetransform) with a different `src` type and an additional `inferSize` property.
|
|
1473
|
+
|
|
1474
|
+
#### `UnresolvedImageTransform.src`
|
|
1475
|
+
|
|
1476
|
+
<p>
|
|
1477
|
+
|
|
1478
|
+
**Type:** <code><a href="#imagemetadata-1">ImageMetadata</a> | string | Promise\<\{ default: ImageMetadata \}\></code>
|
|
1479
|
+
</p>
|
|
1480
|
+
|
|
1481
|
+
The path to an image imported or located in the `public` directory, or the URL of a remote image.
|
|
1482
|
+
|
|
1483
|
+
#### `UnresolvedImageTransform.inferSize`
|
|
1484
|
+
|
|
1485
|
+
<p>
|
|
1486
|
+
|
|
1487
|
+
**Type:** `boolean`
|
|
1488
|
+
</p>
|
|
1489
|
+
|
|
1490
|
+
Determines whether the width and height of the image should be inferred.
|
|
1491
|
+
|
|
1492
|
+
<ReadMore>See also the [`inferSize` attribute](/en/reference/modules/astro-assets/#infersize) available on `<Image />`.</ReadMore>
|
|
1493
|
+
|
|
1494
|
+
### `ImageMetadata`
|
|
1495
|
+
|
|
1496
|
+
<p>
|
|
1497
|
+
|
|
1498
|
+
**Type:** <code>\{ src: string; width: number; height: number; format: <a href="#imageinputformat">ImageInputFormat</a>; orientation?: number; \}</code><br />
|
|
1499
|
+
<Since v="2.1.3" />
|
|
1500
|
+
</p>
|
|
1501
|
+
|
|
1502
|
+
Describes the data collected during image import. This contains the following properties:
|
|
1503
|
+
|
|
1504
|
+
#### `ImageMetadata.src`
|
|
1505
|
+
|
|
1506
|
+
<p>
|
|
1507
|
+
|
|
1508
|
+
**Type:** `string`
|
|
1509
|
+
</p>
|
|
1510
|
+
|
|
1511
|
+
The absolute path of the image on the filesystem.
|
|
1512
|
+
|
|
1513
|
+
#### `ImageMetadata.width`
|
|
1514
|
+
|
|
1515
|
+
<p>
|
|
1516
|
+
|
|
1517
|
+
**Type:** `number`
|
|
1518
|
+
</p>
|
|
1519
|
+
|
|
1520
|
+
The width of the image.
|
|
1521
|
+
|
|
1522
|
+
#### `ImageMetadata.height`
|
|
1523
|
+
|
|
1524
|
+
<p>
|
|
1525
|
+
|
|
1526
|
+
**Type:** `number`
|
|
1527
|
+
</p>
|
|
1528
|
+
|
|
1529
|
+
The height of the image.
|
|
1530
|
+
|
|
1531
|
+
#### `ImageMetadata.format`
|
|
1532
|
+
|
|
1533
|
+
<p>
|
|
1534
|
+
|
|
1535
|
+
**Type:** [`ImageInputFormat`](#imageinputformat)
|
|
1536
|
+
</p>
|
|
1537
|
+
|
|
1538
|
+
The format of the image.
|
|
1539
|
+
|
|
1540
|
+
#### `ImageMetadata.orientation`
|
|
1541
|
+
|
|
1542
|
+
<p>
|
|
1543
|
+
|
|
1544
|
+
**Type:** `number`<br />
|
|
1545
|
+
<Since v="2.8.3" />
|
|
1546
|
+
</p>
|
|
1547
|
+
|
|
1548
|
+
The image orientation when its metadata contains this information.
|
|
1549
|
+
|
|
1550
|
+
### `ImageInputFormat`
|
|
1551
|
+
|
|
1552
|
+
<p>
|
|
1553
|
+
|
|
1554
|
+
**Type:** `"jpeg" | "jpg" | "png" | "tiff" | "webp" | "gif" | "svg" | "avif"`<br />
|
|
1555
|
+
<Since v="2.2.0" />
|
|
1556
|
+
</p>
|
|
1557
|
+
|
|
1558
|
+
Describes a union of supported formats for imported images.
|
|
1559
|
+
|
|
1560
|
+
### `ImageOutputFormat`
|
|
1561
|
+
|
|
1562
|
+
<p>
|
|
1563
|
+
|
|
1564
|
+
**Type:** `string | "jpeg" | "jpg" | "png" | "webp" | "svg" | "avif"`<br />
|
|
1565
|
+
<Since v="2.2.0" />
|
|
1566
|
+
</p>
|
|
1567
|
+
|
|
1568
|
+
Specifies the format for output images. This can be a predefined literal or any string.
|
|
1569
|
+
|
|
1570
|
+
### `ImageQuality`
|
|
1571
|
+
|
|
1572
|
+
<p>
|
|
1573
|
+
|
|
1574
|
+
**Type:** <code><a href="#imagequalitypreset">ImageQualityPreset</a> | number</code><br />
|
|
1575
|
+
<Since v="2.2.0" />
|
|
1576
|
+
</p>
|
|
1577
|
+
|
|
1578
|
+
Represents the perceptual quality of the output image as a union of predefined literals, a string, or a number.
|
|
1579
|
+
|
|
1580
|
+
### `ImageQualityPreset`
|
|
1581
|
+
|
|
1582
|
+
<p>
|
|
1583
|
+
|
|
1584
|
+
**Type:** `string | "low" | "mid" | "high" | "max"`<br />
|
|
1585
|
+
<Since v="2.2.0" />
|
|
1586
|
+
</p>
|
|
1587
|
+
|
|
1588
|
+
Defines the available presets to control image quality, extensible with any string.
|
|
1589
|
+
|
|
1590
|
+
### `RemotePattern`
|
|
1591
|
+
|
|
1592
|
+
<p>
|
|
1593
|
+
|
|
1594
|
+
**Type:** `{ hostname?: string; pathname?: string; protocol?: string; port?: string; }`<br />
|
|
1595
|
+
<Since v="5.14.2" />
|
|
1596
|
+
</p>
|
|
1597
|
+
|
|
1598
|
+
Describes a remote host through four optional properties: `hostname`, `pathname`, `protocol`, and `port`.
|
|
1599
|
+
|
|
1600
|
+
### `ImageService`
|
|
1601
|
+
|
|
1602
|
+
<p>
|
|
1603
|
+
|
|
1604
|
+
**Type:** <code><a href="#externalimageservice">ExternalImageService</a> | <a href="#localimageservice">LocalImageService</a></code>
|
|
1605
|
+
</p>
|
|
1606
|
+
|
|
1607
|
+
Defines the hooks that a local or external image service must provide.
|
|
1608
|
+
|
|
1609
|
+
### `ExternalImageService`
|
|
1610
|
+
|
|
1611
|
+
<p>
|
|
1612
|
+
|
|
1613
|
+
**Type:** `object`
|
|
1614
|
+
</p>
|
|
1615
|
+
|
|
1616
|
+
Defines the hooks that an external image transformation service must provide. This requires a [`getUrl()` hook](/en/reference/image-service-reference/#geturl) and supports [three additional hooks](/en/reference/image-service-reference/#hooks).
|
|
1617
|
+
|
|
1618
|
+
<ReadMore>Learn how to build [external services](/en/reference/image-service-reference/#external-services) in the Image Service API reference with example usage.</ReadMore>
|
|
1619
|
+
|
|
1620
|
+
### `LocalImageService`
|
|
1621
|
+
|
|
1622
|
+
<p>
|
|
1623
|
+
|
|
1624
|
+
**Type:** `object`
|
|
1625
|
+
</p>
|
|
1626
|
+
|
|
1627
|
+
Defines the hooks that a local image transformation service must provide. This requires [`getUrl()`](/en/reference/image-service-reference/#geturl), [`parseUrl()`](/en/reference/image-service-reference/#parseurl), and [`transform()`](/en/reference/image-service-reference/#transform) hooks, and supports [additional hooks](/en/reference/image-service-reference/#hooks).
|
|
1628
|
+
|
|
1629
|
+
<ReadMore>Learn how to build [local services](/en/reference/image-service-reference/#local-services) in the Image Service API reference with example usage.</ReadMore>
|
|
1630
|
+
|
|
1631
|
+
### `ImageServiceConfig`
|
|
1632
|
+
|
|
1633
|
+
<p>
|
|
1634
|
+
|
|
1635
|
+
**Type:** `{ entrypoint: 'astro/assets/services/sharp' | string; config?: T; }`<br />
|
|
1636
|
+
<Since v="2.3.3" />
|
|
1637
|
+
</p>
|
|
1638
|
+
|
|
1639
|
+
Describes the configuration object for an image service. This contains the following properties:
|
|
1640
|
+
|
|
1641
|
+
#### `ImageServiceConfig.entrypoint`
|
|
1642
|
+
|
|
1643
|
+
<p>
|
|
1644
|
+
|
|
1645
|
+
**Type:** `'astro/assets/services/sharp' | string`
|
|
1646
|
+
</p>
|
|
1647
|
+
|
|
1648
|
+
A package or path to the image service module. This can be Astro's built-in Sharp service or a third-party service.
|
|
1649
|
+
|
|
1650
|
+
#### `ImageServiceConfig.config`
|
|
1651
|
+
|
|
1652
|
+
<p>
|
|
1653
|
+
|
|
1654
|
+
**Type:** `Record<string, any>`
|
|
1655
|
+
</p>
|
|
1656
|
+
|
|
1657
|
+
A configuration object passed to the image service. The shape depends on the specific service being used.
|