astro 7.0.0-alpha.2 → 7.0.0-beta.3
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/fonts/core/collect-font-data.js +1 -0
- package/dist/assets/fonts/types.d.ts +1 -0
- package/dist/cli/add/index.js +0 -44
- package/dist/cli/dev/background.js +1 -1
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/flags.js +4 -6
- package/dist/cli/help/index.js +1 -2
- package/dist/cli/index.js +1 -15
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.js +1 -4
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/base.d.ts +1 -1
- package/dist/core/app/base.js +7 -9
- package/dist/core/app/dev/pipeline.js +0 -9
- package/dist/core/app/manifest.d.ts +0 -2
- package/dist/core/app/manifest.js +0 -8
- package/dist/core/app/types.d.ts +1 -8
- package/dist/core/base-pipeline.d.ts +3 -9
- package/dist/core/base-pipeline.js +4 -23
- package/dist/core/build/app.d.ts +0 -2
- package/dist/core/build/app.js +0 -5
- package/dist/core/build/generate.js +0 -14
- package/dist/core/build/pipeline.js +0 -9
- package/dist/core/build/plugins/plugin-manifest.js +4 -9
- package/dist/core/config/config.js +3 -2
- package/dist/core/config/schemas/base.d.ts +6 -19
- package/dist/core/config/schemas/base.js +8 -24
- package/dist/core/config/schemas/relative.d.ts +15 -36
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/fetch/fetch-state.js +0 -14
- package/dist/core/fetch/types.d.ts +1 -1
- package/dist/core/fetch/vite-plugin.js +4 -6
- package/dist/core/hono/index.d.ts +1 -0
- package/dist/core/hono/index.js +1 -0
- package/dist/core/logger/impls/node.js +0 -1
- package/dist/core/logger/load.js +3 -2
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/index.js +8 -1
- package/dist/manifest/serialized.js +4 -5
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/runtime/server/index.js +4 -0
- package/dist/runtime/server/render/astro/render-template.d.ts +1 -1
- package/dist/runtime/server/render/astro/render.d.ts +0 -4
- package/dist/runtime/server/render/astro/render.js +76 -68
- package/dist/runtime/server/render/index.d.ts +1 -0
- package/dist/runtime/server/render/index.js +2 -0
- package/dist/runtime/server/render/page.js +9 -44
- package/dist/runtime/server/render/streaming.d.ts +23 -0
- package/dist/runtime/server/render/streaming.js +238 -0
- package/dist/runtime/server/render/util.js +1 -1
- package/dist/types/public/config.d.ts +58 -121
- package/dist/types/public/context.d.ts +1 -1
- package/dist/types/public/internal.d.ts +0 -15
- package/dist/vite-plugin-app/app.js +1 -1
- package/dist/vite-plugin-app/pipeline.js +0 -9
- package/package.json +1 -1
- package/dist/cli/db/index.d.ts +0 -4
- package/dist/cli/db/index.js +0 -25
- package/dist/runtime/server/html-string-cache.d.ts +0 -48
- package/dist/runtime/server/html-string-cache.js +0 -119
- package/dist/runtime/server/render/queue/builder.d.ts +0 -14
- package/dist/runtime/server/render/queue/builder.js +0 -182
- package/dist/runtime/server/render/queue/jsx-builder.d.ts +0 -33
- package/dist/runtime/server/render/queue/jsx-builder.js +0 -146
- package/dist/runtime/server/render/queue/pool.d.ts +0 -123
- package/dist/runtime/server/render/queue/pool.js +0 -203
- package/dist/runtime/server/render/queue/renderer.d.ts +0 -12
- package/dist/runtime/server/render/queue/renderer.js +0 -103
- package/dist/runtime/server/render/queue/types.d.ts +0 -81
- package/dist/runtime/server/render/queue/types.js +0 -0
package/dist/cli/add/index.js
CHANGED
|
@@ -46,20 +46,6 @@ export default {
|
|
|
46
46
|
`,
|
|
47
47
|
LIT_NPMRC: `# Lit libraries are required to be hoisted due to dependency issues.
|
|
48
48
|
public-hoist-pattern[]=*lit*
|
|
49
|
-
`,
|
|
50
|
-
DB_CONFIG: `import { defineDb } from 'astro:db';
|
|
51
|
-
|
|
52
|
-
// https://astro.build/db/config
|
|
53
|
-
export default defineDb({
|
|
54
|
-
tables: {}
|
|
55
|
-
});
|
|
56
|
-
`,
|
|
57
|
-
DB_SEED: `import { db } from 'astro:db';
|
|
58
|
-
|
|
59
|
-
// https://astro.build/db/seed
|
|
60
|
-
export default async function seed() {
|
|
61
|
-
// TODO
|
|
62
|
-
}
|
|
63
49
|
`,
|
|
64
50
|
CLOUDFLARE_WRANGLER_CONFIG: (name, compatibilityDate) => `{
|
|
65
51
|
"compatibility_date": ${JSON.stringify(compatibilityDate)},
|
|
@@ -113,7 +99,6 @@ async function add(names, { flags }) {
|
|
|
113
99
|
["node", "astro add node"]
|
|
114
100
|
],
|
|
115
101
|
Others: [
|
|
116
|
-
["db", "astro add db"],
|
|
117
102
|
["tailwind", "astro add tailwind"],
|
|
118
103
|
["mdx", "astro add mdx"],
|
|
119
104
|
["markdoc", "astro add markdoc"],
|
|
@@ -235,35 +220,6 @@ async function add(names, { flags }) {
|
|
|
235
220
|
defaultConfigContent: STUBS.SVELTE_CONFIG
|
|
236
221
|
});
|
|
237
222
|
}
|
|
238
|
-
if (integrations.find((integration) => integration.id === "db")) {
|
|
239
|
-
if (!existsSync(new URL("./db/", root))) {
|
|
240
|
-
logger.info(
|
|
241
|
-
"SKIP_FORMAT",
|
|
242
|
-
`
|
|
243
|
-
${magenta(
|
|
244
|
-
`Astro will scaffold ${green("./db/config.ts")}${magenta(" and ")}${green(
|
|
245
|
-
"./db/seed.ts"
|
|
246
|
-
)}${magenta(" files.")}`
|
|
247
|
-
)}
|
|
248
|
-
`
|
|
249
|
-
);
|
|
250
|
-
if (await askToContinue({ flags, logger })) {
|
|
251
|
-
await fs.mkdir(new URL("./db", root));
|
|
252
|
-
await Promise.all([
|
|
253
|
-
fs.writeFile(new URL("./db/config.ts", root), STUBS.DB_CONFIG, { encoding: "utf-8" }),
|
|
254
|
-
fs.writeFile(new URL("./db/seed.ts", root), STUBS.DB_SEED, { encoding: "utf-8" })
|
|
255
|
-
]);
|
|
256
|
-
} else {
|
|
257
|
-
logger.info(
|
|
258
|
-
"SKIP_FORMAT",
|
|
259
|
-
`
|
|
260
|
-
Astro DB requires additional configuration. Please refer to https://astro.build/db/config`
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
} else {
|
|
264
|
-
logger.debug("add", `Using existing db configuration`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
223
|
if (integrations.find((integration) => integration.id === "lit") && (await detect({ cwd: fileURLToPath(root) }))?.name === "pnpm") {
|
|
268
224
|
await setupIntegrationConfig({
|
|
269
225
|
root,
|
|
@@ -60,7 +60,7 @@ async function background({
|
|
|
60
60
|
if (flags.config) args.push("--config", String(flags.config));
|
|
61
61
|
if (flags.root) args.push("--root", String(flags.root));
|
|
62
62
|
if (flags.allowedHosts) args.push("--allowed-hosts", String(flags.allowedHosts));
|
|
63
|
-
if (flags.
|
|
63
|
+
if (flags.json) args.push("--json");
|
|
64
64
|
const logFileURL = getLogFileURL(root);
|
|
65
65
|
const logFilePath = fileURLToPath(logFileURL);
|
|
66
66
|
const dotAstroDir = fileURLToPath(new URL(".astro/", root));
|
package/dist/cli/dev/index.js
CHANGED
|
@@ -47,7 +47,7 @@ async function dev({ flags }) {
|
|
|
47
47
|
}
|
|
48
48
|
const agentDetected = !process.env.ASTRO_DEV_BACKGROUND && isRunByAgent();
|
|
49
49
|
if (agentDetected) {
|
|
50
|
-
flags.
|
|
50
|
+
flags.json = true;
|
|
51
51
|
}
|
|
52
52
|
const logger = createLoggerFromFlags(flags);
|
|
53
53
|
const subcommand = flags._[3]?.toString();
|
package/dist/cli/flags.js
CHANGED
|
@@ -19,11 +19,9 @@ function flagsToAstroInlineConfig(flags) {
|
|
|
19
19
|
allowedHosts: typeof flags.allowedHosts === "string" ? flags.allowedHosts.split(",") : typeof flags.allowedHosts === "boolean" && flags.allowedHosts === true ? flags.allowedHosts : []
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
if (flags.
|
|
23
|
-
inlineConfig.
|
|
24
|
-
|
|
25
|
-
entrypoint: "astro/logger/json"
|
|
26
|
-
}
|
|
22
|
+
if (flags.json) {
|
|
23
|
+
inlineConfig.logger = {
|
|
24
|
+
entrypoint: "astro/logger/json"
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
return inlineConfig;
|
|
@@ -35,7 +33,7 @@ function createLoggerFromFlags(flags) {
|
|
|
35
33
|
} else if (flags.silent) {
|
|
36
34
|
logLevel = "silent";
|
|
37
35
|
}
|
|
38
|
-
if (flags.
|
|
36
|
+
if (flags.json) {
|
|
39
37
|
return createJsonLoggerFromFlags({ logLevel });
|
|
40
38
|
} else {
|
|
41
39
|
return createNodeLoggerFromFlags({ logLevel });
|
package/dist/cli/help/index.js
CHANGED
|
@@ -8,7 +8,6 @@ const DEFAULT_HELP_PAYLOAD = {
|
|
|
8
8
|
["build", "Build your project and write it to disk."],
|
|
9
9
|
["check", "Check your project for errors."],
|
|
10
10
|
["create-key", "Create a cryptography key"],
|
|
11
|
-
["db", "Manage your Astro database."],
|
|
12
11
|
["dev", "Start the development server."],
|
|
13
12
|
["docs", "Open documentation in your web browser."],
|
|
14
13
|
["info", "List info about your current Astro setup."],
|
|
@@ -26,7 +25,7 @@ const DEFAULT_HELP_PAYLOAD = {
|
|
|
26
25
|
["--silent", "Disable all logging."],
|
|
27
26
|
["--version", "Show the version number and exit."],
|
|
28
27
|
["--help", "Show this help message."],
|
|
29
|
-
["--
|
|
28
|
+
["--json", "Enables JSON logging."]
|
|
30
29
|
]
|
|
31
30
|
}
|
|
32
31
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -13,12 +13,7 @@ function resolveCommand(flags) {
|
|
|
13
13
|
"check",
|
|
14
14
|
"create-key",
|
|
15
15
|
"docs",
|
|
16
|
-
"
|
|
17
|
-
"info",
|
|
18
|
-
"login",
|
|
19
|
-
"logout",
|
|
20
|
-
"link",
|
|
21
|
-
"init"
|
|
16
|
+
"info"
|
|
22
17
|
]);
|
|
23
18
|
if (supportedCommands.has(cmd)) {
|
|
24
19
|
return cmd;
|
|
@@ -183,15 +178,6 @@ async function runCommand(cmd, flags) {
|
|
|
183
178
|
await add(packages, { flags });
|
|
184
179
|
return;
|
|
185
180
|
}
|
|
186
|
-
case "db":
|
|
187
|
-
case "login":
|
|
188
|
-
case "logout":
|
|
189
|
-
case "link":
|
|
190
|
-
case "init": {
|
|
191
|
-
const { db } = await import("./db/index.js");
|
|
192
|
-
await db({ flags });
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
181
|
case "dev": {
|
|
196
182
|
const { dev } = await import("./dev/index.js");
|
|
197
183
|
const server = await dev({ flags });
|
package/dist/container/index.js
CHANGED
|
@@ -63,10 +63,7 @@ function createManifest(manifest, renderers, middleware) {
|
|
|
63
63
|
placement: void 0
|
|
64
64
|
},
|
|
65
65
|
logLevel: "silent",
|
|
66
|
-
|
|
67
|
-
enabled: false
|
|
68
|
-
},
|
|
69
|
-
experimentalLogger: manifest?.experimentalLogger ?? void 0
|
|
66
|
+
loggerConfig: manifest?.loggerConfig ?? void 0
|
|
70
67
|
};
|
|
71
68
|
}
|
|
72
69
|
class experimental_AstroContainer {
|
|
@@ -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.0-
|
|
200
|
+
if (previousAstroVersion && previousAstroVersion !== "7.0.0-beta.3") {
|
|
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.0-
|
|
209
|
-
this.#store.metaStore().set("astro-version", "7.0.0-
|
|
208
|
+
if ("7.0.0-beta.3") {
|
|
209
|
+
this.#store.metaStore().set("astro-version", "7.0.0-beta.3");
|
|
210
210
|
}
|
|
211
211
|
if (currentConfigDigest) {
|
|
212
212
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/base.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare abstract class BaseApp<P extends Pipeline = AppPipeline> {
|
|
|
101
101
|
/**
|
|
102
102
|
* Override the fetch handler used to dispatch requests. Entrypoints
|
|
103
103
|
* call this with the default export of `virtual:astro:fetchable` to
|
|
104
|
-
* plug in a user-authored handler from `src/
|
|
104
|
+
* plug in a user-authored handler from `src/fetch.ts`.
|
|
105
105
|
*/
|
|
106
106
|
setFetchHandler(handler: {
|
|
107
107
|
fetch: FetchHandler;
|
package/dist/core/app/base.js
CHANGED
|
@@ -30,7 +30,7 @@ class BaseApp {
|
|
|
30
30
|
#fetchHandler;
|
|
31
31
|
#errorHandler;
|
|
32
32
|
/**
|
|
33
|
-
* Whether a custom fetch handler (from `src/
|
|
33
|
+
* Whether a custom fetch handler (from `src/fetch.ts`) has been set
|
|
34
34
|
* via `setFetchHandler`. When false, the `DefaultFetchHandler` is
|
|
35
35
|
* in use and all features are implicitly active.
|
|
36
36
|
*/
|
|
@@ -44,11 +44,9 @@ class BaseApp {
|
|
|
44
44
|
return this.pipeline.logger;
|
|
45
45
|
}
|
|
46
46
|
get adapterLogger() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.manifest.adapterName
|
|
51
|
-
);
|
|
47
|
+
const currentOptions = this.logger.options;
|
|
48
|
+
if (!this.#adapterLogger || this.#adapterLogger.options !== currentOptions) {
|
|
49
|
+
this.#adapterLogger = new AstroIntegrationLogger(currentOptions, this.manifest.adapterName);
|
|
52
50
|
}
|
|
53
51
|
return this.#adapterLogger;
|
|
54
52
|
}
|
|
@@ -63,7 +61,7 @@ class BaseApp {
|
|
|
63
61
|
/**
|
|
64
62
|
* Override the fetch handler used to dispatch requests. Entrypoints
|
|
65
63
|
* call this with the default export of `virtual:astro:fetchable` to
|
|
66
|
-
* plug in a user-authored handler from `src/
|
|
64
|
+
* plug in a user-authored handler from `src/fetch.ts`.
|
|
67
65
|
*/
|
|
68
66
|
setFetchHandler(handler) {
|
|
69
67
|
this.#fetchHandler = handler;
|
|
@@ -298,7 +296,7 @@ class BaseApp {
|
|
|
298
296
|
return this.#errorHandler.renderError(request, options);
|
|
299
297
|
}
|
|
300
298
|
/**
|
|
301
|
-
* One-shot check: after the first request with a custom `src/
|
|
299
|
+
* One-shot check: after the first request with a custom `src/fetch.ts`,
|
|
302
300
|
* compare `usedFeatures` against the manifest and warn about any
|
|
303
301
|
* configured features the user's pipeline doesn't call.
|
|
304
302
|
*/
|
|
@@ -329,7 +327,7 @@ class BaseApp {
|
|
|
329
327
|
for (const feature of missing) {
|
|
330
328
|
this.logger.warn(
|
|
331
329
|
"router",
|
|
332
|
-
`Your project uses ${feature}, but your custom src/
|
|
330
|
+
`Your project uses ${feature}, but your custom src/fetch.ts does not call the ${feature}() handler. This feature will not work unless you add it to your fetch.ts pipeline.`
|
|
333
331
|
);
|
|
334
332
|
}
|
|
335
333
|
}
|
|
@@ -2,9 +2,6 @@ import { Pipeline } from "../../base-pipeline.js";
|
|
|
2
2
|
import { ASTRO_VERSION } from "../../constants.js";
|
|
3
3
|
import { createModuleScriptElement, createStylesheetElementSet } from "../../render/ssr-element.js";
|
|
4
4
|
import { findRouteToRewrite } from "../../routing/rewrite.js";
|
|
5
|
-
import { newNodePool } from "../../../runtime/server/render/queue/pool.js";
|
|
6
|
-
import { HTMLStringCache } from "../../../runtime/server/html-string-cache.js";
|
|
7
|
-
import { queueRenderingEnabled } from "../manifest.js";
|
|
8
5
|
class NonRunnablePipeline extends Pipeline {
|
|
9
6
|
getName() {
|
|
10
7
|
return "NonRunnablePipeline";
|
|
@@ -33,12 +30,6 @@ class NonRunnablePipeline extends Pipeline {
|
|
|
33
30
|
void 0,
|
|
34
31
|
void 0
|
|
35
32
|
);
|
|
36
|
-
if (queueRenderingEnabled(manifest.experimentalQueuedRendering)) {
|
|
37
|
-
pipeline.nodePool = newNodePool(manifest.experimentalQueuedRendering);
|
|
38
|
-
if (manifest.experimentalQueuedRendering.contentCache) {
|
|
39
|
-
pipeline.htmlStringCache = new HTMLStringCache(1e3);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
33
|
return pipeline;
|
|
43
34
|
}
|
|
44
35
|
async headElements(routeData) {
|
|
@@ -8,5 +8,3 @@ export declare function serializeRouteData(routeData: RouteData, trailingSlash:
|
|
|
8
8
|
export declare function deserializeRouteData(rawRouteData: SerializedRouteData): RouteData;
|
|
9
9
|
export declare function serializeRouteInfo(routeInfo: RouteInfo, trailingSlash: AstroConfig['trailingSlash']): SerializedRouteInfo;
|
|
10
10
|
export declare function deserializeRouteInfo(rawRouteInfo: SerializedRouteInfo): RouteInfo;
|
|
11
|
-
export declare function queuePoolSize(config: NonNullable<SSRManifest['experimentalQueuedRendering']>): number;
|
|
12
|
-
export declare function queueRenderingEnabled(config: SSRManifest['experimentalQueuedRendering']): boolean;
|
|
@@ -100,18 +100,10 @@ function deserializeRouteInfo(rawRouteInfo) {
|
|
|
100
100
|
routeData: deserializeRouteData(rawRouteInfo.routeData)
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function queuePoolSize(config) {
|
|
104
|
-
return config?.poolSize ?? 1e3;
|
|
105
|
-
}
|
|
106
|
-
function queueRenderingEnabled(config) {
|
|
107
|
-
return config?.enabled ?? false;
|
|
108
|
-
}
|
|
109
103
|
export {
|
|
110
104
|
deserializeManifest,
|
|
111
105
|
deserializeRouteData,
|
|
112
106
|
deserializeRouteInfo,
|
|
113
|
-
queuePoolSize,
|
|
114
|
-
queueRenderingEnabled,
|
|
115
107
|
serializeRouteData,
|
|
116
108
|
serializeRouteInfo
|
|
117
109
|
};
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -61,13 +61,6 @@ export type SSRManifest = {
|
|
|
61
61
|
trailingSlash: AstroConfig['trailingSlash'];
|
|
62
62
|
buildFormat: NonNullable<AstroConfig['build']>['format'];
|
|
63
63
|
compressHTML: boolean | 'jsx';
|
|
64
|
-
experimentalQueuedRendering: {
|
|
65
|
-
enabled: boolean;
|
|
66
|
-
/** Node pool size for memory reuse (default: 1000, set to 0 to disable pooling) */
|
|
67
|
-
poolSize?: number;
|
|
68
|
-
/** Whether to enable HTMLString caching for deduplicating repeated HTML fragments (default: true) */
|
|
69
|
-
contentCache?: boolean;
|
|
70
|
-
};
|
|
71
64
|
assetsPrefix?: AssetsPrefix;
|
|
72
65
|
renderers: SSRLoadedRenderer[];
|
|
73
66
|
/**
|
|
@@ -145,7 +138,7 @@ export type SSRManifest = {
|
|
|
145
138
|
};
|
|
146
139
|
internalFetchHeaders?: Record<string, string>;
|
|
147
140
|
logLevel: AstroLoggerLevel;
|
|
148
|
-
|
|
141
|
+
loggerConfig: LoggerHandlerConfig | undefined;
|
|
149
142
|
};
|
|
150
143
|
export type SSRActions = {
|
|
151
144
|
server: Record<string, ActionClient<any, any, any>>;
|
|
@@ -12,11 +12,9 @@ import { type DefaultRouteParams } from './routing/default.js';
|
|
|
12
12
|
import type { CacheProvider, CacheProviderFactory } from './cache/types.js';
|
|
13
13
|
import type { CompiledCacheRoute } from './cache/runtime/route-matching.js';
|
|
14
14
|
import type { SessionDriverFactory } from './session/types.js';
|
|
15
|
-
import { NodePool } from '../runtime/server/render/queue/pool.js';
|
|
16
|
-
import { HTMLStringCache } from '../runtime/server/html-string-cache.js';
|
|
17
15
|
/**
|
|
18
16
|
* Bit flags for pipeline features that handler classes register as
|
|
19
|
-
* "used" when a custom `src/
|
|
17
|
+
* "used" when a custom `src/fetch.ts` fetch handler is in play. After the
|
|
20
18
|
* first request (dev) or at runtime (prod SSR), we compare against the
|
|
21
19
|
* manifest to warn about features the user configured but forgot to
|
|
22
20
|
* include in their custom pipeline.
|
|
@@ -47,12 +45,10 @@ export declare abstract class Pipeline {
|
|
|
47
45
|
resolvedSessionDriver: SessionDriverFactory | null | undefined;
|
|
48
46
|
resolvedCacheProvider: CacheProvider | null | undefined;
|
|
49
47
|
compiledCacheRoutes: CompiledCacheRoute[] | undefined;
|
|
50
|
-
nodePool: NodePool | undefined;
|
|
51
|
-
htmlStringCache: HTMLStringCache | undefined;
|
|
52
48
|
/**
|
|
53
49
|
* Bit mask of pipeline features activated by handler classes.
|
|
54
50
|
* Each handler sets its bit via `|=`. Only meaningful when a
|
|
55
|
-
* custom `src/
|
|
51
|
+
* custom `src/fetch.ts` fetch handler is in use.
|
|
56
52
|
*/
|
|
57
53
|
usedFeatures: number;
|
|
58
54
|
logger: AstroLogger;
|
|
@@ -166,7 +162,7 @@ export declare abstract class Pipeline {
|
|
|
166
162
|
clearMiddleware(): void;
|
|
167
163
|
/**
|
|
168
164
|
* Resolves the logger destination from the manifest and updates the pipeline logger.
|
|
169
|
-
* If the user configured `
|
|
165
|
+
* If the user configured `logger`, the bundled logger factory is loaded
|
|
170
166
|
* and replaces the default console destination. This is lazy and only resolves once.
|
|
171
167
|
*/
|
|
172
168
|
getLogger(): Promise<AstroLogger>;
|
|
@@ -176,8 +172,6 @@ export declare abstract class Pipeline {
|
|
|
176
172
|
getServerIslands(): Promise<ServerIslandMappings>;
|
|
177
173
|
getAction(path: string): Promise<ActionClient<unknown, ActionAccept, $ZodType>>;
|
|
178
174
|
getModuleForRoute(route: RouteData): Promise<SinglePageBuiltModule>;
|
|
179
|
-
createNodePool(poolSize: number, stats: boolean): NodePool;
|
|
180
|
-
createStringCache(): HTMLStringCache;
|
|
181
175
|
}
|
|
182
176
|
export interface HeadElements extends Pick<SSRResult, 'scripts' | 'styles' | 'links'> {
|
|
183
177
|
}
|
|
@@ -9,8 +9,6 @@ import { RouteCache } from "./render/route-cache.js";
|
|
|
9
9
|
import { createDefaultRoutes } from "./routing/default.js";
|
|
10
10
|
import { ensure404Route } from "./routing/astro-designed-error-pages.js";
|
|
11
11
|
import { Router } from "./routing/router.js";
|
|
12
|
-
import { NodePool } from "../runtime/server/render/queue/pool.js";
|
|
13
|
-
import { HTMLStringCache } from "../runtime/server/html-string-cache.js";
|
|
14
12
|
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
15
13
|
import { loadLogger } from "./logger/load.js";
|
|
16
14
|
const PipelineFeatures = {
|
|
@@ -30,12 +28,10 @@ class Pipeline {
|
|
|
30
28
|
resolvedSessionDriver = void 0;
|
|
31
29
|
resolvedCacheProvider = void 0;
|
|
32
30
|
compiledCacheRoutes = void 0;
|
|
33
|
-
nodePool;
|
|
34
|
-
htmlStringCache;
|
|
35
31
|
/**
|
|
36
32
|
* Bit mask of pipeline features activated by handler classes.
|
|
37
33
|
* Each handler sets its bit via `|=`. Only meaningful when a
|
|
38
|
-
* custom `src/
|
|
34
|
+
* custom `src/fetch.ts` fetch handler is in use.
|
|
39
35
|
*/
|
|
40
36
|
usedFeatures = 0;
|
|
41
37
|
logger;
|
|
@@ -104,15 +100,6 @@ class Pipeline {
|
|
|
104
100
|
buildFormat: manifest.buildFormat
|
|
105
101
|
});
|
|
106
102
|
this.internalMiddleware = [];
|
|
107
|
-
if (manifest.experimentalQueuedRendering.enabled) {
|
|
108
|
-
this.nodePool = this.createNodePool(
|
|
109
|
-
manifest.experimentalQueuedRendering.poolSize ?? 1e3,
|
|
110
|
-
false
|
|
111
|
-
);
|
|
112
|
-
if (manifest.experimentalQueuedRendering.contentCache) {
|
|
113
|
-
this.htmlStringCache = this.createStringCache();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
103
|
}
|
|
117
104
|
/**
|
|
118
105
|
* Low-level route matching against the manifest routes. Returns the
|
|
@@ -175,7 +162,7 @@ class Pipeline {
|
|
|
175
162
|
}
|
|
176
163
|
/**
|
|
177
164
|
* Resolves the logger destination from the manifest and updates the pipeline logger.
|
|
178
|
-
* If the user configured `
|
|
165
|
+
* If the user configured `logger`, the bundled logger factory is loaded
|
|
179
166
|
* and replaces the default console destination. This is lazy and only resolves once.
|
|
180
167
|
*/
|
|
181
168
|
async getLogger() {
|
|
@@ -183,8 +170,8 @@ class Pipeline {
|
|
|
183
170
|
return this.logger;
|
|
184
171
|
}
|
|
185
172
|
this.resolvedLogger = true;
|
|
186
|
-
if (this.manifest.
|
|
187
|
-
this.logger = await loadLogger(this.manifest.
|
|
173
|
+
if (this.manifest.loggerConfig) {
|
|
174
|
+
this.logger = await loadLogger(this.manifest.loggerConfig);
|
|
188
175
|
}
|
|
189
176
|
return this.logger;
|
|
190
177
|
}
|
|
@@ -288,12 +275,6 @@ class Pipeline {
|
|
|
288
275
|
);
|
|
289
276
|
}
|
|
290
277
|
}
|
|
291
|
-
createNodePool(poolSize, stats) {
|
|
292
|
-
return new NodePool(poolSize, stats);
|
|
293
|
-
}
|
|
294
|
-
createStringCache() {
|
|
295
|
-
return new HTMLStringCache(1e3);
|
|
296
|
-
}
|
|
297
278
|
}
|
|
298
279
|
export {
|
|
299
280
|
ALL_PIPELINE_FEATURES,
|
package/dist/core/build/app.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { BuildPipeline } from './pipeline.js';
|
|
|
5
5
|
import type { StaticBuildOptions } from './types.js';
|
|
6
6
|
import type { LogRequestPayload } from '../app/base.js';
|
|
7
7
|
import type { ErrorHandler } from '../errors/handler.js';
|
|
8
|
-
import type { PoolStatsReport } from '../../runtime/server/render/queue/pool.js';
|
|
9
8
|
export declare class BuildApp extends BaseApp<BuildPipeline> {
|
|
10
9
|
createPipeline(_streaming: boolean, manifest: SSRManifest, ..._args: any[]): BuildPipeline;
|
|
11
10
|
isDev(): boolean;
|
|
@@ -14,6 +13,5 @@ export declare class BuildApp extends BaseApp<BuildPipeline> {
|
|
|
14
13
|
getOptions(): StaticBuildOptions;
|
|
15
14
|
getSettings(): import("../../types/astro.js").AstroSettings;
|
|
16
15
|
protected createErrorHandler(): ErrorHandler;
|
|
17
|
-
getQueueStats(): PoolStatsReport | undefined;
|
|
18
16
|
logRequest(_options: LogRequestPayload): void;
|
|
19
17
|
}
|
package/dist/core/build/app.js
CHANGED
|
@@ -167,20 +167,6 @@ ${colors.bgGreen(colors.black(` ${verb} static routes `))}`);
|
|
|
167
167
|
colors.green(`\u2713 Completed in ${getTimeStat(generatePagesTimer, performance.now())}.
|
|
168
168
|
`)
|
|
169
169
|
);
|
|
170
|
-
if (options.settings.logLevel === "debug" && options.settings.config.experimental?.queuedRendering && prerenderer.app) {
|
|
171
|
-
try {
|
|
172
|
-
const stats = prerenderer.app.getQueueStats();
|
|
173
|
-
if (stats && (stats.acquireFromPool > 0 || stats.acquireNew > 0)) {
|
|
174
|
-
logger.info(
|
|
175
|
-
null,
|
|
176
|
-
colors.dim(
|
|
177
|
-
`[Queue Pool] ${stats.acquireFromPool.toLocaleString()} reused / ${stats.acquireNew.toLocaleString()} new nodes | Hit rate: ${stats.hitRate.toFixed(1)}% | Pool: ${stats.poolSize}/${stats.maxSize}`
|
|
178
|
-
)
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
} catch {
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
170
|
if (staticImageList.size) {
|
|
185
171
|
logger.info("SKIP_FORMAT", `${colors.bgGreen(colors.black(` generating optimized images `))}`);
|
|
186
172
|
const totalCount = Array.from(staticImageList.values()).map((x) => x.transforms.size).reduce((a, b) => a + b, 0);
|
|
@@ -9,9 +9,6 @@ import { createDefaultRoutes } from "../routing/default.js";
|
|
|
9
9
|
import { getFallbackRoute, routeIsFallback, routeIsRedirect } from "../routing/helpers.js";
|
|
10
10
|
import { findRouteToRewrite } from "../routing/rewrite.js";
|
|
11
11
|
import { cssOrder, mergeInlineCss, getPageData } from "./runtime.js";
|
|
12
|
-
import { newNodePool } from "../../runtime/server/render/queue/pool.js";
|
|
13
|
-
import { HTMLStringCache } from "../../runtime/server/html-string-cache.js";
|
|
14
|
-
import { queueRenderingEnabled } from "../app/manifest.js";
|
|
15
12
|
class BuildPipeline extends Pipeline {
|
|
16
13
|
internals;
|
|
17
14
|
options;
|
|
@@ -65,12 +62,6 @@ class BuildPipeline extends Pipeline {
|
|
|
65
62
|
super(logger, manifest, "production", manifest.renderers, resolve, manifest.serverLike);
|
|
66
63
|
this.manifest = manifest;
|
|
67
64
|
this.defaultRoutes = defaultRoutes;
|
|
68
|
-
if (queueRenderingEnabled(this.manifest.experimentalQueuedRendering)) {
|
|
69
|
-
this.nodePool = newNodePool(this.manifest.experimentalQueuedRendering);
|
|
70
|
-
if (this.manifest.experimentalQueuedRendering.contentCache) {
|
|
71
|
-
this.htmlStringCache = new HTMLStringCache(1e3);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
65
|
}
|
|
75
66
|
getRoutes() {
|
|
76
67
|
return this.getOptions().routesList.routes;
|
|
@@ -221,9 +221,9 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
const middlewareMode = resolveMiddlewareMode(opts.settings.adapter?.adapterFeatures);
|
|
224
|
-
let
|
|
225
|
-
if (settings.config.
|
|
226
|
-
|
|
224
|
+
let loggerConfig = void 0;
|
|
225
|
+
if (settings.config.logger) {
|
|
226
|
+
loggerConfig = settings.config.logger;
|
|
227
227
|
}
|
|
228
228
|
return {
|
|
229
229
|
rootDir: opts.settings.config.root.toString(),
|
|
@@ -244,11 +244,6 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
244
244
|
trailingSlash: settings.config.trailingSlash,
|
|
245
245
|
compressHTML: settings.config.compressHTML,
|
|
246
246
|
assetsPrefix: settings.config.build.assetsPrefix,
|
|
247
|
-
experimentalQueuedRendering: {
|
|
248
|
-
enabled: settings.config.experimental.queuedRendering?.enabled ?? false,
|
|
249
|
-
poolSize: 0,
|
|
250
|
-
contentCache: false
|
|
251
|
-
},
|
|
252
247
|
componentMetadata: Array.from(internals.componentMetadata),
|
|
253
248
|
renderers: [],
|
|
254
249
|
clientDirectives: Array.from(settings.clientDirectives),
|
|
@@ -282,7 +277,7 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
282
277
|
internalFetchHeaders,
|
|
283
278
|
logLevel: settings.logLevel,
|
|
284
279
|
shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp),
|
|
285
|
-
|
|
280
|
+
loggerConfig
|
|
286
281
|
};
|
|
287
282
|
}
|
|
288
283
|
export {
|
|
@@ -67,13 +67,14 @@ async function loadConfig(root, configFile, fsMod = fs) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function splitInlineConfig(inlineConfig) {
|
|
70
|
-
const { configFile, mode, logLevel, ...inlineUserConfig } = inlineConfig;
|
|
70
|
+
const { configFile, mode, logLevel, _logger, ...inlineUserConfig } = inlineConfig;
|
|
71
71
|
return {
|
|
72
72
|
inlineUserConfig,
|
|
73
73
|
inlineOnlyConfig: {
|
|
74
74
|
configFile,
|
|
75
75
|
mode,
|
|
76
|
-
logLevel
|
|
76
|
+
logLevel,
|
|
77
|
+
_logger
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
80
|
}
|
|
@@ -75,17 +75,11 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
75
75
|
validateSecrets: false;
|
|
76
76
|
};
|
|
77
77
|
prerenderConflictBehavior: "warn";
|
|
78
|
+
fetchFile: string;
|
|
78
79
|
experimental: {
|
|
79
|
-
advancedRouting: false;
|
|
80
80
|
clientPrerender: false;
|
|
81
81
|
contentIntellisense: false;
|
|
82
82
|
chromeDevtoolsWorkspace: false;
|
|
83
|
-
queuedRendering: {
|
|
84
|
-
enabled: false;
|
|
85
|
-
};
|
|
86
|
-
logger: {
|
|
87
|
-
entrypoint: string;
|
|
88
|
-
};
|
|
89
83
|
};
|
|
90
84
|
};
|
|
91
85
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
@@ -462,6 +456,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
462
456
|
ignore: "ignore";
|
|
463
457
|
warn: "warn";
|
|
464
458
|
}>>>;
|
|
459
|
+
fetchFile: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
460
|
+
logger: z.ZodOptional<z.ZodObject<{
|
|
461
|
+
entrypoint: z.ZodString;
|
|
462
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
463
|
+
}, z.core.$strip>>;
|
|
465
464
|
fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
466
465
|
name: z.ZodString;
|
|
467
466
|
cssVariable: z.ZodString;
|
|
@@ -506,9 +505,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
506
505
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
507
506
|
}, z.core.$strict>>>;
|
|
508
507
|
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>]>>>;
|
|
512
508
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
513
509
|
contentIntellisense: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
514
510
|
chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -528,15 +524,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
528
524
|
swr: z.ZodOptional<z.ZodNumber>;
|
|
529
525
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
530
526
|
}, z.core.$strip>>>;
|
|
531
|
-
queuedRendering: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
|
|
532
|
-
enabled: z.ZodPrefault<z.ZodOptional<z.ZodBoolean>>;
|
|
533
|
-
poolSize: z.ZodOptional<z.ZodNumber>;
|
|
534
|
-
contentCache: z.ZodOptional<z.ZodBoolean>;
|
|
535
|
-
}, z.core.$strip>>>;
|
|
536
|
-
logger: z.ZodOptional<z.ZodObject<{
|
|
537
|
-
entrypoint: z.ZodString;
|
|
538
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
539
|
-
}, z.core.$strip>>;
|
|
540
527
|
}, z.core.$strict>>;
|
|
541
528
|
legacy: z.ZodPrefault<z.ZodObject<{
|
|
542
529
|
collectionsBackwardsCompat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|