astro 2.7.4 → 2.8.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/@types/astro.d.ts +47 -13
- package/dist/{core → cli}/add/index.d.ts +5 -4
- package/dist/{core → cli}/add/index.js +11 -10
- package/dist/cli/docs/index.d.ts +6 -0
- package/dist/cli/docs/index.js +18 -0
- package/dist/cli/index.js +29 -30
- package/dist/cli/info/index.d.ts +7 -0
- package/dist/cli/info/index.js +45 -0
- package/dist/cli/{telemetry.d.ts → telemetry/index.d.ts} +2 -1
- package/dist/cli/{telemetry.js → telemetry/index.js} +2 -2
- package/dist/config/index.js +1 -4
- package/dist/content/vite-plugin-content-virtual-mod.js +2 -2
- package/dist/core/app/index.js +4 -8
- package/dist/core/app/types.d.ts +2 -2
- package/dist/core/build/generate.d.ts +9 -1
- package/dist/core/build/generate.js +45 -46
- package/dist/core/build/index.d.ts +1 -1
- package/dist/core/build/index.js +19 -1
- package/dist/core/build/internal.d.ts +1 -0
- package/dist/core/build/plugins/index.js +1 -1
- package/dist/core/build/plugins/plugin-middleware.d.ts +3 -2
- package/dist/core/build/plugins/plugin-middleware.js +22 -3
- package/dist/core/build/plugins/plugin-pages.js +6 -4
- package/dist/core/build/plugins/plugin-ssr.js +4 -2
- package/dist/core/build/static-build.js +0 -3
- package/dist/core/config/config.d.ts +0 -2
- package/dist/core/config/schema.d.ts +12 -0
- package/dist/core/config/schema.js +6 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.js +0 -1
- package/dist/core/endpoint/dev/index.d.ts +1 -2
- package/dist/core/endpoint/dev/index.js +2 -3
- package/dist/core/endpoint/index.d.ts +9 -4
- package/dist/core/endpoint/index.js +3 -3
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/index.d.ts +31 -2
- package/dist/core/middleware/index.js +47 -1
- package/dist/core/render/context.d.ts +2 -6
- package/dist/core/render/context.js +2 -6
- package/dist/core/render/core.d.ts +1 -2
- package/dist/core/render/core.js +2 -11
- package/dist/core/render/dev/environment.js +1 -0
- package/dist/core/render/dev/index.d.ts +0 -2
- package/dist/core/render/dev/index.js +0 -1
- package/dist/core/render/environment.d.ts +1 -0
- package/dist/core/render/result.d.ts +2 -4
- package/dist/core/render/result.js +10 -11
- package/dist/integrations/index.d.ts +8 -4
- package/dist/integrations/index.js +8 -8
- package/dist/runtime/server/hydration.d.ts +1 -1
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/astro/instance.js +2 -2
- package/dist/runtime/server/render/component.js +1 -1
- package/dist/runtime/server/render/head.d.ts +3 -9
- package/dist/runtime/server/render/head.js +6 -9
- package/dist/runtime/server/render/page.d.ts +1 -1
- package/dist/runtime/server/render/page.js +9 -9
- package/dist/runtime/server/render/types.d.ts +0 -5
- package/dist/runtime/server/scripts.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +1 -2
- package/package.json +2 -1
- /package/dist/{core → cli}/add/babel.d.ts +0 -0
- /package/dist/{core → cli}/add/babel.js +0 -0
- /package/dist/{core → cli}/add/imports.d.ts +0 -0
- /package/dist/{core → cli}/add/imports.js +0 -0
- /package/dist/{core → cli}/add/wrapper.d.ts +0 -0
- /package/dist/{core → cli}/add/wrapper.js +0 -0
- /package/dist/cli/{open.d.ts → docs/open.d.ts} +0 -0
- /package/dist/cli/{open.js → docs/open.js} +0 -0
package/dist/@types/astro.d.ts
CHANGED
|
@@ -784,6 +784,26 @@ export interface AstroUserConfig {
|
|
|
784
784
|
* ```
|
|
785
785
|
*/
|
|
786
786
|
split?: boolean;
|
|
787
|
+
/**
|
|
788
|
+
* @docs
|
|
789
|
+
* @name build.excludeMiddleware
|
|
790
|
+
* @type {boolean}
|
|
791
|
+
* @default {false}
|
|
792
|
+
* @version 2.8.0
|
|
793
|
+
* @description
|
|
794
|
+
* Defines whether or not any SSR middleware code will be bundled when built.
|
|
795
|
+
*
|
|
796
|
+
* When enabled, middleware code is not bundled and imported by all pages during the build. To instead execute and import middleware code manually, set `build.excludeMiddleware: true`:
|
|
797
|
+
*
|
|
798
|
+
* ```js
|
|
799
|
+
* {
|
|
800
|
+
* build: {
|
|
801
|
+
* excludeMiddleware: true
|
|
802
|
+
* }
|
|
803
|
+
* }
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
excludeMiddleware?: boolean;
|
|
787
807
|
};
|
|
788
808
|
/**
|
|
789
809
|
* @docs
|
|
@@ -1665,6 +1685,10 @@ export interface AstroIntegration {
|
|
|
1665
1685
|
* the physical file you should import.
|
|
1666
1686
|
*/
|
|
1667
1687
|
entryPoints: Map<RouteData, URL>;
|
|
1688
|
+
/**
|
|
1689
|
+
* File path of the emitted middleware
|
|
1690
|
+
*/
|
|
1691
|
+
middlewareEntryPoint: URL | undefined;
|
|
1668
1692
|
}) => void | Promise<void>;
|
|
1669
1693
|
'astro:build:start'?: () => void | Promise<void>;
|
|
1670
1694
|
'astro:build:setup'?: (options: {
|
|
@@ -1737,15 +1761,6 @@ export interface SSRElement {
|
|
|
1737
1761
|
props: Record<string, any>;
|
|
1738
1762
|
children: string;
|
|
1739
1763
|
}
|
|
1740
|
-
export interface SSRMetadata {
|
|
1741
|
-
renderers: SSRLoadedRenderer[];
|
|
1742
|
-
pathname: string;
|
|
1743
|
-
hasHydrationScript: boolean;
|
|
1744
|
-
hasDirectives: Set<string>;
|
|
1745
|
-
hasRenderedHead: boolean;
|
|
1746
|
-
headInTree: boolean;
|
|
1747
|
-
clientDirectives: Map<string, string>;
|
|
1748
|
-
}
|
|
1749
1764
|
/**
|
|
1750
1765
|
* A hint on whether the Astro runtime needs to wait on a component to render head
|
|
1751
1766
|
* content. The meanings:
|
|
@@ -1766,15 +1781,34 @@ export interface SSRResult {
|
|
|
1766
1781
|
scripts: Set<SSRElement>;
|
|
1767
1782
|
links: Set<SSRElement>;
|
|
1768
1783
|
componentMetadata: Map<string, SSRComponentMetadata>;
|
|
1769
|
-
propagators: Map<AstroComponentFactory, AstroComponentInstance>;
|
|
1770
|
-
extraHead: Array<string>;
|
|
1771
|
-
cookies: AstroCookies | undefined;
|
|
1772
1784
|
createAstro(Astro: AstroGlobalPartial, props: Record<string, any>, slots: Record<string, any> | null): AstroGlobal;
|
|
1773
1785
|
resolve: (s: string) => Promise<string>;
|
|
1774
1786
|
response: ResponseInit;
|
|
1775
|
-
|
|
1787
|
+
renderers: SSRLoadedRenderer[];
|
|
1788
|
+
/**
|
|
1789
|
+
* Map of directive name (e.g. `load`) to the directive script code
|
|
1790
|
+
*/
|
|
1791
|
+
clientDirectives: Map<string, string>;
|
|
1792
|
+
compressHTML: boolean;
|
|
1793
|
+
/**
|
|
1794
|
+
* Only used for logging
|
|
1795
|
+
*/
|
|
1796
|
+
pathname: string;
|
|
1797
|
+
cookies: AstroCookies | undefined;
|
|
1776
1798
|
_metadata: SSRMetadata;
|
|
1777
1799
|
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Ephemeral and mutable state during rendering that doesn't rely
|
|
1802
|
+
* on external configuration
|
|
1803
|
+
*/
|
|
1804
|
+
export interface SSRMetadata {
|
|
1805
|
+
hasHydrationScript: boolean;
|
|
1806
|
+
hasDirectives: Set<string>;
|
|
1807
|
+
hasRenderedHead: boolean;
|
|
1808
|
+
headInTree: boolean;
|
|
1809
|
+
extraHead: string[];
|
|
1810
|
+
propagators: Map<AstroComponentFactory, AstroComponentInstance>;
|
|
1811
|
+
}
|
|
1778
1812
|
export interface PreviewServer {
|
|
1779
1813
|
host?: string;
|
|
1780
1814
|
port: number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type yargs from 'yargs-parser';
|
|
2
|
-
import { type LogOptions } from '
|
|
3
|
-
|
|
2
|
+
import { type LogOptions } from '../../core/logger/core.js';
|
|
3
|
+
interface AddOptions {
|
|
4
4
|
logging: LogOptions;
|
|
5
5
|
flags: yargs.Arguments;
|
|
6
6
|
cwd?: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface IntegrationInfo {
|
|
9
9
|
id: string;
|
|
10
10
|
packageName: string;
|
|
11
11
|
dependencies: [name: string, version: string][];
|
|
12
12
|
type: 'integration' | 'adapter';
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export declare function add(names: string[], { cwd, flags, logging }: AddOptions): Promise<void>;
|
|
15
15
|
export declare function validateIntegrations(integrations: string[]): Promise<IntegrationInfo[]>;
|
|
16
|
+
export {};
|
|
@@ -8,18 +8,18 @@ import path from "path";
|
|
|
8
8
|
import preferredPM from "preferred-pm";
|
|
9
9
|
import prompts from "prompts";
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
11
|
-
import { loadTSConfig, resolveConfigPath } from "
|
|
11
|
+
import { loadTSConfig, resolveConfigPath } from "../../core/config/index.js";
|
|
12
12
|
import {
|
|
13
13
|
defaultTSConfig,
|
|
14
14
|
presets,
|
|
15
15
|
updateTSConfigForFramework
|
|
16
|
-
} from "
|
|
17
|
-
import { debug, info } from "
|
|
18
|
-
import * as msg from "
|
|
19
|
-
import { printHelp } from "
|
|
20
|
-
import { appendForwardSlash } from "
|
|
21
|
-
import { apply as applyPolyfill } from "
|
|
22
|
-
import { parseNpmName } from "
|
|
16
|
+
} from "../../core/config/tsconfig.js";
|
|
17
|
+
import { debug, info } from "../../core/logger/core.js";
|
|
18
|
+
import * as msg from "../../core/messages.js";
|
|
19
|
+
import { printHelp } from "../../core/messages.js";
|
|
20
|
+
import { appendForwardSlash } from "../../core/path.js";
|
|
21
|
+
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
22
|
+
import { parseNpmName } from "../../core/util.js";
|
|
23
23
|
import { generate, parse, t, visit } from "./babel.js";
|
|
24
24
|
import { ensureImport } from "./imports.js";
|
|
25
25
|
import { wrapDefaultExport } from "./wrapper.js";
|
|
@@ -637,7 +637,8 @@ async function validateIntegrations(integrations) {
|
|
|
637
637
|
const meta = pkgJson["peerDependenciesMeta"] || {};
|
|
638
638
|
for (const peer in pkgJson["peerDependencies"]) {
|
|
639
639
|
const optional = ((_a = meta[peer]) == null ? void 0 : _a.optional) || false;
|
|
640
|
-
|
|
640
|
+
const isAstro = peer === "astro";
|
|
641
|
+
if (!optional && !isAstro) {
|
|
641
642
|
dependencies.push([peer, pkgJson["peerDependencies"][peer]]);
|
|
642
643
|
}
|
|
643
644
|
}
|
|
@@ -824,6 +825,6 @@ async function setupIntegrationConfig(opts) {
|
|
|
824
825
|
}
|
|
825
826
|
}
|
|
826
827
|
export {
|
|
827
|
-
add
|
|
828
|
+
add,
|
|
828
829
|
validateIntegrations
|
|
829
830
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { printHelp } from "../../core/messages.js";
|
|
2
|
+
import { openInBrowser } from "./open.js";
|
|
3
|
+
async function docs({ flags }) {
|
|
4
|
+
if (flags.help || flags.h) {
|
|
5
|
+
printHelp({
|
|
6
|
+
commandName: "astro docs",
|
|
7
|
+
tables: {
|
|
8
|
+
Flags: [["--help (-h)", "See all available flags."]]
|
|
9
|
+
},
|
|
10
|
+
description: `Launches the Astro Docs website directly from the terminal.`
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
return await openInBrowser("https://docs.astro.build/");
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
docs
|
|
18
|
+
};
|
package/dist/cli/index.js
CHANGED
|
@@ -16,7 +16,6 @@ import { enableVerboseLogging, nodeLogDestination } from "../core/logger/node.js
|
|
|
16
16
|
import { formatConfigErrorMessage, formatErrorMessage, printHelp } from "../core/messages.js";
|
|
17
17
|
import * as event from "../events/index.js";
|
|
18
18
|
import { eventConfigError, eventError, telemetry } from "../events/index.js";
|
|
19
|
-
import { openInBrowser } from "./open.js";
|
|
20
19
|
function printAstroHelp() {
|
|
21
20
|
printHelp({
|
|
22
21
|
commandName: "astro",
|
|
@@ -29,6 +28,7 @@ function printAstroHelp() {
|
|
|
29
28
|
["check", "Check your project for errors."],
|
|
30
29
|
["dev", "Start the development server."],
|
|
31
30
|
["docs", "Open documentation in your web browser."],
|
|
31
|
+
["info", "List info about your current Astro setup."],
|
|
32
32
|
["preview", "Preview your build locally."],
|
|
33
33
|
["sync", "Generate content collection types."],
|
|
34
34
|
["telemetry", "Configure telemetry settings."]
|
|
@@ -46,7 +46,7 @@ function printAstroHelp() {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
function printVersion() {
|
|
50
50
|
console.log();
|
|
51
51
|
console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${ASTRO_VERSION}`)}`);
|
|
52
52
|
}
|
|
@@ -62,7 +62,8 @@ function resolveCommand(flags) {
|
|
|
62
62
|
"build",
|
|
63
63
|
"preview",
|
|
64
64
|
"check",
|
|
65
|
-
"docs"
|
|
65
|
+
"docs",
|
|
66
|
+
"info"
|
|
66
67
|
]);
|
|
67
68
|
if (supportedCommands.has(cmd)) {
|
|
68
69
|
return cmd;
|
|
@@ -89,12 +90,29 @@ async function runCommand(cmd, flags) {
|
|
|
89
90
|
switch (cmd) {
|
|
90
91
|
case "help":
|
|
91
92
|
printAstroHelp();
|
|
92
|
-
return
|
|
93
|
+
return;
|
|
93
94
|
case "version":
|
|
94
|
-
|
|
95
|
-
return
|
|
95
|
+
printVersion();
|
|
96
|
+
return;
|
|
97
|
+
case "info": {
|
|
98
|
+
const { printInfo } = await import("./info/index.js");
|
|
99
|
+
await printInfo({ cwd: root, flags });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
case "docs": {
|
|
103
|
+
telemetry.record(event.eventCliSession(cmd));
|
|
104
|
+
const { docs } = await import("./docs/index.js");
|
|
105
|
+
await docs({ flags });
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
case "telemetry": {
|
|
109
|
+
const { update } = await import("./telemetry/index.js");
|
|
110
|
+
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
111
|
+
await update(subcommand, { flags });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
96
114
|
}
|
|
97
|
-
|
|
115
|
+
const logging = {
|
|
98
116
|
dest: nodeLogDestination,
|
|
99
117
|
level: "info"
|
|
100
118
|
};
|
|
@@ -106,29 +124,11 @@ async function runCommand(cmd, flags) {
|
|
|
106
124
|
}
|
|
107
125
|
switch (cmd) {
|
|
108
126
|
case "add": {
|
|
109
|
-
const { default: add } = await import("../core/add/index.js");
|
|
110
127
|
telemetry.record(event.eventCliSession(cmd));
|
|
128
|
+
const { add } = await import("./add/index.js");
|
|
111
129
|
const packages = flags._.slice(3);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
case "docs": {
|
|
115
|
-
telemetry.record(event.eventCliSession(cmd));
|
|
116
|
-
if (flags.help || flags.h) {
|
|
117
|
-
printHelp({
|
|
118
|
-
commandName: "astro docs",
|
|
119
|
-
tables: {
|
|
120
|
-
Flags: [["--help (-h)", "See all available flags."]]
|
|
121
|
-
},
|
|
122
|
-
description: `Launches the Astro Docs website directly from the terminal.`
|
|
123
|
-
});
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
return await openInBrowser("https://docs.astro.build/");
|
|
127
|
-
}
|
|
128
|
-
case "telemetry": {
|
|
129
|
-
const telemetryHandler = await import("./telemetry.js");
|
|
130
|
-
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
131
|
-
return await telemetryHandler.update(subcommand, { flags });
|
|
130
|
+
await add(packages, { cwd: root, flags, logging });
|
|
131
|
+
return;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (!process.env.NODE_ENV) {
|
|
@@ -137,8 +137,7 @@ async function runCommand(cmd, flags) {
|
|
|
137
137
|
let { astroConfig: initialAstroConfig, userConfig: initialUserConfig } = await openConfig({
|
|
138
138
|
cwd: root,
|
|
139
139
|
flags,
|
|
140
|
-
cmd
|
|
141
|
-
logging
|
|
140
|
+
cmd
|
|
142
141
|
}).catch(async (e) => {
|
|
143
142
|
await handleConfigError(e, { cmd, cwd: root, flags, logging });
|
|
144
143
|
return {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as colors from "kleur/colors";
|
|
2
|
+
import { arch, platform } from "node:os";
|
|
3
|
+
import whichPm from "which-pm";
|
|
4
|
+
import { openConfig } from "../../core/config/index.js";
|
|
5
|
+
import { ASTRO_VERSION } from "../../core/constants.js";
|
|
6
|
+
async function printInfo({ cwd, flags }) {
|
|
7
|
+
var _a;
|
|
8
|
+
const packageManager = await whichPm(process.cwd());
|
|
9
|
+
let adapter = "Couldn't determine.";
|
|
10
|
+
let integrations = [];
|
|
11
|
+
const MAX_PADDING = 25;
|
|
12
|
+
function printRow(label, value) {
|
|
13
|
+
const padding = MAX_PADDING - label.length;
|
|
14
|
+
console.log(`${colors.bold(label)}` + " ".repeat(padding) + `${colors.green(value)}`);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const { userConfig } = await openConfig({
|
|
18
|
+
cwd,
|
|
19
|
+
flags,
|
|
20
|
+
cmd: "info"
|
|
21
|
+
});
|
|
22
|
+
if ((_a = userConfig.adapter) == null ? void 0 : _a.name) {
|
|
23
|
+
adapter = userConfig.adapter.name;
|
|
24
|
+
}
|
|
25
|
+
if (userConfig.integrations) {
|
|
26
|
+
integrations = ((userConfig == null ? void 0 : userConfig.integrations) ?? []).filter(Boolean).flat().map((i) => i == null ? void 0 : i.name);
|
|
27
|
+
}
|
|
28
|
+
} catch (_e) {
|
|
29
|
+
}
|
|
30
|
+
console.log();
|
|
31
|
+
const packageManagerName = (packageManager == null ? void 0 : packageManager.name) ?? "Couldn't determine.";
|
|
32
|
+
printRow("Astro version", `v${ASTRO_VERSION}`);
|
|
33
|
+
printRow("Package manager", packageManagerName);
|
|
34
|
+
printRow("Platform", platform());
|
|
35
|
+
printRow("Architecture", arch());
|
|
36
|
+
printRow("Adapter", adapter);
|
|
37
|
+
let integrationsString = "None or couldn't determine.";
|
|
38
|
+
if (integrations.length > 0) {
|
|
39
|
+
integrationsString = integrations.join(", ");
|
|
40
|
+
}
|
|
41
|
+
printRow("Integrations", integrationsString);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
printInfo
|
|
45
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as msg from "
|
|
2
|
-
import { telemetry } from "
|
|
1
|
+
import * as msg from "../../core/messages.js";
|
|
2
|
+
import { telemetry } from "../../events/index.js";
|
|
3
3
|
async function update(subcommand, { flags }) {
|
|
4
4
|
const isValid = ["enable", "disable", "reset"].includes(subcommand);
|
|
5
5
|
if (flags.help || flags.h || !isValid) {
|
package/dist/config/index.js
CHANGED
|
@@ -25,10 +25,7 @@ function getViteConfig(inlineConfig) {
|
|
|
25
25
|
dest: nodeLogDestination,
|
|
26
26
|
level: "info"
|
|
27
27
|
};
|
|
28
|
-
const { astroConfig: config } = await openConfig({
|
|
29
|
-
cmd,
|
|
30
|
-
logging
|
|
31
|
-
});
|
|
28
|
+
const { astroConfig: config } = await openConfig({ cmd });
|
|
32
29
|
const settings = createSettings(config, inlineConfig.root);
|
|
33
30
|
await runHookConfigSetup({ settings, command: cmd, logging });
|
|
34
31
|
const viteConfig = await createVite(
|
|
@@ -168,8 +168,8 @@ function globWithUnderscoresIgnored(relContentDir, exts) {
|
|
|
168
168
|
const contentDir = appendForwardSlash(relContentDir);
|
|
169
169
|
return [
|
|
170
170
|
`${contentDir}**/*${extGlob}`,
|
|
171
|
-
`!${contentDir}_*/**${extGlob}`,
|
|
172
|
-
`!${contentDir}_*${extGlob}`
|
|
171
|
+
`!${contentDir}**/_*/**${extGlob}`,
|
|
172
|
+
`!${contentDir}**/_*${extGlob}`
|
|
173
173
|
];
|
|
174
174
|
}
|
|
175
175
|
export {
|
package/dist/core/app/index.js
CHANGED
|
@@ -44,6 +44,7 @@ class App {
|
|
|
44
44
|
logging: this.#logging,
|
|
45
45
|
markdown: manifest.markdown,
|
|
46
46
|
mode: "production",
|
|
47
|
+
compressHTML: manifest.compressHTML,
|
|
47
48
|
renderers: manifest.renderers,
|
|
48
49
|
clientDirectives: manifest.clientDirectives,
|
|
49
50
|
async resolve(specifier) {
|
|
@@ -170,7 +171,6 @@ class App {
|
|
|
170
171
|
const url = new URL(request.url);
|
|
171
172
|
const pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
172
173
|
const info = this.#routeDataToRouteInfo.get(routeData);
|
|
173
|
-
const isCompressHTML = this.#manifest.compressHTML ?? false;
|
|
174
174
|
const links = /* @__PURE__ */ new Set();
|
|
175
175
|
const styles = createStylesheetElementSet(info.styles);
|
|
176
176
|
let scripts = /* @__PURE__ */ new Set();
|
|
@@ -190,7 +190,6 @@ class App {
|
|
|
190
190
|
const mod = await page.page();
|
|
191
191
|
const renderContext = await createRenderContext({
|
|
192
192
|
request,
|
|
193
|
-
origin: url.origin,
|
|
194
193
|
pathname,
|
|
195
194
|
componentMetadata: this.#manifest.componentMetadata,
|
|
196
195
|
scripts,
|
|
@@ -219,8 +218,7 @@ class App {
|
|
|
219
218
|
mod,
|
|
220
219
|
renderContext,
|
|
221
220
|
env: this.#env,
|
|
222
|
-
cookies: apiContext.cookies
|
|
223
|
-
isCompressHTML
|
|
221
|
+
cookies: apiContext.cookies
|
|
224
222
|
});
|
|
225
223
|
}
|
|
226
224
|
);
|
|
@@ -229,8 +227,7 @@ class App {
|
|
|
229
227
|
mod,
|
|
230
228
|
renderContext,
|
|
231
229
|
env: this.#env,
|
|
232
|
-
cookies: apiContext.cookies
|
|
233
|
-
isCompressHTML
|
|
230
|
+
cookies: apiContext.cookies
|
|
234
231
|
});
|
|
235
232
|
}
|
|
236
233
|
Reflect.set(request, responseSentSymbol, true);
|
|
@@ -250,14 +247,13 @@ class App {
|
|
|
250
247
|
const handler = mod;
|
|
251
248
|
const ctx = await createRenderContext({
|
|
252
249
|
request,
|
|
253
|
-
origin: url.origin,
|
|
254
250
|
pathname,
|
|
255
251
|
route: routeData,
|
|
256
252
|
status,
|
|
257
253
|
env: this.#env,
|
|
258
254
|
mod: handler
|
|
259
255
|
});
|
|
260
|
-
const result = await callEndpoint(handler, this.#env, ctx,
|
|
256
|
+
const result = await callEndpoint(handler, this.#env, ctx, page.onRequest);
|
|
261
257
|
if (result.type === "response") {
|
|
262
258
|
if (result.response.headers.get("X-Astro-Response") === "Not-Found") {
|
|
263
259
|
const fourOhFourRequest = new Request(new URL("/404", request.url));
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export type SSRManifest = {
|
|
|
30
30
|
adapterName: string;
|
|
31
31
|
routes: RouteInfo[];
|
|
32
32
|
site?: string;
|
|
33
|
-
base
|
|
34
|
-
compressHTML
|
|
33
|
+
base: string;
|
|
34
|
+
compressHTML: boolean;
|
|
35
35
|
assetsPrefix?: string;
|
|
36
36
|
markdown: MarkdownRenderingOptions;
|
|
37
37
|
renderers: SSRLoadedRenderer[];
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { OutputAsset, OutputChunk } from 'rollup';
|
|
2
|
-
import type { AstroSettings } from '../../@types/astro';
|
|
2
|
+
import type { AstroSettings, SSRLoadedRenderer, SSRManifest } from '../../@types/astro';
|
|
3
3
|
import { type BuildInternals } from '../../core/build/internal.js';
|
|
4
4
|
import type { StaticBuildOptions } from './types';
|
|
5
5
|
export declare function rootRelativeFacadeId(facadeId: string, settings: AstroSettings): string;
|
|
6
6
|
export declare function chunkIsPage(settings: AstroSettings, output: OutputAsset | OutputChunk, internals: BuildInternals): boolean;
|
|
7
7
|
export declare function generatePages(opts: StaticBuildOptions, internals: BuildInternals): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* It creates a `SSRManifest` from the `AstroSettings`.
|
|
10
|
+
*
|
|
11
|
+
* Renderers needs to be pulled out from the page module emitted during the build.
|
|
12
|
+
* @param settings
|
|
13
|
+
* @param renderers
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateRuntimeManifest(settings: AstroSettings, internals: BuildInternals, renderers: SSRLoadedRenderer[]): SSRManifest;
|