astro 7.0.0-beta.6 → 7.0.1
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/dist/assets/utils/generateImageStylesCSS.js +4 -1
- package/dist/cli/dev/background.d.ts +9 -0
- package/dist/cli/dev/background.js +19 -17
- package/dist/cli/dev/index.js +3 -2
- package/dist/cli/dev/status.js +9 -3
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/cache/handler.js +2 -2
- package/dist/core/cache/provider-utils.d.ts +38 -0
- package/dist/core/cache/provider-utils.js +43 -0
- package/dist/core/cache/runtime/cache.d.ts +1 -1
- package/dist/core/cache/runtime/cache.js +4 -4
- package/dist/core/cache/types.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.d.ts +2 -0
- package/dist/core/dev/lockfile.js +13 -0
- package/dist/core/logger/handlers.d.ts +7 -15
- package/dist/core/logger/handlers.js +7 -15
- package/dist/core/messages/runtime.js +1 -1
- package/dist/types/public/config.d.ts +3 -3
- package/dist/vite-plugin-config-alias/index.js +10 -3
- package/package.json +4 -3
|
@@ -37,7 +37,7 @@ function generateImageStylesCSS(defaultObjectFit, defaultObjectPosition) {
|
|
|
37
37
|
:where([data-astro-image]:not([data-astro-image-pos])) {
|
|
38
38
|
object-position: ${defaultObjectPosition};
|
|
39
39
|
}` : "";
|
|
40
|
-
|
|
40
|
+
const rules = `
|
|
41
41
|
:where([data-astro-image]) {
|
|
42
42
|
height: auto;
|
|
43
43
|
}
|
|
@@ -52,6 +52,9 @@ ${defaultFitStyle}
|
|
|
52
52
|
${positionStyles}
|
|
53
53
|
${defaultPositionStyle}
|
|
54
54
|
`.trim();
|
|
55
|
+
return `@layer astro.images {
|
|
56
|
+
${rules}
|
|
57
|
+
}`;
|
|
55
58
|
}
|
|
56
59
|
export {
|
|
57
60
|
generateImageStylesCSS
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AstroLogger } from '../../core/logger/core.js';
|
|
2
2
|
import type { Flags } from '../flags.js';
|
|
3
|
+
import { type LockFileData } from '../../core/dev/lockfile.js';
|
|
3
4
|
export interface BackgroundResult {
|
|
4
5
|
pid: number;
|
|
5
6
|
url: string;
|
|
@@ -10,6 +11,14 @@ export interface BackgroundErrorResult {
|
|
|
10
11
|
message: string;
|
|
11
12
|
}
|
|
12
13
|
export declare function formatBackgroundOutput(result: BackgroundResult | BackgroundErrorResult): string;
|
|
14
|
+
/**
|
|
15
|
+
* Build the human-readable message shown when a background dev server is running.
|
|
16
|
+
* Lists every network address (when `--host` exposed any) so the output matches
|
|
17
|
+
* the foreground dev server, then appends the management command hints.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatServerRunningMessage(data: LockFileData, { existing }?: {
|
|
20
|
+
existing?: boolean;
|
|
21
|
+
}): string;
|
|
13
22
|
export declare function background({ flags, logger, }: {
|
|
14
23
|
flags: Flags;
|
|
15
24
|
logger: AstroLogger;
|
|
@@ -14,6 +14,19 @@ import { resolveRoot } from "../../core/config/config.js";
|
|
|
14
14
|
function formatBackgroundOutput(result) {
|
|
15
15
|
return JSON.stringify(result);
|
|
16
16
|
}
|
|
17
|
+
function formatServerRunningMessage(data, { existing = false } = {}) {
|
|
18
|
+
const lines = [
|
|
19
|
+
`Dev server ${existing ? "already running" : "running"} at ${data.url} (pid ${data.pid})`
|
|
20
|
+
];
|
|
21
|
+
if (data.urls && data.urls.network.length > 0) {
|
|
22
|
+
lines.push(" Network:");
|
|
23
|
+
for (const url of data.urls.network) {
|
|
24
|
+
lines.push(` ${url}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
lines.push(" Stop: astro dev stop", " Status: astro dev status", " Logs: astro dev logs");
|
|
28
|
+
return lines.join("\n");
|
|
29
|
+
}
|
|
17
30
|
async function background({
|
|
18
31
|
flags,
|
|
19
32
|
logger
|
|
@@ -21,13 +34,7 @@ async function background({
|
|
|
21
34
|
const root = pathToFileURL(resolveRoot(flags.root) + "/");
|
|
22
35
|
const existing = checkExistingServer(root);
|
|
23
36
|
if (existing && !flags.force) {
|
|
24
|
-
logger.info(
|
|
25
|
-
"SKIP_FORMAT",
|
|
26
|
-
`Dev server already running at ${existing.url} (pid ${existing.pid})
|
|
27
|
-
Stop: astro dev stop
|
|
28
|
-
Status: astro dev status
|
|
29
|
-
Logs: astro dev logs`
|
|
30
|
-
);
|
|
37
|
+
logger.info("SKIP_FORMAT", formatServerRunningMessage(existing, { existing: true }));
|
|
31
38
|
return;
|
|
32
39
|
}
|
|
33
40
|
if (existing && flags.force) {
|
|
@@ -69,8 +76,8 @@ async function background({
|
|
|
69
76
|
}
|
|
70
77
|
const logFd = openSync(logFilePath, "w");
|
|
71
78
|
const rootPath = fileURLToPath(root);
|
|
72
|
-
const astroBin = resolve(rootPath, "node_modules", "
|
|
73
|
-
const child = spawn(astroBin, args, {
|
|
79
|
+
const astroBin = resolve(rootPath, "node_modules", "astro", "bin", "astro.mjs");
|
|
80
|
+
const child = spawn(process.execPath, [astroBin, ...args], {
|
|
74
81
|
detached: true,
|
|
75
82
|
stdio: ["ignore", logFd, logFd],
|
|
76
83
|
cwd: rootPath,
|
|
@@ -91,13 +98,7 @@ async function background({
|
|
|
91
98
|
}
|
|
92
99
|
const lockData = readLockFile(root);
|
|
93
100
|
if (lockData && lockData.pid === childPid) {
|
|
94
|
-
logger.info(
|
|
95
|
-
"SKIP_FORMAT",
|
|
96
|
-
`Dev server running at ${lockData.url} (pid ${lockData.pid})
|
|
97
|
-
Stop: astro dev stop
|
|
98
|
-
Status: astro dev status
|
|
99
|
-
Logs: astro dev logs`
|
|
100
|
-
);
|
|
101
|
+
logger.info("SKIP_FORMAT", formatServerRunningMessage(lockData));
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
await new Promise((r) => setTimeout(r, 200));
|
|
@@ -112,5 +113,6 @@ async function background({
|
|
|
112
113
|
}
|
|
113
114
|
export {
|
|
114
115
|
background,
|
|
115
|
-
formatBackgroundOutput
|
|
116
|
+
formatBackgroundOutput,
|
|
117
|
+
formatServerRunningMessage
|
|
116
118
|
};
|
package/dist/cli/dev/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { detectAgenticEnvironment } from "am-i-vibing";
|
|
2
2
|
import colors from "piccolore";
|
|
3
3
|
import devServer from "../../core/dev/index.js";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -8,7 +8,7 @@ import { printHelp } from "../../core/messages/runtime.js";
|
|
|
8
8
|
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
9
9
|
function isRunByAgent() {
|
|
10
10
|
try {
|
|
11
|
-
return
|
|
11
|
+
return detectAgenticEnvironment().type === "agent";
|
|
12
12
|
} catch {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
@@ -100,6 +100,7 @@ Run \`astro dev --help\` to see available commands.`
|
|
|
100
100
|
pid: process.pid,
|
|
101
101
|
port: server.address.port,
|
|
102
102
|
url: serverUrl,
|
|
103
|
+
urls: server.resolvedUrls,
|
|
103
104
|
background: !!process.env.ASTRO_DEV_BACKGROUND,
|
|
104
105
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
105
106
|
});
|
package/dist/cli/dev/status.js
CHANGED
|
@@ -16,10 +16,16 @@ async function status({
|
|
|
16
16
|
}
|
|
17
17
|
const startedAt = new Date(existing.startedAt).getTime();
|
|
18
18
|
const uptime = Math.floor((Date.now() - startedAt) / 1e3);
|
|
19
|
-
|
|
20
|
-
"SKIP_FORMAT",
|
|
19
|
+
const lines = [
|
|
21
20
|
`Dev server running at ${existing.url} (pid ${existing.pid}, uptime ${uptime}s${existing.background ? ", background" : ""})`
|
|
22
|
-
|
|
21
|
+
];
|
|
22
|
+
if (existing.urls && existing.urls.network.length > 0) {
|
|
23
|
+
lines.push(" Network:");
|
|
24
|
+
for (const url of existing.urls.network) {
|
|
25
|
+
lines.push(` ${url}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
logger.info("SKIP_FORMAT", lines.join("\n"));
|
|
23
29
|
}
|
|
24
30
|
export {
|
|
25
31
|
formatStatusOutput,
|
|
@@ -197,7 +197,7 @@ ${contentConfig.error.message}`
|
|
|
197
197
|
logger.info("Content config changed");
|
|
198
198
|
shouldClear = true;
|
|
199
199
|
}
|
|
200
|
-
if (previousAstroVersion && previousAstroVersion !== "7.0.
|
|
200
|
+
if (previousAstroVersion && previousAstroVersion !== "7.0.1") {
|
|
201
201
|
logger.info("Astro version changed");
|
|
202
202
|
shouldClear = true;
|
|
203
203
|
}
|
|
@@ -205,8 +205,8 @@ ${contentConfig.error.message}`
|
|
|
205
205
|
logger.info("Clearing content store");
|
|
206
206
|
this.#store.clearAll();
|
|
207
207
|
}
|
|
208
|
-
if ("7.0.
|
|
209
|
-
this.#store.metaStore().set("astro-version", "7.0.
|
|
208
|
+
if ("7.0.1") {
|
|
209
|
+
this.#store.metaStore().set("astro-version", "7.0.1");
|
|
210
210
|
}
|
|
211
211
|
if (currentConfigDigest) {
|
|
212
212
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -62,7 +62,7 @@ class CacheHandler {
|
|
|
62
62
|
},
|
|
63
63
|
async () => {
|
|
64
64
|
const res = await next();
|
|
65
|
-
applyCacheHeaders(cache, res);
|
|
65
|
+
applyCacheHeaders(cache, res, state.request);
|
|
66
66
|
return res;
|
|
67
67
|
}
|
|
68
68
|
);
|
|
@@ -71,7 +71,7 @@ class CacheHandler {
|
|
|
71
71
|
return response2;
|
|
72
72
|
}
|
|
73
73
|
const response = await next();
|
|
74
|
-
applyCacheHeaders(cache, response);
|
|
74
|
+
applyCacheHeaders(cache, response, state.request);
|
|
75
75
|
return response;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for CDN cache providers.
|
|
3
|
+
*
|
|
4
|
+
* These helpers are used by first-party adapter cache providers
|
|
5
|
+
* (@astrojs/netlify/cache, @astrojs/vercel/cache, @astrojs/cloudflare/cache)
|
|
6
|
+
* to implement common patterns like cache-control header generation,
|
|
7
|
+
* path-based invalidation via tags, and tag normalization.
|
|
8
|
+
*/
|
|
9
|
+
import type { CacheOptions, InvalidateOptions } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Generate a cache tag for a given path.
|
|
12
|
+
* Used by Netlify and Vercel providers to support `invalidate({ path })`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function pathTag(path: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Build cache-control directives from CacheOptions.
|
|
17
|
+
* Returns the directive string (e.g. `"public, max-age=300, stale-while-revalidate=60"`)
|
|
18
|
+
* without the header name, so each provider can use its own header
|
|
19
|
+
* (`Netlify-CDN-Cache-Control`, `Vercel-CDN-Cache-Control`, `Cloudflare-CDN-Cache-Control`).
|
|
20
|
+
*
|
|
21
|
+
* Returns `undefined` if no caching directives are present.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildCacheControlDirectives(options: CacheOptions, extraDirectives?: string[]): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Set common conditional headers (Last-Modified, ETag) on a Headers object.
|
|
26
|
+
*/
|
|
27
|
+
export declare function setConditionalHeaders(headers: Headers, options: CacheOptions): void;
|
|
28
|
+
/**
|
|
29
|
+
* Normalize `InvalidateOptions.tags` to a flat string array.
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeTags(tags: string | string[] | undefined): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Collect all tags needed to invalidate the given options,
|
|
34
|
+
* including the path tag if `options.path` is set.
|
|
35
|
+
* Used by providers that implement path invalidation via tags
|
|
36
|
+
* (Netlify, Vercel) rather than native path purge (Cloudflare).
|
|
37
|
+
*/
|
|
38
|
+
export declare function collectInvalidationTags(options: InvalidateOptions): string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const PATH_TAG_PREFIX = "astro-path:";
|
|
2
|
+
function pathTag(path) {
|
|
3
|
+
return `${PATH_TAG_PREFIX}${path}`;
|
|
4
|
+
}
|
|
5
|
+
function buildCacheControlDirectives(options, extraDirectives) {
|
|
6
|
+
const directives = [];
|
|
7
|
+
if (extraDirectives) {
|
|
8
|
+
directives.push(...extraDirectives);
|
|
9
|
+
}
|
|
10
|
+
if (options.maxAge !== void 0) {
|
|
11
|
+
directives.push(`max-age=${options.maxAge}`);
|
|
12
|
+
}
|
|
13
|
+
if (options.swr !== void 0) {
|
|
14
|
+
directives.push(`stale-while-revalidate=${options.swr}`);
|
|
15
|
+
}
|
|
16
|
+
return directives.length > 0 ? directives.join(", ") : void 0;
|
|
17
|
+
}
|
|
18
|
+
function setConditionalHeaders(headers, options) {
|
|
19
|
+
if (options.lastModified) {
|
|
20
|
+
headers.set("Last-Modified", options.lastModified.toUTCString());
|
|
21
|
+
}
|
|
22
|
+
if (options.etag) {
|
|
23
|
+
headers.set("ETag", options.etag);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function normalizeTags(tags) {
|
|
27
|
+
if (!tags) return [];
|
|
28
|
+
return Array.isArray(tags) ? tags : [tags];
|
|
29
|
+
}
|
|
30
|
+
function collectInvalidationTags(options) {
|
|
31
|
+
const tags = normalizeTags(options.tags);
|
|
32
|
+
if (options.path) {
|
|
33
|
+
tags.push(pathTag(options.path));
|
|
34
|
+
}
|
|
35
|
+
return tags;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
buildCacheControlDirectives,
|
|
39
|
+
collectInvalidationTags,
|
|
40
|
+
normalizeTags,
|
|
41
|
+
pathTag,
|
|
42
|
+
setConditionalHeaders
|
|
43
|
+
};
|
|
@@ -35,7 +35,7 @@ export declare class AstroCache implements CacheLike {
|
|
|
35
35
|
/**
|
|
36
36
|
* Apply cache headers to a response.
|
|
37
37
|
*/
|
|
38
|
-
export declare function applyCacheHeaders(cache: CacheLike, response: Response): void;
|
|
38
|
+
export declare function applyCacheHeaders(cache: CacheLike, response: Response, request: Request): void;
|
|
39
39
|
/**
|
|
40
40
|
* Check whether the cache has any active state worth acting on.
|
|
41
41
|
*/
|
|
@@ -67,11 +67,11 @@ class AstroCache {
|
|
|
67
67
|
return this.#provider.invalidate(options);
|
|
68
68
|
}
|
|
69
69
|
/** @internal */
|
|
70
|
-
[APPLY_HEADERS](response) {
|
|
70
|
+
[APPLY_HEADERS](response, request) {
|
|
71
71
|
if (this.#disabled) return;
|
|
72
72
|
const finalOptions = { ...this.#options, tags: this.tags };
|
|
73
73
|
if (finalOptions.maxAge === void 0 && !finalOptions.tags?.length) return;
|
|
74
|
-
const headers = this.#provider?.setHeaders?.(finalOptions) ?? defaultSetHeaders(finalOptions);
|
|
74
|
+
const headers = this.#provider?.setHeaders?.(finalOptions, request) ?? defaultSetHeaders(finalOptions);
|
|
75
75
|
for (const [key, value] of headers) {
|
|
76
76
|
response.headers.set(key, value);
|
|
77
77
|
}
|
|
@@ -81,9 +81,9 @@ class AstroCache {
|
|
|
81
81
|
return !this.#disabled && (this.#options.maxAge !== void 0 || this.#tags.size > 0);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function applyCacheHeaders(cache, response) {
|
|
84
|
+
function applyCacheHeaders(cache, response, request) {
|
|
85
85
|
if (APPLY_HEADERS in cache) {
|
|
86
|
-
cache[APPLY_HEADERS](response);
|
|
86
|
+
cache[APPLY_HEADERS](response, request);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
function isCacheActive(cache) {
|
|
@@ -22,7 +22,7 @@ export interface InvalidateOptions {
|
|
|
22
22
|
}
|
|
23
23
|
export interface CacheProvider {
|
|
24
24
|
name: string;
|
|
25
|
-
setHeaders?(options: CacheOptions): Headers;
|
|
25
|
+
setHeaders?(options: CacheOptions, request: Request): Headers;
|
|
26
26
|
onRequest?(context: {
|
|
27
27
|
request: Request;
|
|
28
28
|
url: URL;
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -26,7 +26,7 @@ async function dev(inlineConfig) {
|
|
|
26
26
|
await telemetry.record([]);
|
|
27
27
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
28
28
|
const logger = restart.container.logger;
|
|
29
|
-
const currentVersion = "7.0.
|
|
29
|
+
const currentVersion = "7.0.1";
|
|
30
30
|
const isPrerelease = currentVersion.includes("-");
|
|
31
31
|
if (!isPrerelease) {
|
|
32
32
|
try {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { ResolvedServerUrls } from 'vite';
|
|
1
2
|
/** Maximum time (ms) to wait for a process to exit after SIGTERM before escalating to SIGKILL. */
|
|
2
3
|
export declare const GRACEFUL_SHUTDOWN_TIMEOUT = 5000;
|
|
3
4
|
export interface LockFileData {
|
|
4
5
|
pid: number;
|
|
5
6
|
port: number;
|
|
6
7
|
url: string;
|
|
8
|
+
urls?: ResolvedServerUrls;
|
|
7
9
|
background: boolean;
|
|
8
10
|
startedAt: string;
|
|
9
11
|
}
|
|
@@ -7,12 +7,25 @@ function getLockFileURL(root) {
|
|
|
7
7
|
function getLogFileURL(root) {
|
|
8
8
|
return new URL(".astro/dev.log", root);
|
|
9
9
|
}
|
|
10
|
+
function isStringArray(value) {
|
|
11
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
12
|
+
}
|
|
13
|
+
function isResolvedServerUrls(value) {
|
|
14
|
+
if (typeof value !== "object" || value === null) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const { local, network } = value;
|
|
18
|
+
return isStringArray(local) && isStringArray(network);
|
|
19
|
+
}
|
|
10
20
|
function parseLockFile(content) {
|
|
11
21
|
try {
|
|
12
22
|
const data = JSON.parse(content);
|
|
13
23
|
if (typeof data.pid !== "number" || typeof data.port !== "number" || typeof data.url !== "string" || typeof data.background !== "boolean" || typeof data.startedAt !== "string") {
|
|
14
24
|
return null;
|
|
15
25
|
}
|
|
26
|
+
if (data.urls !== void 0 && !isResolvedServerUrls(data.urls)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
16
29
|
return data;
|
|
17
30
|
} catch {
|
|
18
31
|
return null;
|
|
@@ -8,9 +8,7 @@ export declare const logHandlers: {
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```js
|
|
10
10
|
* export default defineConfig({
|
|
11
|
-
*
|
|
12
|
-
* logger: logHandlers.json({ pretty: true })
|
|
13
|
-
* }
|
|
11
|
+
* logger: logHandlers.json({ pretty: true })
|
|
14
12
|
* })
|
|
15
13
|
* ```
|
|
16
14
|
*/
|
|
@@ -21,9 +19,7 @@ export declare const logHandlers: {
|
|
|
21
19
|
* @example
|
|
22
20
|
* ```js
|
|
23
21
|
* export default defineConfig({
|
|
24
|
-
*
|
|
25
|
-
* logger: logHandlers.node({ pretty: true })
|
|
26
|
-
* }
|
|
22
|
+
* logger: logHandlers.node({ pretty: true })
|
|
27
23
|
* })
|
|
28
24
|
* ```
|
|
29
25
|
*/
|
|
@@ -34,9 +30,7 @@ export declare const logHandlers: {
|
|
|
34
30
|
* @example
|
|
35
31
|
* ```js
|
|
36
32
|
* export default defineConfig({
|
|
37
|
-
*
|
|
38
|
-
* logger: logHandlers.console({ pretty: true })
|
|
39
|
-
* }
|
|
33
|
+
* logger: logHandlers.console({ pretty: true })
|
|
40
34
|
* })
|
|
41
35
|
* ```
|
|
42
36
|
*/
|
|
@@ -47,12 +41,10 @@ export declare const logHandlers: {
|
|
|
47
41
|
* @example
|
|
48
42
|
* ```js
|
|
49
43
|
* export default defineConfig({
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* )
|
|
55
|
-
* }
|
|
44
|
+
* logger: logHandlers.compose(
|
|
45
|
+
* logHandlers.console(),
|
|
46
|
+
* logHandlers.json(),
|
|
47
|
+
* )
|
|
56
48
|
* })
|
|
57
49
|
* ```
|
|
58
50
|
*/
|
|
@@ -4,9 +4,7 @@ const logHandlers = {
|
|
|
4
4
|
* @example
|
|
5
5
|
* ```js
|
|
6
6
|
* export default defineConfig({
|
|
7
|
-
*
|
|
8
|
-
* logger: logHandlers.json({ pretty: true })
|
|
9
|
-
* }
|
|
7
|
+
* logger: logHandlers.json({ pretty: true })
|
|
10
8
|
* })
|
|
11
9
|
* ```
|
|
12
10
|
*/
|
|
@@ -22,9 +20,7 @@ const logHandlers = {
|
|
|
22
20
|
* @example
|
|
23
21
|
* ```js
|
|
24
22
|
* export default defineConfig({
|
|
25
|
-
*
|
|
26
|
-
* logger: logHandlers.node({ pretty: true })
|
|
27
|
-
* }
|
|
23
|
+
* logger: logHandlers.node({ pretty: true })
|
|
28
24
|
* })
|
|
29
25
|
* ```
|
|
30
26
|
*/
|
|
@@ -40,9 +36,7 @@ const logHandlers = {
|
|
|
40
36
|
* @example
|
|
41
37
|
* ```js
|
|
42
38
|
* export default defineConfig({
|
|
43
|
-
*
|
|
44
|
-
* logger: logHandlers.console({ pretty: true })
|
|
45
|
-
* }
|
|
39
|
+
* logger: logHandlers.console({ pretty: true })
|
|
46
40
|
* })
|
|
47
41
|
* ```
|
|
48
42
|
*/
|
|
@@ -58,12 +52,10 @@ const logHandlers = {
|
|
|
58
52
|
* @example
|
|
59
53
|
* ```js
|
|
60
54
|
* export default defineConfig({
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* )
|
|
66
|
-
* }
|
|
55
|
+
* logger: logHandlers.compose(
|
|
56
|
+
* logHandlers.console(),
|
|
57
|
+
* logHandlers.json(),
|
|
58
|
+
* )
|
|
67
59
|
* })
|
|
68
60
|
* ```
|
|
69
61
|
*/
|
|
@@ -1348,7 +1348,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1348
1348
|
* });
|
|
1349
1349
|
* ```
|
|
1350
1350
|
*
|
|
1351
|
-
* Learn more about customizing the request pipeline in the [advanced routing guide](https://
|
|
1351
|
+
* Learn more about customizing the request pipeline in the [advanced routing guide](https://docs.astro.build/en/guides/routing/#advanced-routing).
|
|
1352
1352
|
*/
|
|
1353
1353
|
fetchFile?: string | null;
|
|
1354
1354
|
/**
|
|
@@ -1362,7 +1362,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1362
1362
|
*
|
|
1363
1363
|
* Configures how Astro logs messages during development and production.
|
|
1364
1364
|
*
|
|
1365
|
-
* By default, Astro uses a built-in logger that outputs human-friendly logs to the console. You can customize this behavior by providing [your own logger handler](https://
|
|
1365
|
+
* By default, Astro uses a built-in logger that outputs human-friendly logs to the console. You can customize this behavior by providing [your own logger handler](https://docs.astro.build/en/reference/logger-reference/#custom-loggers) or by using one of the [built-in log handlers](https://docs.astro.build/en/reference/logger-reference/#built-in-loggers):
|
|
1366
1366
|
*
|
|
1367
1367
|
* ```js
|
|
1368
1368
|
* // astro.config.mjs
|
|
@@ -1373,7 +1373,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1373
1373
|
* });
|
|
1374
1374
|
* ```
|
|
1375
1375
|
*
|
|
1376
|
-
* See [the logger API reference](https://
|
|
1376
|
+
* See [the logger API reference](https://docs.astro.build/en/reference/logger-reference/) for more information.
|
|
1377
1377
|
*/
|
|
1378
1378
|
logger?: LoggerHandlerConfig;
|
|
1379
1379
|
/**
|
|
@@ -44,6 +44,7 @@ function resolveWithAlias(id, configAlias) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
const cssImportRE = /@import\s+(?:url\(\s*)?['"]([^'"]+)['"]\s*\)?/g;
|
|
47
|
+
const cssUrlRE = /(?<!@import\s+)url\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
47
48
|
function configAliasVitePlugin({
|
|
48
49
|
settings
|
|
49
50
|
}) {
|
|
@@ -64,9 +65,8 @@ function configAliasVitePlugin({
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
handler(code) {
|
|
67
|
-
if (!code.includes("@import")) return;
|
|
68
68
|
let hasReplacement = false;
|
|
69
|
-
const
|
|
69
|
+
const replaceAliases = (match, importId) => {
|
|
70
70
|
if (!importId) return match;
|
|
71
71
|
const resolved = resolveWithAlias(importId, configAlias);
|
|
72
72
|
if (resolved) {
|
|
@@ -74,7 +74,14 @@ function configAliasVitePlugin({
|
|
|
74
74
|
return match.replace(importId, resolved);
|
|
75
75
|
}
|
|
76
76
|
return match;
|
|
77
|
-
}
|
|
77
|
+
};
|
|
78
|
+
let result = code;
|
|
79
|
+
if (result.includes("@import")) {
|
|
80
|
+
result = result.replace(cssImportRE, replaceAliases);
|
|
81
|
+
}
|
|
82
|
+
if (result.includes("url(")) {
|
|
83
|
+
result = result.replace(cssUrlRE, replaceAliases);
|
|
84
|
+
}
|
|
78
85
|
if (hasReplacement) {
|
|
79
86
|
return { code: result, map: null };
|
|
80
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"./assets/services/sharp": "./dist/assets/services/sharp.js",
|
|
76
76
|
"./assets/services/noop": "./dist/assets/services/noop.js",
|
|
77
77
|
"./cache/memory": "./dist/core/cache/memory-provider.js",
|
|
78
|
+
"./cache/provider-utils": "./dist/core/cache/provider-utils.js",
|
|
78
79
|
"./fetch": "./dist/core/fetch/index.js",
|
|
79
80
|
"./hono": "./dist/core/hono/index.js",
|
|
80
81
|
"./assets/fonts/runtime.js": "./dist/assets/fonts/runtime.js",
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
"@clack/prompts": "^1.1.0",
|
|
118
119
|
"@oslojs/encoding": "^1.1.0",
|
|
119
120
|
"@rollup/pluginutils": "^5.3.0",
|
|
120
|
-
"am-i-vibing": "^0.
|
|
121
|
+
"am-i-vibing": "^0.4.0",
|
|
121
122
|
"aria-query": "^5.3.2",
|
|
122
123
|
"axobject-query": "^4.1.0",
|
|
123
124
|
"ci-info": "^4.4.0",
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
"yargs-parser": "^22.0.0",
|
|
167
168
|
"zod": "^4.3.6",
|
|
168
169
|
"@astrojs/internal-helpers": "0.10.0",
|
|
169
|
-
"@astrojs/markdown-satteri": "0.3.1
|
|
170
|
+
"@astrojs/markdown-satteri": "0.3.1",
|
|
170
171
|
"@astrojs/telemetry": "3.3.2"
|
|
171
172
|
},
|
|
172
173
|
"optionalDependencies": {
|