astro 6.1.10 → 6.2.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/client.d.ts +1 -0
- package/dist/actions/runtime/types.d.ts +1 -1
- package/dist/assets/fonts/constants.d.ts +2 -0
- package/dist/assets/fonts/constants.js +4 -0
- package/dist/assets/fonts/core/create-get-font-file-url.d.ts +2 -0
- package/dist/assets/fonts/core/create-get-font-file-url.js +23 -0
- package/dist/assets/fonts/core/font-file-middleware.d.ts +21 -0
- package/dist/assets/fonts/core/font-file-middleware.js +59 -0
- package/dist/assets/fonts/definitions.d.ts +13 -0
- package/dist/assets/fonts/infra/build-url-resolver.d.ts +1 -0
- package/dist/assets/fonts/infra/build-url-resolver.js +7 -1
- package/dist/assets/fonts/infra/dev-url-resolver.d.ts +1 -0
- package/dist/assets/fonts/infra/dev-url-resolver.js +7 -1
- package/dist/assets/fonts/infra/remote-runtime-font-file-url-resolver.d.ts +19 -0
- package/dist/assets/fonts/infra/remote-runtime-font-file-url-resolver.js +27 -0
- package/dist/assets/fonts/infra/ssr-runtime-font-file-url-resolver.d.ts +12 -0
- package/dist/assets/fonts/infra/ssr-runtime-font-file-url-resolver.js +25 -0
- package/dist/assets/fonts/runtime.d.ts +1 -0
- package/dist/assets/fonts/runtime.js +4 -0
- package/dist/assets/fonts/vite-plugin-fonts.js +88 -49
- package/dist/assets/index.d.ts +1 -1
- package/dist/assets/index.js +3 -2
- package/dist/assets/svg/config.d.ts +5 -0
- package/dist/assets/svg/config.js +8 -0
- package/dist/assets/svg/svgo.d.ts +4 -0
- package/dist/assets/svg/svgo.js +10 -0
- package/dist/assets/svg/types.d.ts +4 -0
- package/dist/assets/svg/types.js +0 -0
- package/dist/assets/svg/utils.d.ts +3 -0
- package/dist/assets/{utils/svg.js → svg/utils.js} +11 -14
- package/dist/assets/vite-plugin-assets.js +8 -4
- package/dist/cli/flags.js +19 -9
- package/dist/cli/help/index.js +2 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/preferences/index.js +3 -2
- package/dist/config/entrypoint.d.ts +2 -0
- package/dist/config/entrypoint.js +4 -0
- package/dist/config/index.js +9 -7
- package/dist/container/index.js +4 -7
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/base.d.ts +18 -4
- package/dist/core/app/base.js +29 -12
- package/dist/core/app/dev/app.d.ts +0 -1
- package/dist/core/app/dev/app.js +0 -2
- package/dist/core/app/entrypoints/index.d.ts +1 -1
- package/dist/core/app/entrypoints/index.js +1 -1
- package/dist/core/app/entrypoints/virtual/dev.js +1 -1
- package/dist/core/app/pipeline.js +2 -2
- package/dist/core/app/types.d.ts +10 -3
- package/dist/core/base-pipeline.d.ts +9 -2
- package/dist/core/base-pipeline.js +17 -0
- package/dist/core/build/app.js +2 -1
- package/dist/core/build/index.js +13 -2
- package/dist/core/build/internal.d.ts +1 -0
- package/dist/core/build/internal.js +1 -0
- package/dist/core/build/pipeline.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.js +6 -1
- package/dist/core/cache/types.d.ts +2 -0
- package/dist/core/config/schemas/base.d.ts +12 -4
- package/dist/core/config/schemas/base.js +11 -4
- package/dist/core/config/schemas/relative.d.ts +27 -6
- package/dist/core/config/schemas/relative.js +1 -1
- package/dist/core/config/settings.js +2 -1
- package/dist/core/config/vite-load.js +4 -17
- package/dist/core/constants.js +1 -1
- package/dist/core/createMinimalViteDevServer.d.ts +8 -0
- package/dist/core/createMinimalViteDevServer.js +15 -0
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.js +2 -2
- package/dist/core/errors/errors-data.d.ts +48 -2
- package/dist/core/errors/errors-data.js +26 -2
- package/dist/core/logger/config.d.ts +6 -0
- package/dist/core/logger/config.js +0 -0
- package/dist/core/logger/core.d.ts +33 -13
- package/dist/core/logger/core.js +50 -5
- package/dist/core/logger/handlers.d.ts +60 -0
- package/dist/core/logger/handlers.js +81 -0
- package/dist/core/logger/impls/compose.d.ts +2 -0
- package/dist/core/logger/impls/compose.js +26 -0
- package/dist/core/logger/impls/console.d.ts +9 -0
- package/dist/core/logger/impls/console.js +38 -0
- package/dist/core/logger/impls/json.d.ts +15 -0
- package/dist/core/logger/impls/json.js +42 -0
- package/dist/core/logger/impls/node.d.ts +7 -0
- package/dist/core/logger/impls/node.js +40 -0
- package/dist/core/logger/load.d.ts +11 -0
- package/dist/core/logger/load.js +88 -0
- package/dist/core/logger/node.d.ts +0 -5
- package/dist/core/logger/node.js +1 -39
- package/dist/core/logger/public.d.ts +17 -0
- package/dist/core/logger/public.js +7 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/index.js +2 -1
- package/dist/core/preview/index.js +4 -3
- package/dist/core/render-context.js +35 -1
- package/dist/core/sync/index.js +2 -2
- package/dist/core/wait-until.d.ts +1 -0
- package/dist/core/wait-until.js +0 -0
- package/dist/manifest/serialized.js +6 -1
- package/dist/runtime/compiler/index.d.ts +1 -1
- package/dist/runtime/compiler/index.js +4 -0
- package/dist/runtime/server/astro-global.js +3 -0
- package/dist/runtime/server/index.d.ts +1 -0
- package/dist/runtime/server/index.js +3 -0
- package/dist/runtime/server/render/common.js +16 -0
- package/dist/runtime/server/render/instruction.d.ts +7 -1
- package/dist/runtime/server/render/template-depth.d.ts +13 -0
- package/dist/runtime/server/render/template-depth.js +11 -0
- package/dist/types/astro.d.ts +2 -0
- package/dist/types/public/common.d.ts +1 -0
- package/dist/types/public/config.d.ts +54 -42
- package/dist/types/public/context.d.ts +17 -0
- package/dist/types/public/index.d.ts +1 -0
- package/dist/types/public/internal.d.ts +7 -1
- package/dist/types/public/preview.d.ts +5 -0
- package/dist/vite-plugin-app/app.d.ts +0 -1
- package/dist/vite-plugin-app/app.js +0 -2
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +1 -1
- package/dist/vite-plugin-app/createAstroServerApp.js +2 -6
- package/dist/vite-plugin-load-fallback/index.d.ts +1 -1
- package/dist/vite-plugin-load-fallback/index.js +2 -5
- package/package.json +12 -7
- package/dist/assets/utils/svg.d.ts +0 -3
- package/dist/core/app/logging.d.ts +0 -3
- package/dist/core/app/logging.js +0 -11
- package/dist/core/logger/console.d.ts +0 -2
- package/dist/core/logger/console.js +0 -21
|
@@ -11,9 +11,11 @@ import { createDefaultRoutes } from "./routing/default.js";
|
|
|
11
11
|
import { NodePool } from "../runtime/server/render/queue/pool.js";
|
|
12
12
|
import { HTMLStringCache } from "../runtime/server/html-string-cache.js";
|
|
13
13
|
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
14
|
+
import { loadLogger } from "./logger/load.js";
|
|
14
15
|
class Pipeline {
|
|
15
16
|
internalMiddleware;
|
|
16
17
|
resolvedMiddleware = void 0;
|
|
18
|
+
resolvedLogger = false;
|
|
17
19
|
resolvedActions = void 0;
|
|
18
20
|
resolvedSessionDriver = void 0;
|
|
19
21
|
resolvedCacheProvider = void 0;
|
|
@@ -119,6 +121,21 @@ class Pipeline {
|
|
|
119
121
|
clearMiddleware() {
|
|
120
122
|
this.resolvedMiddleware = void 0;
|
|
121
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolves the logger destination from the manifest and updates the pipeline logger.
|
|
126
|
+
* If the user configured `experimental.logger`, the bundled logger factory is loaded
|
|
127
|
+
* and replaces the default console destination. This is lazy and only resolves once.
|
|
128
|
+
*/
|
|
129
|
+
async getLogger() {
|
|
130
|
+
if (this.resolvedLogger) {
|
|
131
|
+
return this.logger;
|
|
132
|
+
}
|
|
133
|
+
this.resolvedLogger = true;
|
|
134
|
+
if (this.manifest.experimentalLogger) {
|
|
135
|
+
this.logger = await loadLogger(this.manifest.experimentalLogger);
|
|
136
|
+
}
|
|
137
|
+
return this.logger;
|
|
138
|
+
}
|
|
122
139
|
async getActions() {
|
|
123
140
|
if (this.resolvedActions) {
|
|
124
141
|
return this.resolvedActions;
|
package/dist/core/build/app.js
CHANGED
|
@@ -19,7 +19,8 @@ class BuildApp extends BaseApp {
|
|
|
19
19
|
}
|
|
20
20
|
setOptions(options) {
|
|
21
21
|
this.pipeline.setOptions(options);
|
|
22
|
-
this.logger
|
|
22
|
+
this.logger.setDestination(options.logger.options.destination);
|
|
23
|
+
this.resetAdapterLogger();
|
|
23
24
|
}
|
|
24
25
|
getOptions() {
|
|
25
26
|
return this.pipeline.getOptions();
|
package/dist/core/build/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
runHookConfigSetup
|
|
12
12
|
} from "../../integrations/hooks.js";
|
|
13
13
|
import { resolveConfig } from "../config/config.js";
|
|
14
|
-
import {
|
|
14
|
+
import { loadOrCreateNodeLogger } from "../logger/load.js";
|
|
15
15
|
import { createSettings } from "../config/settings.js";
|
|
16
16
|
import { createVite } from "../create-vite.js";
|
|
17
17
|
import { createKey, getEnvironmentKey, hasEnvironmentKey } from "../encryption.js";
|
|
@@ -27,8 +27,8 @@ import { getTimeStat } from "./util.js";
|
|
|
27
27
|
import { warnIfCspWithShiki } from "../messages/runtime.js";
|
|
28
28
|
async function build(inlineConfig, options = {}) {
|
|
29
29
|
ensureProcessNodeEnv(options.devOutput ? "development" : "production");
|
|
30
|
-
const logger = createNodeLogger(inlineConfig);
|
|
31
30
|
const { userConfig, astroConfig } = await resolveConfig(inlineConfig, "build");
|
|
31
|
+
const logger = await loadOrCreateNodeLogger(astroConfig, inlineConfig ?? {});
|
|
32
32
|
telemetry.record(eventCliSession("build", userConfig));
|
|
33
33
|
warnIfCspWithShiki(astroConfig, logger);
|
|
34
34
|
const settings = await createSettings(
|
|
@@ -165,6 +165,17 @@ class AstroBuilder {
|
|
|
165
165
|
delete assets[k];
|
|
166
166
|
});
|
|
167
167
|
this.logger.debug("build", timerMessage("Additional assets copied", this.timer.assetsStart));
|
|
168
|
+
if (this.settings.fontsHttpServer) {
|
|
169
|
+
await new Promise((resolve, reject) => {
|
|
170
|
+
this.settings.fontsHttpServer.close((err) => {
|
|
171
|
+
if (err) reject(err);
|
|
172
|
+
else resolve();
|
|
173
|
+
});
|
|
174
|
+
}).catch((err) => {
|
|
175
|
+
this.logger.debug("assets", "Failed to close fonts HTTP server:", err);
|
|
176
|
+
});
|
|
177
|
+
this.settings.fontsHttpServer = null;
|
|
178
|
+
}
|
|
168
179
|
await runHookBuildDone({
|
|
169
180
|
settings: this.settings,
|
|
170
181
|
pages: pageNames,
|
|
@@ -74,6 +74,7 @@ export interface BuildInternals {
|
|
|
74
74
|
prerenderEntryFileName?: string;
|
|
75
75
|
componentMetadata: SSRResult['componentMetadata'];
|
|
76
76
|
middlewareEntryPoint: URL | undefined;
|
|
77
|
+
loggerEntryPoint: URL | undefined;
|
|
77
78
|
astroActionsEntryPoint: URL | undefined;
|
|
78
79
|
/**
|
|
79
80
|
* Assets that need to be moved from SSR/prerender directories to the client directory.
|
|
@@ -19,6 +19,7 @@ function createBuildInternals() {
|
|
|
19
19
|
componentMetadata: /* @__PURE__ */ new Map(),
|
|
20
20
|
astroActionsEntryPoint: void 0,
|
|
21
21
|
middlewareEntryPoint: void 0,
|
|
22
|
+
loggerEntryPoint: void 0,
|
|
22
23
|
clientChunksAndAssets: /* @__PURE__ */ new Set(),
|
|
23
24
|
ssrAssetsPerEnvironment: /* @__PURE__ */ new Map()
|
|
24
25
|
};
|
|
@@ -61,7 +61,7 @@ class BuildPipeline extends Pipeline {
|
|
|
61
61
|
resolveCache.set(specifier, assetLink);
|
|
62
62
|
return assetLink;
|
|
63
63
|
}
|
|
64
|
-
const logger = createConsoleLogger(manifest.logLevel);
|
|
64
|
+
const logger = createConsoleLogger({ level: manifest.logLevel });
|
|
65
65
|
super(logger, manifest, "production", manifest.renderers, resolve, manifest.serverLike);
|
|
66
66
|
this.manifest = manifest;
|
|
67
67
|
this.defaultRoutes = defaultRoutes;
|
|
@@ -211,6 +211,10 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
const middlewareMode = resolveMiddlewareMode(opts.settings.adapter?.adapterFeatures);
|
|
214
|
+
let experimentalLogger = void 0;
|
|
215
|
+
if (settings.config.experimental.logger) {
|
|
216
|
+
experimentalLogger = settings.config.experimental.logger;
|
|
217
|
+
}
|
|
214
218
|
return {
|
|
215
219
|
rootDir: opts.settings.config.root.toString(),
|
|
216
220
|
cacheDir: opts.settings.config.cacheDir.toString(),
|
|
@@ -267,7 +271,8 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
267
271
|
},
|
|
268
272
|
internalFetchHeaders,
|
|
269
273
|
logLevel: settings.logLevel,
|
|
270
|
-
shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp)
|
|
274
|
+
shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp),
|
|
275
|
+
experimentalLogger
|
|
271
276
|
};
|
|
272
277
|
}
|
|
273
278
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MiddlewareNext } from '../../types/public/common.js';
|
|
2
|
+
import type { WaitUntilHook } from '../wait-until.js';
|
|
2
3
|
export interface CacheOptions {
|
|
3
4
|
maxAge?: number;
|
|
4
5
|
swr?: number;
|
|
@@ -25,6 +26,7 @@ export interface CacheProvider {
|
|
|
25
26
|
onRequest?(context: {
|
|
26
27
|
request: Request;
|
|
27
28
|
url: URL;
|
|
29
|
+
waitUntil?: WaitUntilHook;
|
|
28
30
|
}, next: MiddlewareNext): Promise<Response>;
|
|
29
31
|
invalidate(options: InvalidateOptions): Promise<void>;
|
|
30
32
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
2
|
import type { RehypePlugin as _RehypePlugin, RemarkPlugin as _RemarkPlugin, RemarkRehype as _RemarkRehype, ShikiConfig, Smartypants as _Smartypants } from '@astrojs/markdown-remark';
|
|
3
|
-
import type { Config as SvgoConfig } from 'svgo';
|
|
4
3
|
import * as z from 'zod/v4';
|
|
5
4
|
import type { ViteUserConfig } from '../../../types/public/config.js';
|
|
6
5
|
/** @lintignore */
|
|
@@ -79,11 +78,13 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
79
78
|
clientPrerender: false;
|
|
80
79
|
contentIntellisense: false;
|
|
81
80
|
chromeDevtoolsWorkspace: false;
|
|
82
|
-
svgo: false;
|
|
83
81
|
rustCompiler: false;
|
|
84
82
|
queuedRendering: {
|
|
85
83
|
enabled: false;
|
|
86
84
|
};
|
|
85
|
+
logger: {
|
|
86
|
+
entrypoint: string;
|
|
87
|
+
};
|
|
87
88
|
};
|
|
88
89
|
};
|
|
89
90
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
@@ -93,7 +94,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
93
94
|
outDir: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>;
|
|
94
95
|
cacheDir: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>;
|
|
95
96
|
site: z.ZodOptional<z.ZodString>;
|
|
96
|
-
compressHTML: z.ZodDefault<z.ZodOptional<z.ZodBoolean
|
|
97
|
+
compressHTML: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"jsx">]>>>;
|
|
97
98
|
base: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
98
99
|
trailingSlash: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"always">, z.ZodLiteral<"never">, z.ZodLiteral<"ignore">]>>>;
|
|
99
100
|
output: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"static">, z.ZodLiteral<"server">, z.ZodLiteral<"hybrid">]>>> & z.ZodType<"server" | "static", "server" | "static" | "hybrid" | undefined, z.core.$ZodTypeInternals<"server" | "static", "server" | "static" | "hybrid" | undefined>>;
|
|
@@ -500,7 +501,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
500
501
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
501
502
|
contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
502
503
|
chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
503
|
-
|
|
504
|
+
svgOptimizer: z.ZodOptional<z.ZodObject<{
|
|
505
|
+
name: z.ZodString;
|
|
506
|
+
optimize: z.ZodCustom<(contents: string) => string | Promise<string>, (contents: string) => string | Promise<string>>;
|
|
507
|
+
}, z.core.$strip>>;
|
|
504
508
|
cache: z.ZodOptional<z.ZodObject<{
|
|
505
509
|
provider: z.ZodOptional<z.ZodObject<{
|
|
506
510
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -519,6 +523,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
519
523
|
poolSize: z.ZodOptional<z.ZodNumber>;
|
|
520
524
|
contentCache: z.ZodOptional<z.ZodBoolean>;
|
|
521
525
|
}, z.core.$strip>>>;
|
|
526
|
+
logger: z.ZodOptional<z.ZodObject<{
|
|
527
|
+
entrypoint: z.ZodString;
|
|
528
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
529
|
+
}, z.core.$strip>>;
|
|
522
530
|
}, z.core.$strict>>;
|
|
523
531
|
legacy: z.ZodPrefault<z.ZodObject<{
|
|
524
532
|
collectionsBackwardsCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -6,6 +6,7 @@ import { EnvSchema } from "../../../env/schema.js";
|
|
|
6
6
|
import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from "../../csp/config.js";
|
|
7
7
|
import { CacheSchema, RouteRulesSchema } from "../../cache/config.js";
|
|
8
8
|
import { SessionSchema } from "../../session/config.js";
|
|
9
|
+
import { SvgOptimizerSchema } from "../../../assets/svg/config.js";
|
|
9
10
|
const ASTRO_CONFIG_DEFAULTS = {
|
|
10
11
|
root: ".",
|
|
11
12
|
srcDir: "./src",
|
|
@@ -62,10 +63,12 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
62
63
|
clientPrerender: false,
|
|
63
64
|
contentIntellisense: false,
|
|
64
65
|
chromeDevtoolsWorkspace: false,
|
|
65
|
-
svgo: false,
|
|
66
66
|
rustCompiler: false,
|
|
67
67
|
queuedRendering: {
|
|
68
68
|
enabled: false
|
|
69
|
+
},
|
|
70
|
+
logger: {
|
|
71
|
+
entrypoint: "astro/logger/node"
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
};
|
|
@@ -95,7 +98,7 @@ const AstroConfigSchema = z.object({
|
|
|
95
98
|
outDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.outDir).transform((val) => new URL(val)),
|
|
96
99
|
cacheDir: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.cacheDir).transform((val) => new URL(val)),
|
|
97
100
|
site: z.string().url().optional(),
|
|
98
|
-
compressHTML: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.compressHTML),
|
|
101
|
+
compressHTML: z.union([z.boolean(), z.literal("jsx")]).optional().default(ASTRO_CONFIG_DEFAULTS.compressHTML),
|
|
99
102
|
base: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.base),
|
|
100
103
|
trailingSlash: z.union([z.literal("always"), z.literal("never"), z.literal("ignore")]).optional().default(ASTRO_CONFIG_DEFAULTS.trailingSlash),
|
|
101
104
|
output: z.union([z.literal("static"), z.literal("server"), z.literal("hybrid")]).optional().default("static").refine((val) => val !== "hybrid", {
|
|
@@ -307,7 +310,7 @@ const AstroConfigSchema = z.object({
|
|
|
307
310
|
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
308
311
|
contentIntellisense: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentIntellisense),
|
|
309
312
|
chromeDevtoolsWorkspace: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.chromeDevtoolsWorkspace),
|
|
310
|
-
|
|
313
|
+
svgOptimizer: SvgOptimizerSchema.optional(),
|
|
311
314
|
cache: CacheSchema.optional(),
|
|
312
315
|
routeRules: RouteRulesSchema.optional(),
|
|
313
316
|
rustCompiler: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.rustCompiler),
|
|
@@ -315,7 +318,11 @@ const AstroConfigSchema = z.object({
|
|
|
315
318
|
enabled: z.boolean().optional().prefault(false),
|
|
316
319
|
poolSize: z.number().int().nonnegative().optional(),
|
|
317
320
|
contentCache: z.boolean().optional()
|
|
318
|
-
}).optional().prefault(ASTRO_CONFIG_DEFAULTS.experimental.queuedRendering)
|
|
321
|
+
}).optional().prefault(ASTRO_CONFIG_DEFAULTS.experimental.queuedRendering),
|
|
322
|
+
logger: z.object({
|
|
323
|
+
entrypoint: z.string(),
|
|
324
|
+
config: z.record(z.string(), z.any()).optional()
|
|
325
|
+
}).optional()
|
|
319
326
|
}).prefault({}),
|
|
320
327
|
legacy: z.object({
|
|
321
328
|
collectionsBackwardsCompat: z.boolean().optional().default(false)
|
|
@@ -384,7 +384,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
384
384
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
385
385
|
contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
386
386
|
chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
387
|
-
|
|
387
|
+
svgOptimizer: z.ZodOptional<z.ZodObject<{
|
|
388
|
+
name: z.ZodString;
|
|
389
|
+
optimize: z.ZodCustom<(contents: string) => string | Promise<string>, (contents: string) => string | Promise<string>>;
|
|
390
|
+
}, z.core.$strip>>;
|
|
388
391
|
cache: z.ZodOptional<z.ZodObject<{
|
|
389
392
|
provider: z.ZodOptional<z.ZodObject<{
|
|
390
393
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -403,13 +406,17 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
403
406
|
poolSize: z.ZodOptional<z.ZodNumber>;
|
|
404
407
|
contentCache: z.ZodOptional<z.ZodBoolean>;
|
|
405
408
|
}, z.core.$strip>>>;
|
|
409
|
+
logger: z.ZodOptional<z.ZodObject<{
|
|
410
|
+
entrypoint: z.ZodString;
|
|
411
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
412
|
+
}, z.core.$strip>>;
|
|
406
413
|
}, z.core.$strict>>;
|
|
407
414
|
legacy: z.ZodPrefault<z.ZodObject<{
|
|
408
415
|
collectionsBackwardsCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
409
416
|
}, z.core.$strip>>;
|
|
410
417
|
root: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("url").URL, string>>;
|
|
411
418
|
srcDir: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("url").URL, string>>;
|
|
412
|
-
compressHTML: z.ZodDefault<z.ZodOptional<z.ZodBoolean
|
|
419
|
+
compressHTML: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"jsx">]>>>;
|
|
413
420
|
publicDir: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("url").URL, string>>;
|
|
414
421
|
outDir: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("url").URL, string>>;
|
|
415
422
|
cacheDir: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("url").URL, string>>;
|
|
@@ -570,13 +577,16 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
570
577
|
clientPrerender: boolean;
|
|
571
578
|
contentIntellisense: boolean;
|
|
572
579
|
chromeDevtoolsWorkspace: boolean;
|
|
573
|
-
svgo: boolean | import("svgo").Config;
|
|
574
580
|
rustCompiler: boolean;
|
|
575
581
|
queuedRendering: {
|
|
576
582
|
enabled: boolean;
|
|
577
583
|
poolSize?: number | undefined;
|
|
578
584
|
contentCache?: boolean | undefined;
|
|
579
585
|
};
|
|
586
|
+
svgOptimizer?: {
|
|
587
|
+
name: string;
|
|
588
|
+
optimize: (contents: string) => string | Promise<string>;
|
|
589
|
+
} | undefined;
|
|
580
590
|
cache?: {
|
|
581
591
|
provider?: {
|
|
582
592
|
entrypoint: string | URL;
|
|
@@ -589,13 +599,17 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
589
599
|
swr?: number | undefined;
|
|
590
600
|
tags?: string[] | undefined;
|
|
591
601
|
}> | undefined;
|
|
602
|
+
logger?: {
|
|
603
|
+
entrypoint: string;
|
|
604
|
+
config?: Record<string, any> | undefined;
|
|
605
|
+
} | undefined;
|
|
592
606
|
};
|
|
593
607
|
legacy: {
|
|
594
608
|
collectionsBackwardsCompat: boolean;
|
|
595
609
|
};
|
|
596
610
|
root: import("url").URL;
|
|
597
611
|
srcDir: import("url").URL;
|
|
598
|
-
compressHTML: boolean;
|
|
612
|
+
compressHTML: boolean | "jsx";
|
|
599
613
|
publicDir: import("url").URL;
|
|
600
614
|
outDir: import("url").URL;
|
|
601
615
|
cacheDir: import("url").URL;
|
|
@@ -812,13 +826,16 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
812
826
|
clientPrerender: boolean;
|
|
813
827
|
contentIntellisense: boolean;
|
|
814
828
|
chromeDevtoolsWorkspace: boolean;
|
|
815
|
-
svgo: boolean | import("svgo").Config;
|
|
816
829
|
rustCompiler: boolean;
|
|
817
830
|
queuedRendering: {
|
|
818
831
|
enabled: boolean;
|
|
819
832
|
poolSize?: number | undefined;
|
|
820
833
|
contentCache?: boolean | undefined;
|
|
821
834
|
};
|
|
835
|
+
svgOptimizer?: {
|
|
836
|
+
name: string;
|
|
837
|
+
optimize: (contents: string) => string | Promise<string>;
|
|
838
|
+
} | undefined;
|
|
822
839
|
cache?: {
|
|
823
840
|
provider?: {
|
|
824
841
|
entrypoint: string | URL;
|
|
@@ -831,13 +848,17 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
831
848
|
swr?: number | undefined;
|
|
832
849
|
tags?: string[] | undefined;
|
|
833
850
|
}> | undefined;
|
|
851
|
+
logger?: {
|
|
852
|
+
entrypoint: string;
|
|
853
|
+
config?: Record<string, any> | undefined;
|
|
854
|
+
} | undefined;
|
|
834
855
|
};
|
|
835
856
|
legacy: {
|
|
836
857
|
collectionsBackwardsCompat: boolean;
|
|
837
858
|
};
|
|
838
859
|
root: import("url").URL;
|
|
839
860
|
srcDir: import("url").URL;
|
|
840
|
-
compressHTML: boolean;
|
|
861
|
+
compressHTML: boolean | "jsx";
|
|
841
862
|
publicDir: import("url").URL;
|
|
842
863
|
outDir: import("url").URL;
|
|
843
864
|
cacheDir: import("url").URL;
|
|
@@ -16,7 +16,7 @@ function createRelativeSchema(cmd, fileProtocolRoot) {
|
|
|
16
16
|
const AstroConfigRelativeSchema = AstroConfigSchema.extend({
|
|
17
17
|
root: z.string().default(ASTRO_CONFIG_DEFAULTS.root).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
|
|
18
18
|
srcDir: z.string().default(ASTRO_CONFIG_DEFAULTS.srcDir).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
|
|
19
|
-
compressHTML: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.compressHTML),
|
|
19
|
+
compressHTML: z.union([z.boolean(), z.literal("jsx")]).optional().default(ASTRO_CONFIG_DEFAULTS.compressHTML),
|
|
20
20
|
publicDir: z.string().default(ASTRO_CONFIG_DEFAULTS.publicDir).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
|
|
21
21
|
outDir: z.string().default(ASTRO_CONFIG_DEFAULTS.outDir).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
|
|
22
22
|
cacheDir: z.string().default(ASTRO_CONFIG_DEFAULTS.cacheDir).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
|
|
@@ -138,7 +138,8 @@ function createBaseSettings(config, logLevel) {
|
|
|
138
138
|
fontResources: /* @__PURE__ */ new Set(),
|
|
139
139
|
styleHashes: []
|
|
140
140
|
},
|
|
141
|
-
logLevel: logLevel ?? "info"
|
|
141
|
+
logLevel: logLevel ?? "info",
|
|
142
|
+
fontsHttpServer: null
|
|
142
143
|
};
|
|
143
144
|
}
|
|
144
145
|
async function createSettings(config, logLevel, cwd) {
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url";
|
|
2
|
-
import {
|
|
3
|
-
createServer,
|
|
4
|
-
isRunnableDevEnvironment
|
|
5
|
-
} from "vite";
|
|
2
|
+
import { isRunnableDevEnvironment } from "vite";
|
|
6
3
|
import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
|
|
7
4
|
import { debug } from "../logger/core.js";
|
|
8
5
|
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../constants.js";
|
|
9
|
-
|
|
10
|
-
const viteServer = await createServer({
|
|
11
|
-
configFile: false,
|
|
12
|
-
server: { middlewareMode: true, hmr: false, watch: null, ws: false },
|
|
13
|
-
optimizeDeps: { noDiscovery: true },
|
|
14
|
-
clearScreen: false,
|
|
15
|
-
appType: "custom",
|
|
16
|
-
ssr: { external: true },
|
|
17
|
-
plugins: [loadFallbackPlugin({ fs, root: pathToFileURL(root) })]
|
|
18
|
-
});
|
|
19
|
-
return viteServer;
|
|
20
|
-
}
|
|
6
|
+
import { createMinimalViteDevServer } from "../createMinimalViteDevServer.js";
|
|
21
7
|
async function loadConfigWithVite({
|
|
22
8
|
configPath,
|
|
23
9
|
fs,
|
|
@@ -36,7 +22,8 @@ async function loadConfigWithVite({
|
|
|
36
22
|
}
|
|
37
23
|
let server;
|
|
38
24
|
try {
|
|
39
|
-
|
|
25
|
+
const plugins = loadFallbackPlugin({ fs, root: pathToFileURL(root) });
|
|
26
|
+
server = await createMinimalViteDevServer(plugins);
|
|
40
27
|
if (isRunnableDevEnvironment(server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr])) {
|
|
41
28
|
const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
42
29
|
const mod = await environment.runner.import(configPath);
|
package/dist/core/constants.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ViteDevServer, type Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a minimal dev server with a list of plugins. Use this instance for a one-shot usage.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This is intentionally in its own module to avoid pulling `vite`'s heavy `createServer`
|
|
6
|
+
* (and transitively Rollup) into every file that imports from `viteUtils.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMinimalViteDevServer(plugins?: Plugin[]): Promise<ViteDevServer>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createServer } from "vite";
|
|
2
|
+
async function createMinimalViteDevServer(plugins = []) {
|
|
3
|
+
return await createServer({
|
|
4
|
+
configFile: false,
|
|
5
|
+
server: { middlewareMode: true, hmr: false, watch: null, ws: false },
|
|
6
|
+
optimizeDeps: { noDiscovery: true },
|
|
7
|
+
clearScreen: false,
|
|
8
|
+
appType: "custom",
|
|
9
|
+
ssr: { external: true },
|
|
10
|
+
plugins
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
createMinimalViteDevServer
|
|
15
|
+
};
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.
|
|
40
|
+
const currentVersion = "6.2.0";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
package/dist/core/dev/restart.js
CHANGED
|
@@ -11,7 +11,7 @@ import { clearCrawlCache, createVite } from "../create-vite.js";
|
|
|
11
11
|
import { collectErrorMetadata } from "../errors/dev/utils.js";
|
|
12
12
|
import { isAstroConfigZodError } from "../errors/errors.js";
|
|
13
13
|
import { createSafeError } from "../errors/index.js";
|
|
14
|
-
import {
|
|
14
|
+
import { loadOrCreateNodeLogger } from "../logger/load.js";
|
|
15
15
|
import { formatErrorMessage, warnIfCspWithShiki } from "../messages/runtime.js";
|
|
16
16
|
import { createRoutesList } from "../routing/create-manifest.js";
|
|
17
17
|
import { createContainer } from "./container.js";
|
|
@@ -97,8 +97,8 @@ async function createContainerWithAutomaticRestart({
|
|
|
97
97
|
inlineConfig,
|
|
98
98
|
fs
|
|
99
99
|
}) {
|
|
100
|
-
const logger = createNodeLogger(inlineConfig ?? {});
|
|
101
100
|
const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, "dev", fs);
|
|
101
|
+
const logger = await loadOrCreateNodeLogger(astroConfig, inlineConfig ?? {});
|
|
102
102
|
warnIfCspWithShiki(astroConfig, logger);
|
|
103
103
|
telemetry.record(eventCliSession("dev", userConfig));
|
|
104
104
|
const settings = await createSettings(
|
|
@@ -539,12 +539,12 @@ export declare const UnsupportedImageConversion: {
|
|
|
539
539
|
};
|
|
540
540
|
/**
|
|
541
541
|
* @docs
|
|
542
|
-
* @message An error occurred while optimizing the SVG file with
|
|
542
|
+
* @message An error occurred while optimizing the SVG file with the optimizer.
|
|
543
543
|
*/
|
|
544
544
|
export declare const CannotOptimizeSvg: {
|
|
545
545
|
name: string;
|
|
546
546
|
title: string;
|
|
547
|
-
message: (path: string) => string;
|
|
547
|
+
message: (path: string, name: string) => string;
|
|
548
548
|
hint: string;
|
|
549
549
|
};
|
|
550
550
|
/**
|
|
@@ -1314,6 +1314,29 @@ export declare const FontFamilyNotFound: {
|
|
|
1314
1314
|
message: (family: string) => string;
|
|
1315
1315
|
hint: string;
|
|
1316
1316
|
};
|
|
1317
|
+
/**
|
|
1318
|
+
* @docs
|
|
1319
|
+
* @description
|
|
1320
|
+
* Font file URL not found
|
|
1321
|
+
* @message
|
|
1322
|
+
* The URL passed to the `experimental_getFontFileURL()` function is invalid.
|
|
1323
|
+
*/
|
|
1324
|
+
export declare const FontFileUrlNotFound: {
|
|
1325
|
+
name: string;
|
|
1326
|
+
title: string;
|
|
1327
|
+
message: (url: string) => string;
|
|
1328
|
+
hint: string;
|
|
1329
|
+
};
|
|
1330
|
+
/**
|
|
1331
|
+
* @docs
|
|
1332
|
+
* @description
|
|
1333
|
+
* `experimental_getFontFileURL()` requires the request URL with on-demand rendering.
|
|
1334
|
+
*/
|
|
1335
|
+
export declare const MissingGetFontFileRequestUrl: {
|
|
1336
|
+
name: string;
|
|
1337
|
+
title: string;
|
|
1338
|
+
hint: string;
|
|
1339
|
+
};
|
|
1317
1340
|
/**
|
|
1318
1341
|
* @docs
|
|
1319
1342
|
* @description
|
|
@@ -1326,6 +1349,29 @@ export declare const UnavailableAstroGlobal: {
|
|
|
1326
1349
|
title: string;
|
|
1327
1350
|
message: (name: string) => string;
|
|
1328
1351
|
};
|
|
1352
|
+
/**
|
|
1353
|
+
* @docs
|
|
1354
|
+
* @description
|
|
1355
|
+
* Unable to load the logger.
|
|
1356
|
+
* @message
|
|
1357
|
+
* Couldn't load the logger at the given path.
|
|
1358
|
+
*/
|
|
1359
|
+
export declare const UnableToLoadLogger: {
|
|
1360
|
+
name: string;
|
|
1361
|
+
title: string;
|
|
1362
|
+
message: (path: string) => string;
|
|
1363
|
+
};
|
|
1364
|
+
/**
|
|
1365
|
+
* @docs
|
|
1366
|
+
* @description
|
|
1367
|
+
* The configuration of the logger is not serializable.
|
|
1368
|
+
* @message
|
|
1369
|
+
* The configuration of the logger is not serializable.
|
|
1370
|
+
*/
|
|
1371
|
+
export declare const LoggerConfigurationNotSerializable: {
|
|
1372
|
+
name: string;
|
|
1373
|
+
title: string;
|
|
1374
|
+
};
|
|
1329
1375
|
/**
|
|
1330
1376
|
* @docs
|
|
1331
1377
|
* @kind heading
|
|
@@ -197,8 +197,8 @@ const UnsupportedImageConversion = {
|
|
|
197
197
|
const CannotOptimizeSvg = {
|
|
198
198
|
name: "CannotOptimizeSvg",
|
|
199
199
|
title: "Cannot optimize SVG",
|
|
200
|
-
message: (path) => `An error occurred while optimizing SVG file "${path}" with
|
|
201
|
-
hint: "Review the included
|
|
200
|
+
message: (path, name) => `An error occurred while optimizing SVG file "${path}" with the "${name}" optimizer.`,
|
|
201
|
+
hint: "Review the included error message provided for guidance."
|
|
202
202
|
};
|
|
203
203
|
const PrerenderDynamicEndpointPathCollide = {
|
|
204
204
|
name: "PrerenderDynamicEndpointPathCollide",
|
|
@@ -496,11 +496,31 @@ const FontFamilyNotFound = {
|
|
|
496
496
|
message: (family) => `No data was found for the \`"${family}"\` family passed to the \`<Font>\` component.`,
|
|
497
497
|
hint: "This is often caused by a typo. Check that the `<Font />` component is using a `cssVariable` specified in your config."
|
|
498
498
|
};
|
|
499
|
+
const FontFileUrlNotFound = {
|
|
500
|
+
name: "FontFileUrlNotFound",
|
|
501
|
+
title: "Font file URL not found",
|
|
502
|
+
message: (url) => `The \`"${url}"\` URL passed to the \`experimental_getFontFileURL()\` function is invalid.`,
|
|
503
|
+
hint: "Make sure you pass a valid URL, obtained via the `fontData` object."
|
|
504
|
+
};
|
|
505
|
+
const MissingGetFontFileRequestUrl = {
|
|
506
|
+
name: "MissingGetFontFileRequestUrl",
|
|
507
|
+
title: "`experimental_getFontFileURL()` requires the request URL with on-demand rendering.",
|
|
508
|
+
hint: "Pass the request URL as the 2nd argument, for example `Astro.url`."
|
|
509
|
+
};
|
|
499
510
|
const UnavailableAstroGlobal = {
|
|
500
511
|
name: "UnavailableAstroGlobal",
|
|
501
512
|
title: "Unavailable Astro global in getStaticPaths()",
|
|
502
513
|
message: (name) => `The Astro global is not available in this scope. Please remove "Astro.${name}" from your getStaticPaths() function.`
|
|
503
514
|
};
|
|
515
|
+
const UnableToLoadLogger = {
|
|
516
|
+
name: "UnableToLoadLogger",
|
|
517
|
+
title: "Unable to load the logger.",
|
|
518
|
+
message: (path) => `Couldn't load the logger at given path "${path}".`
|
|
519
|
+
};
|
|
520
|
+
const LoggerConfigurationNotSerializable = {
|
|
521
|
+
name: "LoggerConfigurationNotSerializable",
|
|
522
|
+
title: "The configuration of the logger is not serializable"
|
|
523
|
+
};
|
|
504
524
|
const UnknownCSSError = {
|
|
505
525
|
name: "UnknownCSSError",
|
|
506
526
|
title: "Unknown CSS Error."
|
|
@@ -820,6 +840,7 @@ export {
|
|
|
820
840
|
FileGlobNotSupported,
|
|
821
841
|
FileParserNotFound,
|
|
822
842
|
FontFamilyNotFound,
|
|
843
|
+
FontFileUrlNotFound,
|
|
823
844
|
ForbiddenRewrite,
|
|
824
845
|
GenerateContentTypesError,
|
|
825
846
|
GetEntryDeprecationError,
|
|
@@ -850,11 +871,13 @@ export {
|
|
|
850
871
|
LocalImageUsedWrongly,
|
|
851
872
|
LocalsNotAnObject,
|
|
852
873
|
LocalsReassigned,
|
|
874
|
+
LoggerConfigurationNotSerializable,
|
|
853
875
|
MarkdownFrontmatterParseError,
|
|
854
876
|
MdxIntegrationMissingError,
|
|
855
877
|
MiddlewareCantBeLoaded,
|
|
856
878
|
MiddlewareNoDataOrNextCalled,
|
|
857
879
|
MiddlewareNotAResponse,
|
|
880
|
+
MissingGetFontFileRequestUrl,
|
|
858
881
|
MissingImageDimension,
|
|
859
882
|
MissingIndexForInternationalization,
|
|
860
883
|
MissingLocale,
|
|
@@ -887,6 +910,7 @@ export {
|
|
|
887
910
|
SessionStorageInitError,
|
|
888
911
|
SessionStorageSaveError,
|
|
889
912
|
StaticClientAddressNotAvailable,
|
|
913
|
+
UnableToLoadLogger,
|
|
890
914
|
UnavailableAstroGlobal,
|
|
891
915
|
UnhandledRejection,
|
|
892
916
|
UnknownCLIError,
|
|
File without changes
|