astro 7.0.0-alpha.0 → 7.0.0-alpha.2
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/components/Code.astro +1 -1
- package/dist/actions/handler.d.ts +32 -0
- package/dist/actions/handler.js +45 -0
- package/dist/actions/runtime/server.js +1 -1
- package/dist/assets/build/generate.js +1 -1
- package/dist/assets/build/remote.d.ts +3 -2
- package/dist/assets/build/remote.js +16 -9
- package/dist/assets/endpoint/dev.js +1 -1
- package/dist/assets/endpoint/generic.js +8 -20
- package/dist/assets/endpoint/loadImage.d.ts +11 -0
- package/dist/assets/endpoint/loadImage.js +19 -0
- package/dist/assets/endpoint/shared.js +7 -2
- package/dist/assets/fonts/config.d.ts +4 -4
- package/dist/assets/fonts/core/optimize-fallbacks.js +38 -13
- package/dist/assets/fonts/definitions.d.ts +2 -2
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +2 -2
- package/dist/assets/fonts/infra/system-fallbacks-provider.js +46 -9
- package/dist/assets/fonts/types.d.ts +1 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.js +2 -0
- package/dist/assets/internal.js +22 -3
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +9 -9
- package/dist/assets/services/sharp.js +53 -18
- package/dist/assets/utils/generateImageStylesCSS.js +26 -6
- package/dist/assets/utils/index.d.ts +1 -0
- package/dist/assets/utils/index.js +2 -0
- package/dist/assets/utils/inferSourceFormat.d.ts +8 -3
- package/dist/assets/utils/inferSourceFormat.js +15 -4
- package/dist/assets/utils/metadata.js +1 -1
- package/dist/assets/utils/redirectValidation.d.ts +48 -0
- package/dist/assets/utils/redirectValidation.js +48 -0
- package/dist/assets/utils/remoteProbe.js +25 -2
- package/dist/assets/utils/vendor/image-size/types/svg.js +1 -1
- package/dist/cli/add/index.js +7 -58
- package/dist/cli/dev/background.d.ts +16 -0
- package/dist/cli/dev/background.js +116 -0
- package/dist/cli/dev/index.js +82 -3
- package/dist/cli/dev/logs.d.ts +6 -0
- package/dist/cli/dev/logs.js +72 -0
- package/dist/cli/dev/status.d.ts +15 -0
- package/dist/cli/dev/status.js +27 -0
- package/dist/cli/dev/stop.d.ts +12 -0
- package/dist/cli/dev/stop.js +43 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.js +18 -14
- package/dist/content/content-layer.js +16 -11
- package/dist/content/data-store.d.ts +1 -1
- package/dist/content/loaders/types.d.ts +1 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/runtime.d.ts +1 -1
- package/dist/content/runtime.js +9 -4
- package/dist/content/server-listeners.js +0 -4
- package/dist/content/types-generator.js +5 -1
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +1 -1
- package/dist/content/vite-plugin-content-assets.js +1 -0
- package/dist/content/vite-plugin-content-virtual-mod.js +9 -1
- package/dist/core/app/base.d.ts +42 -15
- package/dist/core/app/base.js +151 -375
- package/dist/core/app/dev/app.d.ts +3 -2
- package/dist/core/app/dev/app.js +4 -60
- package/dist/core/app/entrypoints/node.d.ts +1 -1
- package/dist/core/app/entrypoints/node.js +2 -0
- package/dist/core/app/entrypoints/virtual/dev.js +2 -0
- package/dist/core/app/entrypoints/virtual/prod.js +4 -1
- package/dist/core/app/node.d.ts +16 -0
- package/dist/core/app/node.js +59 -13
- package/dist/core/app/prepare-response.d.ts +11 -0
- package/dist/core/app/prepare-response.js +18 -0
- package/dist/core/app/render-options.d.ts +11 -0
- package/dist/core/app/render-options.js +11 -0
- package/dist/core/base-pipeline.d.ts +48 -1
- package/dist/core/base-pipeline.js +63 -8
- package/dist/core/build/app.d.ts +3 -4
- package/dist/core/build/app.js +3 -17
- package/dist/core/build/generate.js +8 -1
- package/dist/core/build/index.d.ts +0 -11
- package/dist/core/build/index.js +0 -3
- package/dist/core/build/internal.d.ts +7 -0
- package/dist/core/build/plugins/plugin-chunk-imports.d.ts +6 -0
- package/dist/core/build/plugins/plugin-chunk-imports.js +29 -17
- package/dist/core/build/plugins/plugin-css.js +40 -1
- package/dist/core/build/plugins/plugin-internals.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.js +11 -1
- package/dist/core/build/static-build.js +22 -141
- package/dist/core/build/types.d.ts +0 -1
- package/dist/core/build/util.js +8 -1
- package/dist/core/build/vite-build-config.d.ts +28 -0
- package/dist/core/build/vite-build-config.js +165 -0
- package/dist/core/cache/handler.d.ts +29 -0
- package/dist/core/cache/handler.js +81 -0
- package/dist/core/compile/style.js +18 -1
- package/dist/core/config/index.d.ts +1 -1
- package/dist/core/config/index.js +4 -1
- package/dist/core/config/merge.js +4 -0
- package/dist/core/config/schemas/base.d.ts +25 -13
- package/dist/core/config/schemas/base.js +39 -10
- package/dist/core/config/schemas/relative.d.ts +76 -49
- package/dist/core/config/schemas/relative.js +2 -3
- package/dist/core/config/settings.js +2 -4
- package/dist/core/config/tsconfig.d.ts +24 -9
- package/dist/core/config/tsconfig.js +54 -45
- package/dist/core/config/validate.js +59 -0
- package/dist/core/constants.d.ts +27 -1
- package/dist/core/constants.js +14 -1
- package/dist/core/cookies/cookies.d.ts +7 -2
- package/dist/core/cookies/cookies.js +11 -4
- package/dist/core/cookies/response.d.ts +1 -1
- package/dist/core/cookies/response.js +1 -2
- package/dist/core/create-vite.js +18 -1
- package/dist/core/csp/config.js +17 -5
- package/dist/core/csp/runtime.js +6 -4
- package/dist/core/dev/dev.d.ts +1 -0
- package/dist/core/dev/dev.js +4 -13
- package/dist/core/dev/lockfile.d.ts +54 -0
- package/dist/core/dev/lockfile.js +93 -0
- package/dist/core/errors/build-handler.d.ts +17 -0
- package/dist/core/errors/build-handler.js +22 -0
- package/dist/core/errors/default-handler.d.ts +14 -0
- package/dist/core/errors/default-handler.js +144 -0
- package/dist/core/errors/dev-handler.d.ts +21 -0
- package/dist/core/errors/dev-handler.js +82 -0
- package/dist/core/errors/errors-data.d.ts +43 -38
- package/dist/core/errors/errors-data.js +79 -73
- package/dist/core/errors/handler.d.ts +9 -0
- package/dist/core/errors/handler.js +0 -0
- package/dist/core/errors/zod-error-map.js +30 -1
- package/dist/core/fetch/default-handler.d.ts +17 -0
- package/dist/core/fetch/default-handler.js +45 -0
- package/dist/core/fetch/fetch-state.d.ts +230 -0
- package/dist/core/fetch/fetch-state.js +896 -0
- package/dist/core/fetch/index.d.ts +61 -0
- package/dist/core/fetch/index.js +121 -0
- package/dist/core/fetch/types.d.ts +25 -0
- package/dist/core/fetch/types.js +0 -0
- package/dist/core/fetch/vite-plugin.d.ts +5 -0
- package/dist/core/fetch/vite-plugin.js +76 -0
- package/dist/core/hono/index.d.ts +21 -0
- package/dist/core/hono/index.js +101 -0
- package/dist/core/i18n/domain.d.ts +12 -0
- package/dist/core/i18n/domain.js +66 -0
- package/dist/core/i18n/handler.d.ts +18 -0
- package/dist/core/i18n/handler.js +122 -0
- package/dist/core/logger/core.d.ts +9 -1
- package/dist/core/logger/core.js +17 -1
- package/dist/core/messages/runtime.d.ts +0 -3
- package/dist/core/messages/runtime.js +1 -9
- package/dist/core/middleware/astro-middleware.d.ts +27 -0
- package/dist/core/middleware/astro-middleware.js +51 -0
- package/dist/core/module-loader/vite.js +1 -2
- package/dist/core/pages/handler.d.ts +20 -0
- package/dist/core/pages/handler.js +75 -0
- package/dist/core/preview/index.js +6 -5
- package/dist/core/preview/static-preview-server.js +5 -2
- package/dist/core/redirects/render.d.ts +2 -2
- package/dist/core/redirects/render.js +7 -8
- package/dist/core/render/params-and-props.js +2 -2
- package/dist/core/render/route-cache.d.ts +1 -0
- package/dist/core/render/route-cache.js +4 -4
- package/dist/core/render/slots.js +9 -2
- package/dist/core/rewrites/handler.d.ts +37 -0
- package/dist/core/rewrites/handler.js +67 -0
- package/dist/core/routing/3xx.js +8 -4
- package/dist/core/routing/create-manifest.js +11 -1
- package/dist/core/routing/handler.d.ts +17 -0
- package/dist/core/routing/handler.js +171 -0
- package/dist/core/routing/match.d.ts +0 -7
- package/dist/core/routing/match.js +0 -5
- package/dist/core/routing/parse-route.js +1 -1
- package/dist/core/routing/pattern.js +1 -1
- package/dist/core/routing/rewrite.js +2 -5
- package/dist/core/routing/router.d.ts +8 -0
- package/dist/core/routing/router.js +28 -0
- package/dist/core/routing/trailing-slash-handler.d.ts +18 -0
- package/dist/core/routing/trailing-slash-handler.js +67 -0
- package/dist/core/routing/validation.js +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +6 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +13 -3
- package/dist/core/session/config.d.ts +1 -1
- package/dist/core/session/drivers.d.ts +1 -1
- package/dist/core/session/handler.d.ts +11 -0
- package/dist/core/session/handler.js +33 -0
- package/dist/core/session/runtime.js +7 -2
- package/dist/core/util/normalized-url.d.ts +10 -0
- package/dist/core/util/normalized-url.js +24 -0
- package/dist/core/util/pathname.d.ts +10 -1
- package/dist/core/util/pathname.js +13 -4
- package/dist/environments.js +1 -1
- package/dist/events/session.d.ts +8 -0
- package/dist/events/session.js +11 -0
- package/dist/i18n/middleware.d.ts +10 -0
- package/dist/i18n/middleware.js +4 -88
- package/dist/i18n/utils.js +2 -2
- package/dist/jsx/rehype.d.ts +1 -1
- package/dist/manifest/virtual-module.js +3 -1
- package/dist/markdown/index.d.ts +4 -0
- package/dist/markdown/index.js +14 -0
- package/dist/prefetch/index.js +12 -7
- package/dist/prerender/utils.js +5 -1
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js +9 -0
- package/dist/runtime/server/astro-island.js +57 -20
- package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
- package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -1
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/common.js +10 -4
- package/dist/runtime/server/render/component.js +8 -6
- package/dist/runtime/server/render/head.js +1 -5
- package/dist/runtime/server/render/server-islands.js +2 -1
- package/dist/runtime/server/render/util.js +2 -2
- package/dist/runtime/server/scripts.js +6 -0
- package/dist/runtime/server/transition.d.ts +1 -6
- package/dist/runtime/server/transition.js +0 -8
- package/dist/transitions/events.d.ts +0 -14
- package/dist/transitions/events.js +0 -14
- package/dist/transitions/index.d.ts +0 -1
- package/dist/transitions/index.js +0 -2
- package/dist/transitions/vite-plugin-transitions.js +2 -4
- package/dist/types/public/config.d.ts +96 -14
- package/dist/types/public/content.d.ts +5 -5
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +11 -3
- package/dist/types/public/internal.d.ts +1 -1
- package/dist/types/public/manifest.d.ts +1 -1
- package/dist/virtual-modules/i18n.d.ts +2 -2
- package/dist/virtual-modules/i18n.js +1 -1
- package/dist/vite-plugin-app/app.d.ts +13 -6
- package/dist/vite-plugin-app/app.js +51 -89
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +3 -1
- package/dist/vite-plugin-app/createAstroServerApp.js +4 -3
- package/dist/vite-plugin-astro-server/plugin.js +11 -5
- package/dist/vite-plugin-astro-server/route-guard.d.ts +33 -0
- package/dist/vite-plugin-astro-server/route-guard.js +42 -23
- package/dist/vite-plugin-dev-status/index.d.ts +2 -0
- package/dist/vite-plugin-dev-status/index.js +15 -0
- package/dist/vite-plugin-head/index.js +36 -19
- package/dist/vite-plugin-hmr-reload/index.d.ts +1 -1
- package/dist/vite-plugin-hmr-reload/index.js +23 -1
- package/dist/vite-plugin-integrations-container/index.js +15 -6
- package/dist/vite-plugin-markdown/content-entry-type.js +7 -4
- package/dist/vite-plugin-markdown/images.js +9 -11
- package/dist/vite-plugin-markdown/index.js +12 -11
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +10 -1
- package/package.json +23 -16
- package/templates/content/types.d.ts +1 -0
- package/types/transitions.d.ts +0 -7
- package/dist/core/render-context.d.ts +0 -77
- package/dist/core/render-context.js +0 -826
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BaseApp } from '../app/base.js';
|
|
2
|
+
import type { FetchState } from '../fetch/fetch-state.js';
|
|
3
|
+
import type { Pipeline } from '../base-pipeline.js';
|
|
4
|
+
/**
|
|
5
|
+
* Registers a cache provider on the given `FetchState`. When
|
|
6
|
+
* `state.resolve('cache')` is first called, the appropriate cache
|
|
7
|
+
* implementation is created (disabled, noop for dev, or real).
|
|
8
|
+
*
|
|
9
|
+
* Returns synchronously when cache is not configured or in dev mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare function provideCache(state: FetchState): Promise<void> | void;
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a render callback with cache provider logic. Handles both
|
|
14
|
+
* runtime caching (onRequest) and CDN-based providers (headers only).
|
|
15
|
+
*
|
|
16
|
+
* - When a cache provider with `onRequest` is configured, the callback
|
|
17
|
+
* is wrapped so the provider can serve from cache or fall through.
|
|
18
|
+
* - When only CDN headers are needed, the callback runs directly and
|
|
19
|
+
* cache headers are applied to the response.
|
|
20
|
+
* - When no cache provider is configured, the callback runs as-is.
|
|
21
|
+
*
|
|
22
|
+
* Cache headers (`CDN-Cache-Control`, `Cache-Tag`) are stripped from
|
|
23
|
+
* the final response after the runtime provider has read them.
|
|
24
|
+
*/
|
|
25
|
+
export declare class CacheHandler {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(app: BaseApp<Pipeline>);
|
|
28
|
+
handle(state: FetchState, next: () => Promise<Response>): Promise<Response>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { PipelineFeatures } from "../base-pipeline.js";
|
|
2
|
+
import { AstroCache, applyCacheHeaders } from "./runtime/cache.js";
|
|
3
|
+
import { NoopAstroCache, DisabledAstroCache } from "./runtime/noop.js";
|
|
4
|
+
import { compileCacheRoutes, matchCacheRoute } from "./runtime/route-matching.js";
|
|
5
|
+
const CACHE_KEY = "cache";
|
|
6
|
+
function provideCache(state) {
|
|
7
|
+
const pipeline = state.pipeline;
|
|
8
|
+
if (!pipeline.cacheConfig) {
|
|
9
|
+
state.provide(CACHE_KEY, {
|
|
10
|
+
create: () => new DisabledAstroCache(pipeline.logger)
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (pipeline.runtimeMode === "development") {
|
|
15
|
+
state.provide(CACHE_KEY, {
|
|
16
|
+
create: () => new NoopAstroCache()
|
|
17
|
+
});
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return provideCacheAsync(state, pipeline);
|
|
21
|
+
}
|
|
22
|
+
async function provideCacheAsync(state, pipeline) {
|
|
23
|
+
const cacheProvider = await pipeline.getCacheProvider();
|
|
24
|
+
state.provide(CACHE_KEY, {
|
|
25
|
+
create() {
|
|
26
|
+
const cache = new AstroCache(cacheProvider);
|
|
27
|
+
if (pipeline.cacheConfig?.routes) {
|
|
28
|
+
if (!pipeline.compiledCacheRoutes) {
|
|
29
|
+
pipeline.compiledCacheRoutes = compileCacheRoutes(
|
|
30
|
+
pipeline.cacheConfig.routes,
|
|
31
|
+
pipeline.manifest.base,
|
|
32
|
+
pipeline.manifest.trailingSlash
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const matched = matchCacheRoute(state.pathname, pipeline.compiledCacheRoutes);
|
|
36
|
+
if (matched) {
|
|
37
|
+
cache.set(matched);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return cache;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
class CacheHandler {
|
|
45
|
+
#app;
|
|
46
|
+
constructor(app) {
|
|
47
|
+
this.#app = app;
|
|
48
|
+
}
|
|
49
|
+
async handle(state, next) {
|
|
50
|
+
this.#app.pipeline.usedFeatures |= PipelineFeatures.cache;
|
|
51
|
+
if (!this.#app.pipeline.cacheProvider) {
|
|
52
|
+
return next();
|
|
53
|
+
}
|
|
54
|
+
const cache = state.resolve(CACHE_KEY);
|
|
55
|
+
const cacheProvider = await this.#app.pipeline.getCacheProvider();
|
|
56
|
+
if (cacheProvider?.onRequest) {
|
|
57
|
+
const response2 = await cacheProvider.onRequest(
|
|
58
|
+
{
|
|
59
|
+
request: state.request,
|
|
60
|
+
url: new URL(state.request.url),
|
|
61
|
+
waitUntil: state.renderOptions.waitUntil
|
|
62
|
+
},
|
|
63
|
+
async () => {
|
|
64
|
+
const res = await next();
|
|
65
|
+
applyCacheHeaders(cache, res);
|
|
66
|
+
return res;
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
response2.headers.delete("CDN-Cache-Control");
|
|
70
|
+
response2.headers.delete("Cache-Tag");
|
|
71
|
+
return response2;
|
|
72
|
+
}
|
|
73
|
+
const response = await next();
|
|
74
|
+
applyCacheHeaders(cache, response);
|
|
75
|
+
return response;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
CacheHandler,
|
|
80
|
+
provideCache
|
|
81
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { preprocessCSS } from "vite";
|
|
3
4
|
import { AstroErrorData, CSSError, positionAt } from "../errors/index.js";
|
|
4
5
|
import { normalizePath } from "../viteUtils.js";
|
|
@@ -31,6 +32,21 @@ function rewriteCssUrls(css, base) {
|
|
|
31
32
|
return match;
|
|
32
33
|
});
|
|
33
34
|
}
|
|
35
|
+
function withNestingExcluded(viteConfig) {
|
|
36
|
+
let Features;
|
|
37
|
+
try {
|
|
38
|
+
const requireFromRoot = createRequire(viteConfig.root + "/");
|
|
39
|
+
Features = requireFromRoot("lightningcss").Features;
|
|
40
|
+
} catch {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
const lcss = viteConfig.css?.lightningcss ?? {};
|
|
44
|
+
const prevExclude = lcss.exclude ?? 0;
|
|
45
|
+
return {
|
|
46
|
+
...viteConfig,
|
|
47
|
+
css: { ...viteConfig.css, lightningcss: { ...lcss, exclude: prevExclude | Features.Nesting } }
|
|
48
|
+
};
|
|
49
|
+
}
|
|
34
50
|
function createStylePreprocessor({
|
|
35
51
|
filename,
|
|
36
52
|
viteConfig,
|
|
@@ -44,7 +60,8 @@ function createStylePreprocessor({
|
|
|
44
60
|
const lang = `.${attrs?.lang || "css"}`.toLowerCase();
|
|
45
61
|
const id = `${filename}?astro&type=style&index=${index}&lang${lang}`;
|
|
46
62
|
try {
|
|
47
|
-
const
|
|
63
|
+
const effectiveViteConfig = viteConfig.css?.transformer === "lightningcss" ? withNestingExcluded(viteConfig) ?? viteConfig : viteConfig;
|
|
64
|
+
const result = await preprocessCSS(content, id, effectiveViteConfig);
|
|
48
65
|
const rewrittenCode = rewriteCssUrls(result.code, astroConfig.base);
|
|
49
66
|
cssPartialCompileResults[index] = {
|
|
50
67
|
// Use `in` operator to handle both Go compiler (boolean `true`) and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { resolveConfig, resolveConfigPath, resolveRoot, } from './config.js';
|
|
2
2
|
export { mergeConfig } from './merge.js';
|
|
3
3
|
export { createSettings } from './settings.js';
|
|
4
|
-
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
|
4
|
+
export { loadTSConfig, updateTSConfigForFramework, type TSConfigLoadedResult, type TSConfigResult, } from './tsconfig.js';
|
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
} from "./config.js";
|
|
6
6
|
import { mergeConfig } from "./merge.js";
|
|
7
7
|
import { createSettings } from "./settings.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
loadTSConfig,
|
|
10
|
+
updateTSConfigForFramework
|
|
11
|
+
} from "./tsconfig.js";
|
|
9
12
|
export {
|
|
10
13
|
createSettings,
|
|
11
14
|
loadTSConfig,
|
|
@@ -38,6 +38,10 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
38
38
|
merged[key] = value;
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
+
if (key === "processor" && rootPath === "markdown" && isObject(value) && typeof value.createRenderer === "function") {
|
|
42
|
+
merged[key] = value;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
41
45
|
if (isObject(existing) && isObject(value)) {
|
|
42
46
|
merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
|
|
43
47
|
continue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { RehypePlugin as _RehypePlugin, RemarkPlugin as _RemarkPlugin, RemarkRehype as _RemarkRehype, Smartypants as _Smartypants, ShikiConfig } from '@astrojs/internal-helpers/markdown';
|
|
1
2
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
|
-
import type { RehypePlugin as _RehypePlugin, RemarkPlugin as _RemarkPlugin, RemarkRehype as _RemarkRehype, ShikiConfig, Smartypants as _Smartypants } from '@astrojs/markdown-remark';
|
|
3
3
|
import * as z from 'zod/v4';
|
|
4
4
|
import type { ViteUserConfig } from '../../../types/public/config.js';
|
|
5
5
|
/** @lintignore */
|
|
@@ -43,6 +43,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
43
43
|
entrypoint: "astro/assets/services/sharp";
|
|
44
44
|
config: {};
|
|
45
45
|
};
|
|
46
|
+
dangerouslyProcessSVG: false;
|
|
46
47
|
responsiveStyles: false;
|
|
47
48
|
};
|
|
48
49
|
devToolbar: {
|
|
@@ -56,7 +57,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
56
57
|
allowedHosts: never[];
|
|
57
58
|
};
|
|
58
59
|
integrations: never[];
|
|
59
|
-
markdown: Required<import("@astrojs/markdown-remark").AstroMarkdownOptions
|
|
60
|
+
markdown: Required<Omit<import("@astrojs/markdown-remark").AstroMarkdownOptions, "image">>;
|
|
60
61
|
vite: {};
|
|
61
62
|
legacy: {
|
|
62
63
|
collectionsBackwardsCompat: false;
|
|
@@ -75,6 +76,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
75
76
|
};
|
|
76
77
|
prerenderConflictBehavior: "warn";
|
|
77
78
|
experimental: {
|
|
79
|
+
advancedRouting: false;
|
|
78
80
|
clientPrerender: false;
|
|
79
81
|
contentIntellisense: false;
|
|
80
82
|
chromeDevtoolsWorkspace: false;
|
|
@@ -102,10 +104,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
102
104
|
name: z.ZodString;
|
|
103
105
|
hooks: z.ZodDefault<z.ZodObject<{}, z.core.$loose>>;
|
|
104
106
|
}, z.core.$strip>>;
|
|
105
|
-
integrations: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.
|
|
107
|
+
integrations: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
106
108
|
name: z.ZodString;
|
|
107
109
|
hooks: z.ZodDefault<z.ZodObject<{}, z.core.$loose>>;
|
|
108
|
-
}, z.core.$strip
|
|
110
|
+
}, z.core.$strip>>>>>;
|
|
109
111
|
build: z.ZodPrefault<z.ZodObject<{
|
|
110
112
|
format: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"file">, z.ZodLiteral<"directory">, z.ZodLiteral<"preserve">]>>>;
|
|
111
113
|
client: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>;
|
|
@@ -118,12 +120,12 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
118
120
|
redirects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
119
121
|
inlineStylesheets: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
120
122
|
never: "never";
|
|
121
|
-
auto: "auto";
|
|
122
123
|
always: "always";
|
|
124
|
+
auto: "auto";
|
|
123
125
|
}>>>;
|
|
124
126
|
concurrency: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
125
127
|
}, z.core.$strip>>;
|
|
126
|
-
server: z.ZodPipe<z.ZodTransform<any, unknown>, z.
|
|
128
|
+
server: z.ZodPrefault<z.ZodPipe<z.ZodTransform<any, unknown>, z.ZodObject<{
|
|
127
129
|
open: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
128
130
|
host: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
129
131
|
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -137,10 +139,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
137
139
|
prefetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
138
140
|
prefetchAll: z.ZodOptional<z.ZodBoolean>;
|
|
139
141
|
defaultStrategy: z.ZodOptional<z.ZodEnum<{
|
|
140
|
-
load: "load";
|
|
141
142
|
tap: "tap";
|
|
142
143
|
hover: "hover";
|
|
143
144
|
viewport: "viewport";
|
|
145
|
+
load: "load";
|
|
144
146
|
}>>;
|
|
145
147
|
}, z.core.$strip>]>>;
|
|
146
148
|
image: z.ZodPrefault<z.ZodObject<{
|
|
@@ -152,6 +154,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
152
154
|
entrypoint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"astro/assets/services/sharp">, z.ZodString]>>;
|
|
153
155
|
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
154
156
|
}, z.core.$strip>>;
|
|
157
|
+
dangerouslyProcessSVG: z.ZodDefault<z.ZodBoolean>;
|
|
155
158
|
domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
156
159
|
remotePatterns: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
157
160
|
protocol: z.ZodOptional<z.ZodString>;
|
|
@@ -161,9 +164,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
161
164
|
}, z.core.$strip>>>;
|
|
162
165
|
layout: z.ZodOptional<z.ZodEnum<{
|
|
163
166
|
fixed: "fixed";
|
|
164
|
-
none: "none";
|
|
165
167
|
constrained: "constrained";
|
|
166
168
|
"full-width": "full-width";
|
|
169
|
+
none: "none";
|
|
167
170
|
}>>;
|
|
168
171
|
objectFit: z.ZodOptional<z.ZodString>;
|
|
169
172
|
objectPosition: z.ZodOptional<z.ZodString>;
|
|
@@ -327,8 +330,14 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
327
330
|
remarkPlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodCustom<RemarkPlugin, RemarkPlugin>, z.ZodTuple<[z.ZodCustom<RemarkPlugin, RemarkPlugin>, z.ZodAny], null>]>>>;
|
|
328
331
|
rehypePlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodCustom<RehypePlugin, RehypePlugin>, z.ZodTuple<[z.ZodCustom<RehypePlugin, RehypePlugin>, z.ZodAny], null>]>>>;
|
|
329
332
|
remarkRehype: z.ZodDefault<z.ZodCustom<RemarkRehype, RemarkRehype>>;
|
|
330
|
-
gfm: z.
|
|
331
|
-
smartypants: z.
|
|
333
|
+
gfm: z.ZodOptional<z.ZodBoolean>;
|
|
334
|
+
smartypants: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<Smartypants, unknown, z.core.$ZodTypeInternals<Smartypants, unknown>>]>, z.ZodTransform<false | Smartypants, boolean | Smartypants>>>;
|
|
335
|
+
processor: z.ZodDefault<z.ZodObject<{
|
|
336
|
+
name: z.ZodString;
|
|
337
|
+
options: z.ZodDefault<z.ZodCustom<object, object>>;
|
|
338
|
+
createRenderer: z.ZodCustom<(shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>, (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>>;
|
|
339
|
+
createMdxRenderer: z.ZodOptional<z.ZodCustom<((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined, ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined>>;
|
|
340
|
+
}, z.core.$strip>>;
|
|
332
341
|
}, z.core.$strip>>;
|
|
333
342
|
vite: z.ZodDefault<z.ZodCustom<ViteUserConfig, ViteUserConfig>>;
|
|
334
343
|
i18n: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
@@ -438,9 +447,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
438
447
|
path: z.ZodOptional<z.ZodString>;
|
|
439
448
|
maxAge: z.ZodOptional<z.ZodNumber>;
|
|
440
449
|
sameSite: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
450
|
+
none: "none";
|
|
441
451
|
strict: "strict";
|
|
442
452
|
lax: "lax";
|
|
443
|
-
none: "none";
|
|
444
453
|
}>, z.ZodBoolean]>>;
|
|
445
454
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
446
455
|
}, z.core.$strip>, z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
@@ -484,11 +493,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
484
493
|
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
485
494
|
optimizedFallbacks: z.ZodOptional<z.ZodBoolean>;
|
|
486
495
|
display: z.ZodOptional<z.ZodEnum<{
|
|
487
|
-
optional: "optional";
|
|
488
496
|
auto: "auto";
|
|
497
|
+
optional: "optional";
|
|
498
|
+
fallback: "fallback";
|
|
489
499
|
block: "block";
|
|
490
500
|
swap: "swap";
|
|
491
|
-
fallback: "fallback";
|
|
492
501
|
}>>;
|
|
493
502
|
stretch: z.ZodOptional<z.ZodString>;
|
|
494
503
|
featureSettings: z.ZodOptional<z.ZodString>;
|
|
@@ -497,6 +506,9 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
497
506
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
498
507
|
}, z.core.$strict>>>;
|
|
499
508
|
experimental: z.ZodPrefault<z.ZodObject<{
|
|
509
|
+
advancedRouting: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
510
|
+
fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
511
|
+
}, z.core.$strict>]>>>;
|
|
500
512
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
501
513
|
contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
502
514
|
chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
markdownConfigDefaults,
|
|
3
|
+
syntaxHighlightDefaults
|
|
4
|
+
} from "@astrojs/internal-helpers/markdown";
|
|
5
|
+
import { unified } from "@astrojs/markdown-remark";
|
|
2
6
|
import { bundledThemes } from "shiki";
|
|
3
7
|
import * as z from "zod/v4";
|
|
4
8
|
import { FontFamilySchema } from "../../../assets/fonts/config.js";
|
|
9
|
+
import { SvgOptimizerSchema } from "../../../assets/svg/config.js";
|
|
5
10
|
import { EnvSchema } from "../../../env/schema.js";
|
|
6
|
-
import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from "../../csp/config.js";
|
|
7
11
|
import { CacheSchema, RouteRulesSchema } from "../../cache/config.js";
|
|
12
|
+
import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from "../../csp/config.js";
|
|
8
13
|
import { SessionSchema } from "../../session/config.js";
|
|
9
|
-
import { SvgOptimizerSchema } from "../../../assets/svg/config.js";
|
|
10
14
|
const ASTRO_CONFIG_DEFAULTS = {
|
|
11
15
|
root: ".",
|
|
12
16
|
srcDir: "./src",
|
|
@@ -28,6 +32,7 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
28
32
|
image: {
|
|
29
33
|
endpoint: { entrypoint: void 0, route: "/_image" },
|
|
30
34
|
service: { entrypoint: "astro/assets/services/sharp", config: {} },
|
|
35
|
+
dangerouslyProcessSVG: false,
|
|
31
36
|
responsiveStyles: false
|
|
32
37
|
},
|
|
33
38
|
devToolbar: {
|
|
@@ -60,6 +65,7 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
60
65
|
},
|
|
61
66
|
prerenderConflictBehavior: "warn",
|
|
62
67
|
experimental: {
|
|
68
|
+
advancedRouting: false,
|
|
63
69
|
clientPrerender: false,
|
|
64
70
|
contentIntellisense: false,
|
|
65
71
|
chromeDevtoolsWorkspace: false,
|
|
@@ -104,13 +110,13 @@ const AstroConfigSchema = z.object({
|
|
|
104
110
|
message: 'The `output: "hybrid"` option has been removed. Use `output: "static"` (the default) instead, which now behaves the same way.'
|
|
105
111
|
}),
|
|
106
112
|
scopedStyleStrategy: z.union([z.literal("where"), z.literal("class"), z.literal("attribute")]).optional().default("attribute"),
|
|
107
|
-
adapter: z.object({ name: z.string(), hooks: z.object({}).
|
|
113
|
+
adapter: z.object({ name: z.string(), hooks: z.object({}).loose().default({}) }).optional(),
|
|
108
114
|
integrations: z.preprocess(
|
|
109
115
|
// preprocess
|
|
110
116
|
(val) => Array.isArray(val) ? val.flat(Number.POSITIVE_INFINITY).filter(Boolean) : val,
|
|
111
117
|
// validate
|
|
112
|
-
z.array(z.object({ name: z.string(), hooks: z.object({}).
|
|
113
|
-
),
|
|
118
|
+
z.array(z.object({ name: z.string(), hooks: z.object({}).loose().default({}) }))
|
|
119
|
+
).optional().default(ASTRO_CONFIG_DEFAULTS.integrations),
|
|
114
120
|
build: z.object({
|
|
115
121
|
format: z.union([z.literal("file"), z.literal("directory"), z.literal("preserve")]).optional().default(ASTRO_CONFIG_DEFAULTS.build.format),
|
|
116
122
|
client: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.client).transform((val) => new URL(val)),
|
|
@@ -134,8 +140,8 @@ const AstroConfigSchema = z.object({
|
|
|
134
140
|
port: z.number().optional().default(ASTRO_CONFIG_DEFAULTS.server.port),
|
|
135
141
|
headers: z.custom().optional(),
|
|
136
142
|
allowedHosts: z.union([z.array(z.string()), z.literal(true)]).optional().default(ASTRO_CONFIG_DEFAULTS.server.allowedHosts)
|
|
137
|
-
})
|
|
138
|
-
),
|
|
143
|
+
})
|
|
144
|
+
).prefault({}),
|
|
139
145
|
redirects: z.record(
|
|
140
146
|
z.string(),
|
|
141
147
|
z.union([
|
|
@@ -170,6 +176,7 @@ const AstroConfigSchema = z.object({
|
|
|
170
176
|
entrypoint: z.union([z.literal("astro/assets/services/sharp"), z.string()]).default(ASTRO_CONFIG_DEFAULTS.image.service.entrypoint),
|
|
171
177
|
config: z.record(z.string(), z.any()).default({})
|
|
172
178
|
}).default(ASTRO_CONFIG_DEFAULTS.image.service),
|
|
179
|
+
dangerouslyProcessSVG: z.boolean().default(ASTRO_CONFIG_DEFAULTS.image.dangerouslyProcessSVG),
|
|
173
180
|
domains: z.array(z.string()).default([]),
|
|
174
181
|
remotePatterns: z.array(
|
|
175
182
|
z.object({
|
|
@@ -235,11 +242,27 @@ const AstroConfigSchema = z.object({
|
|
|
235
242
|
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
236
243
|
]).array().default(ASTRO_CONFIG_DEFAULTS.markdown.rehypePlugins),
|
|
237
244
|
remarkRehype: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.markdown.remarkRehype),
|
|
238
|
-
|
|
245
|
+
// Deprecated: left undefined unless the user explicitly sets them, so the
|
|
246
|
+
// deprecation warning only fires when actually used. The active processor
|
|
247
|
+
// (`unified()`) supplies the real default (`gfm`/smart punctuation on) when
|
|
248
|
+
// these are absent.
|
|
249
|
+
gfm: z.boolean().optional(),
|
|
239
250
|
smartypants: z.union([z.boolean(), smartypantsOptionsSchema]).transform((val) => {
|
|
240
251
|
if (val === true) return smartypantsOptionsSchema.parse({});
|
|
241
252
|
return val;
|
|
242
|
-
}).
|
|
253
|
+
}).optional(),
|
|
254
|
+
processor: z.object({
|
|
255
|
+
name: z.string(),
|
|
256
|
+
// `z.custom` preserves reference identity; `z.record` would clone, breaking
|
|
257
|
+
// the closure inside `createRenderer` that reads `processor.options.*`.
|
|
258
|
+
options: z.custom((v) => typeof v === "object" && v !== null && !Array.isArray(v)).default(() => ({})),
|
|
259
|
+
createRenderer: z.custom(
|
|
260
|
+
(v) => typeof v === "function"
|
|
261
|
+
),
|
|
262
|
+
createMdxRenderer: z.custom(
|
|
263
|
+
(v) => v === void 0 || typeof v === "function"
|
|
264
|
+
).optional()
|
|
265
|
+
}).default(() => unified())
|
|
243
266
|
}).prefault({}),
|
|
244
267
|
vite: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.vite),
|
|
245
268
|
i18n: z.optional(
|
|
@@ -306,6 +329,12 @@ const AstroConfigSchema = z.object({
|
|
|
306
329
|
prerenderConflictBehavior: z.enum(["error", "warn", "ignore"]).optional().default(ASTRO_CONFIG_DEFAULTS.prerenderConflictBehavior),
|
|
307
330
|
fonts: z.array(FontFamilySchema).optional(),
|
|
308
331
|
experimental: z.strictObject({
|
|
332
|
+
advancedRouting: z.union([
|
|
333
|
+
z.boolean(),
|
|
334
|
+
z.strictObject({
|
|
335
|
+
fetchFile: z.string().nullable().optional().default("app")
|
|
336
|
+
})
|
|
337
|
+
]).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.advancedRouting),
|
|
309
338
|
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
310
339
|
contentIntellisense: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentIntellisense),
|
|
311
340
|
chromeDevtoolsWorkspace: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.chromeDevtoolsWorkspace),
|