astro 7.1.6 → 7.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/dist/assets/build/generate.d.ts +8 -1
- package/dist/assets/build/generate.js +21 -1
- package/dist/assets/fonts/providers/index.js +12 -2
- package/dist/assets/types.d.ts +13 -0
- package/dist/assets/vite-plugin-assets.js +8 -0
- package/dist/cli/add/index.js +1 -1
- package/dist/cli/agent.d.ts +1 -0
- package/dist/cli/agent.js +11 -0
- package/dist/cli/dev/background.d.ts +3 -16
- package/dist/cli/dev/background.js +7 -93
- package/dist/cli/dev/index.d.ts +12 -0
- package/dist/cli/dev/index.js +30 -23
- package/dist/cli/dev/logs.js +2 -64
- package/dist/cli/dev/status.d.ts +2 -9
- package/dist/cli/dev/status.js +6 -24
- package/dist/cli/dev/stop.d.ts +2 -6
- package/dist/cli/dev/stop.js +6 -14
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preview/index.js +77 -3
- package/dist/cli/server.d.ts +60 -0
- package/dist/cli/server.js +274 -0
- package/dist/content/content-layer.js +3 -3
- package/dist/content/runtime.d.ts +2 -0
- package/dist/content/runtime.js +2 -0
- package/dist/content/types-generator.js +1 -0
- package/dist/content/vite-plugin-content-assets.js +6 -1
- package/dist/content/vite-plugin-content-imports.js +12 -3
- package/dist/content/vite-plugin-content-virtual-mod.js +28 -16
- package/dist/core/app/entrypoints/index.d.ts +2 -0
- package/dist/core/app/entrypoints/index.js +14 -0
- package/dist/core/build/config-hash/index.d.ts +8 -0
- package/dist/core/build/config-hash/index.js +23 -0
- package/dist/core/build/config-hash/input.d.ts +199 -0
- package/dist/core/build/config-hash/input.js +43 -0
- package/dist/core/build/generate.d.ts +3 -1
- package/dist/core/build/generate.js +149 -14
- package/dist/core/build/incremental-content-collector.d.ts +10 -0
- package/dist/core/build/incremental-content-collector.js +33 -0
- package/dist/core/build/incremental-image-collector.d.ts +11 -0
- package/dist/core/build/incremental-image-collector.js +32 -0
- package/dist/core/build/incremental-metadata.d.ts +9 -0
- package/dist/core/build/incremental-metadata.js +17 -0
- package/dist/core/build/incremental.d.ts +123 -0
- package/dist/core/build/incremental.js +178 -0
- package/dist/core/build/index.d.ts +3 -0
- package/dist/core/build/index.js +6 -2
- package/dist/core/build/internal.d.ts +19 -0
- package/dist/core/build/lockfile/finder.d.ts +22 -0
- package/dist/core/build/lockfile/finder.js +45 -0
- package/dist/core/build/lockfile/hasher.d.ts +16 -0
- package/dist/core/build/lockfile/hasher.js +46 -0
- package/dist/core/build/lockfile/index.d.ts +9 -0
- package/dist/core/build/lockfile/index.js +16 -0
- package/dist/core/build/plugins/index.js +3 -1
- package/dist/core/build/plugins/plugin-incremental.d.ts +14 -0
- package/dist/core/build/plugins/plugin-incremental.js +134 -0
- package/dist/core/build/types.d.ts +2 -0
- package/dist/core/config/schemas/base.d.ts +3 -2
- package/dist/core/config/schemas/base.js +1 -0
- package/dist/core/config/schemas/defaults.d.ts +1 -0
- package/dist/core/config/schemas/defaults.js +1 -0
- package/dist/core/config/schemas/relative.d.ts +7 -4
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +2 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.d.ts +8 -7
- package/dist/core/dev/lockfile.js +13 -13
- package/dist/core/encryption.d.ts +6 -0
- package/dist/core/encryption.js +14 -2
- package/dist/core/errors/default-handler.js +4 -5
- package/dist/core/fetch/index.js +1 -1
- package/dist/core/logger/config.d.ts +1 -1
- package/dist/core/logger/load.d.ts +3 -1
- package/dist/core/logger/load.js +3 -3
- package/dist/core/logger/utils.d.ts +6 -4
- package/dist/core/logger/utils.js +13 -5
- package/dist/core/logger/vite-plugin.js +1 -1
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/preview/static-preview-server.d.ts +2 -0
- package/dist/core/preview/static-preview-server.js +1 -0
- package/dist/core/routing/handler.js +1 -1
- package/dist/core/session/config.d.ts +2 -2
- package/dist/core/session/config.js +2 -1
- package/dist/core/session/provider-disabled.d.ts +2 -0
- package/dist/core/session/provider-disabled.js +7 -0
- package/dist/core/session/provider.d.ts +1 -0
- package/dist/core/session/provider.js +4 -0
- package/dist/core/session/utils.js +3 -0
- package/dist/core/session/vite-plugin.d.ts +3 -0
- package/dist/core/session/vite-plugin.js +41 -6
- package/dist/integrations/hooks.js +3 -1
- package/dist/runtime/prerender/static-paths.js +5 -1
- package/dist/runtime/server/render/util.js +3 -0
- package/dist/types/public/common.d.ts +1 -0
- package/dist/types/public/config.d.ts +59 -2
- package/dist/types/public/integrations.d.ts +29 -2
- package/dist/types/public/preview.d.ts +2 -0
- package/dist/vite-plugin-config-alias/index.js +1 -0
- package/dist/vite-plugin-environment/index.js +4 -1
- package/package.json +1 -2
|
@@ -3,7 +3,7 @@ const SessionDriverConfigSchema = z.object({
|
|
|
3
3
|
config: z.record(z.string(), z.any()).optional(),
|
|
4
4
|
entrypoint: z.union([z.string(), z.instanceof(URL)])
|
|
5
5
|
});
|
|
6
|
-
const
|
|
6
|
+
const SessionObjectSchema = z.object({
|
|
7
7
|
driver: z.union([
|
|
8
8
|
z.string().superRefine(() => {
|
|
9
9
|
console.warn(
|
|
@@ -26,6 +26,7 @@ const SessionSchema = z.object({
|
|
|
26
26
|
]).optional(),
|
|
27
27
|
ttl: z.number().optional()
|
|
28
28
|
});
|
|
29
|
+
const SessionSchema = z.union([z.literal(false), SessionObjectSchema]);
|
|
29
30
|
export {
|
|
30
31
|
SessionDriverConfigSchema,
|
|
31
32
|
SessionSchema
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { provideSession } from './handler.js';
|
|
@@ -31,6 +31,9 @@ function normalizeSessionDriverConfig(driver, options) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function sessionConfigToManifest(config) {
|
|
34
|
+
if (config === false) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
34
37
|
const sessionDriver = config?.driver;
|
|
35
38
|
if (!config || !sessionDriver) {
|
|
36
39
|
return void 0;
|
|
@@ -4,3 +4,6 @@ export declare const VIRTUAL_SESSION_DRIVER_ID = "virtual:astro:session-driver";
|
|
|
4
4
|
export declare function vitePluginSessionDriver({ settings }: {
|
|
5
5
|
settings: AstroSettings;
|
|
6
6
|
}): VitePlugin;
|
|
7
|
+
export declare function vitePluginSessionProvider({ settings }: {
|
|
8
|
+
settings: AstroSettings;
|
|
9
|
+
}): VitePlugin;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
1
2
|
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { SessionStorageInitError } from "../errors/errors-data.js";
|
|
3
4
|
import { AstroError } from "../errors/index.js";
|
|
5
|
+
import { normalizePath } from "../viteUtils.js";
|
|
4
6
|
import { normalizeSessionDriverConfig } from "./utils.js";
|
|
5
7
|
const VIRTUAL_SESSION_DRIVER_ID = "virtual:astro:session-driver";
|
|
6
8
|
const RESOLVED_VIRTUAL_SESSION_DRIVER_ID = "\0" + VIRTUAL_SESSION_DRIVER_ID;
|
|
@@ -21,13 +23,11 @@ function vitePluginSessionDriver({ settings }) {
|
|
|
21
23
|
id: new RegExp(`^${RESOLVED_VIRTUAL_SESSION_DRIVER_ID}$`)
|
|
22
24
|
},
|
|
23
25
|
async handler() {
|
|
24
|
-
|
|
26
|
+
const session = settings.config.session;
|
|
27
|
+
if (session === false || !session?.driver) {
|
|
25
28
|
return { code: "export default null;" };
|
|
26
29
|
}
|
|
27
|
-
const driver = normalizeSessionDriverConfig(
|
|
28
|
-
settings.config.session.driver,
|
|
29
|
-
settings.config.session.options
|
|
30
|
-
);
|
|
30
|
+
const driver = normalizeSessionDriverConfig(session.driver, session.options);
|
|
31
31
|
const importerPath = fileURLToPath(import.meta.url);
|
|
32
32
|
const resolved = await this.resolve(driver.entrypoint, importerPath);
|
|
33
33
|
if (!resolved) {
|
|
@@ -48,7 +48,42 @@ export default _default;`
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
+
const PROVIDER_FILENAME = "provider.js";
|
|
52
|
+
const DISABLED_PROVIDER_FILENAME = "provider-disabled.js";
|
|
53
|
+
function canonicalizePath(filePath) {
|
|
54
|
+
try {
|
|
55
|
+
return normalizePath(realpathSync(filePath));
|
|
56
|
+
} catch {
|
|
57
|
+
return normalizePath(filePath);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function vitePluginSessionProvider({ settings }) {
|
|
61
|
+
const providerPath = canonicalizePath(
|
|
62
|
+
fileURLToPath(new URL(`./${PROVIDER_FILENAME}`, import.meta.url))
|
|
63
|
+
);
|
|
64
|
+
const disabledProviderPath = canonicalizePath(
|
|
65
|
+
fileURLToPath(new URL(`./${DISABLED_PROVIDER_FILENAME}`, import.meta.url))
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
name: "astro:session-provider",
|
|
69
|
+
enforce: "pre",
|
|
70
|
+
async resolveId(id, importer) {
|
|
71
|
+
const session = settings.config.session;
|
|
72
|
+
const hasSessionDriver = session !== false && !!session?.driver;
|
|
73
|
+
if (hasSessionDriver) return null;
|
|
74
|
+
if (!normalizePath(id).endsWith(`/session/${PROVIDER_FILENAME}`)) return null;
|
|
75
|
+
if (canonicalizePath(id) === providerPath) return disabledProviderPath;
|
|
76
|
+
if (!importer) return null;
|
|
77
|
+
const resolved = await this.resolve(id, importer, { skipSelf: true });
|
|
78
|
+
if (resolved && canonicalizePath(resolved.id) === providerPath) {
|
|
79
|
+
return disabledProviderPath;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
51
85
|
export {
|
|
52
86
|
VIRTUAL_SESSION_DRIVER_ID,
|
|
53
|
-
vitePluginSessionDriver
|
|
87
|
+
vitePluginSessionDriver,
|
|
88
|
+
vitePluginSessionProvider
|
|
54
89
|
};
|
|
@@ -260,7 +260,9 @@ async function runHookConfigSetup({
|
|
|
260
260
|
try {
|
|
261
261
|
updatedConfig = await validateConfigRefined(updatedConfig);
|
|
262
262
|
if (isLoggerUpdated) {
|
|
263
|
-
logger.setDestination(
|
|
263
|
+
logger.setDestination(
|
|
264
|
+
await loadLoggerDestination(updatedConfig.logger, updatedConfig.root)
|
|
265
|
+
);
|
|
264
266
|
}
|
|
265
267
|
} catch (error) {
|
|
266
268
|
integrationLogger.error("An error occurred while updating the config");
|
|
@@ -61,7 +61,11 @@ class StaticPaths {
|
|
|
61
61
|
});
|
|
62
62
|
for (const staticPath of staticPaths) {
|
|
63
63
|
const pathname = stringifyParams(staticPath.params, route, manifest.trailingSlash);
|
|
64
|
-
paths.push({
|
|
64
|
+
paths.push({
|
|
65
|
+
pathname,
|
|
66
|
+
route,
|
|
67
|
+
cacheKey: staticPath.cacheKey === void 0 ? void 0 : String(staticPath.cacheKey)
|
|
68
|
+
});
|
|
65
69
|
}
|
|
66
70
|
return paths;
|
|
67
71
|
}
|
|
@@ -35,6 +35,9 @@ function isCustomElement(tagName) {
|
|
|
35
35
|
return tagName.includes("-");
|
|
36
36
|
}
|
|
37
37
|
function handleBooleanAttribute(key, value, shouldEscape, tagName) {
|
|
38
|
+
if (key === "popover") {
|
|
39
|
+
return markHTMLString(value ? ` ${key}` : "");
|
|
40
|
+
}
|
|
38
41
|
if (tagName && isCustomElement(tagName)) {
|
|
39
42
|
return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
|
|
40
43
|
}
|
|
@@ -13,6 +13,7 @@ export interface GetStaticPathsOptions {
|
|
|
13
13
|
export type GetStaticPathsItem = {
|
|
14
14
|
params: Params;
|
|
15
15
|
props?: Props;
|
|
16
|
+
cacheKey?: string | number;
|
|
16
17
|
};
|
|
17
18
|
export type GetStaticPathsResult = GetStaticPathsItem[];
|
|
18
19
|
export type GetStaticPathsResultKeyed = GetStaticPathsResult & {
|
|
@@ -1171,6 +1171,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1171
1171
|
* Setting `build.format` controls what `Astro.url` is set to during the build. When it is:
|
|
1172
1172
|
* - `directory` - The `Astro.url.pathname` will include a trailing slash to mimic folder behavior. (e.g. `/foo/`)
|
|
1173
1173
|
* - `file` - The `Astro.url.pathname` will include `.html`. (e.g. `/foo.html`)
|
|
1174
|
+
* - `preserve` - The `Astro.url.pathname` matches the generated file for each page: index pages include a trailing slash (e.g. `/foo/`), while non-index pages include `.html` (e.g. `/foo.html`).
|
|
1174
1175
|
*
|
|
1175
1176
|
* This means that when you create relative URLs using `new URL('./relative', Astro.url)`, you will get consistent behavior between dev and build.
|
|
1176
1177
|
*
|
|
@@ -1535,7 +1536,8 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1535
1536
|
* @description
|
|
1536
1537
|
*
|
|
1537
1538
|
* The entrypoint for the [logger implementation](https://docs.astro.build/en/reference/logger-reference/#the-logger-implementation).
|
|
1538
|
-
* This can be an npm package, or a `URL` pointing to a
|
|
1539
|
+
* This can be an npm package, a path relative to your project root, or a `URL` pointing to a
|
|
1540
|
+
* file in your project:
|
|
1539
1541
|
*
|
|
1540
1542
|
* ```js title="astro.config.mjs"
|
|
1541
1543
|
* import { defineConfig } from 'astro/config';
|
|
@@ -1546,6 +1548,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1546
1548
|
* }
|
|
1547
1549
|
* });
|
|
1548
1550
|
* ```
|
|
1551
|
+
*
|
|
1552
|
+
* The logger entrypoint must be a JavaScript file. TypeScript is not supported. If Astro fails to load
|
|
1553
|
+
* the implementation, it falls back to its default logger.
|
|
1549
1554
|
*/
|
|
1550
1555
|
/**
|
|
1551
1556
|
* @docs
|
|
@@ -1573,6 +1578,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1573
1578
|
/**
|
|
1574
1579
|
* @docs
|
|
1575
1580
|
* @kind heading
|
|
1581
|
+
* @type {object | false}
|
|
1576
1582
|
* @version 5.7.0
|
|
1577
1583
|
* @name Session Options
|
|
1578
1584
|
* @description
|
|
@@ -1596,9 +1602,19 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
1596
1602
|
*
|
|
1597
1603
|
* Session drivers are configured at build time. This means environment variables used in the driver configuration are inlined. You must create your own driver entrypoint to [override the configuration at runtime](https://docs.astro.build/en/guides/sessions/#overriding-the-configuration-at-runtime).
|
|
1598
1604
|
*
|
|
1605
|
+
* Since Astro v7.2.0, you can opt out of session support by setting the option to `false`. When sessions are disabled, the session runtime is excluded from the SSR bundle, and adapters skip wiring their default session driver. This is useful for serverless and edge runtimes where bundle parse time is sensitive.
|
|
1606
|
+
*
|
|
1607
|
+
* ```js title="astro.config.mjs"
|
|
1608
|
+
* import { defineConfig } from 'astro/config';
|
|
1609
|
+
*
|
|
1610
|
+
* export default defineConfig({
|
|
1611
|
+
* session: false,
|
|
1612
|
+
* });
|
|
1613
|
+
* ```
|
|
1614
|
+
*
|
|
1599
1615
|
* See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information.
|
|
1600
1616
|
*/
|
|
1601
|
-
session?: SessionConfig<TDriver
|
|
1617
|
+
session?: SessionConfig<TDriver> | false;
|
|
1602
1618
|
/**
|
|
1603
1619
|
* @docs
|
|
1604
1620
|
* @name session.driver
|
|
@@ -3164,6 +3180,47 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
3164
3180
|
/** Maximum UTF-8 byte size of each data store chunk. */
|
|
3165
3181
|
chunkSize: number;
|
|
3166
3182
|
};
|
|
3183
|
+
/**
|
|
3184
|
+
* @name experimental.incrementalBuild
|
|
3185
|
+
* @type {boolean}
|
|
3186
|
+
* @default `false`
|
|
3187
|
+
* @version 7.2
|
|
3188
|
+
* @description
|
|
3189
|
+
*
|
|
3190
|
+
* Enables incremental static builds. When enabled, pages with a `cacheKey` returned
|
|
3191
|
+
* from `getStaticPaths()` can be skipped during subsequent builds if neither
|
|
3192
|
+
* their data nor their dependencies have changed.
|
|
3193
|
+
*
|
|
3194
|
+
* On the first build, all pages are rendered normally and a cache manifest is saved.
|
|
3195
|
+
* On subsequent builds, each page is checked against the manifest: if the page's
|
|
3196
|
+
* `cacheKey` and the hash of its module dependency graph both match, the page is
|
|
3197
|
+
* skipped and the previous output is preserved.
|
|
3198
|
+
*
|
|
3199
|
+
* ```js
|
|
3200
|
+
* // astro.config.mjs
|
|
3201
|
+
* {
|
|
3202
|
+
* experimental: {
|
|
3203
|
+
* incrementalBuild: true,
|
|
3204
|
+
* },
|
|
3205
|
+
* }
|
|
3206
|
+
* ```
|
|
3207
|
+
*
|
|
3208
|
+
* In your dynamic routes, return a `cacheKey` from `getStaticPaths()`:
|
|
3209
|
+
*
|
|
3210
|
+
* ```js
|
|
3211
|
+
* // src/pages/blog/[slug].astro
|
|
3212
|
+
* export async function getStaticPaths() {
|
|
3213
|
+
* const posts = await fetchPosts();
|
|
3214
|
+
* return posts.map(post => ({
|
|
3215
|
+
* params: { slug: post.slug },
|
|
3216
|
+
* props: { post },
|
|
3217
|
+
* cacheKey: post.digest,
|
|
3218
|
+
* }));
|
|
3219
|
+
* }
|
|
3220
|
+
* ```
|
|
3221
|
+
* See the [experimental incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) for more information.
|
|
3222
|
+
*/
|
|
3223
|
+
incrementalBuild?: boolean;
|
|
3167
3224
|
};
|
|
3168
3225
|
}
|
|
3169
3226
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AddressInfo } from 'node:net';
|
|
2
2
|
import type { ViteDevServer, InlineConfig } from 'vite';
|
|
3
3
|
import type { SerializedSSRManifest } from '../../core/app/types.js';
|
|
4
|
-
import type { AssetsGlobalStaticImagesList } from '../../assets/types.js';
|
|
4
|
+
import type { AssetsGlobalStaticImagesList, SerializedStaticImage } from '../../assets/types.js';
|
|
5
5
|
import type { PageBuildData } from '../../core/build/types.js';
|
|
6
6
|
import type { AstroIntegrationLogger } from '../../core/logger/core.js';
|
|
7
7
|
import type { AdapterFeatureStability } from '../../integrations/features-validation.js';
|
|
@@ -194,6 +194,28 @@ export type AstroAdapter = {
|
|
|
194
194
|
export interface PathWithRoute {
|
|
195
195
|
pathname: string;
|
|
196
196
|
route: RouteData;
|
|
197
|
+
cacheKey?: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Incremental-build data an out-of-process prerenderer collects while rendering
|
|
201
|
+
* a page, reported back to the build process so skipped pages can be tracked and
|
|
202
|
+
* replayed without a re-render.
|
|
203
|
+
*/
|
|
204
|
+
export interface PrerenderRenderMetadata {
|
|
205
|
+
/** Root-relative `filePath`s of the content entries the page rendered. */
|
|
206
|
+
contentEntryKeys?: string[];
|
|
207
|
+
/** Optimized-image transforms the page resolved. */
|
|
208
|
+
staticImages?: SerializedStaticImage[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The richer result a prerenderer's `render()` may return instead of a bare
|
|
212
|
+
* `Response`, pairing the rendered response with the incremental-build metadata
|
|
213
|
+
* collected for that page. Used by out-of-process prerenderers, which collect
|
|
214
|
+
* the metadata in their own runtime rather than in the build's collectors.
|
|
215
|
+
*/
|
|
216
|
+
export interface PrerenderResult {
|
|
217
|
+
response: Response;
|
|
218
|
+
metadata?: PrerenderRenderMetadata;
|
|
197
219
|
}
|
|
198
220
|
/**
|
|
199
221
|
* Custom prerenderer that adapters can provide to control how pages are prerendered.
|
|
@@ -217,10 +239,15 @@ export interface AstroPrerenderer {
|
|
|
217
239
|
* use the `pathname` from the `PathWithRoute` entry returned by `getStaticPaths`.
|
|
218
240
|
* @param options - Render options
|
|
219
241
|
* @param options.routeData - The matched route for this path
|
|
242
|
+
* @returns A `Response`, or a {@link PrerenderResult} pairing the response with
|
|
243
|
+
* the incremental-build metadata the page resolved. Out-of-process
|
|
244
|
+
* prerenderers return the latter to report metadata they collect in their own
|
|
245
|
+
* runtime; in-process prerenderers populate the build's collectors directly
|
|
246
|
+
* and return a bare `Response`.
|
|
220
247
|
*/
|
|
221
248
|
render: (request: Request, options: {
|
|
222
249
|
routeData: RouteData;
|
|
223
|
-
}) => Promise<Response>;
|
|
250
|
+
}) => Promise<Response | PrerenderResult>;
|
|
224
251
|
/**
|
|
225
252
|
* Returns images collected in the adapter's runtime (e.g. workerd) to be merged
|
|
226
253
|
* into the Node-side static image list. The default Sharp pipeline runs after.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
|
+
import type { ResolvedServerUrls } from 'vite';
|
|
2
3
|
import type { AstroIntegrationLogger } from '../../core/logger/core.js';
|
|
3
4
|
export interface PreviewServer {
|
|
4
5
|
host?: string;
|
|
5
6
|
port: number;
|
|
7
|
+
urls?: ResolvedServerUrls;
|
|
6
8
|
closed(): Promise<void>;
|
|
7
9
|
stop(): Promise<void>;
|
|
8
10
|
}
|
|
@@ -68,6 +68,7 @@ function configAliasVitePlugin({
|
|
|
68
68
|
let hasReplacement = false;
|
|
69
69
|
const replaceAliases = (match, importId) => {
|
|
70
70
|
if (!importId) return match;
|
|
71
|
+
if (importId.startsWith("data:")) return match;
|
|
71
72
|
const resolved = resolveWithAlias(importId, configAlias);
|
|
72
73
|
if (resolved) {
|
|
73
74
|
hasReplacement = true;
|
|
@@ -16,7 +16,10 @@ const ALWAYS_NOEXTERNAL = [
|
|
|
16
16
|
// Full explanation and related bug report: https://github.com/withastro/astro/pull/3667
|
|
17
17
|
"@nanostores/preact",
|
|
18
18
|
// fontsource packages are CSS that need to be processed
|
|
19
|
-
"@fontsource/*"
|
|
19
|
+
"@fontsource/*",
|
|
20
|
+
// Must be bundled so the prerender output resolves Astro's own copy, not an
|
|
21
|
+
// older hoisted version from another dependency. See https://github.com/withastro/astro/issues/17508
|
|
22
|
+
"neotraverse"
|
|
20
23
|
];
|
|
21
24
|
function vitePluginEnvironment({
|
|
22
25
|
command,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -100,7 +100,6 @@
|
|
|
100
100
|
"@capsizecss/unpack": "^4.0.0",
|
|
101
101
|
"@clack/prompts": "^1.1.0",
|
|
102
102
|
"@oslojs/encoding": "^1.1.0",
|
|
103
|
-
"@rollup/pluginutils": "^5.3.0",
|
|
104
103
|
"am-i-vibing": "^0.4.0",
|
|
105
104
|
"aria-query": "^5.3.2",
|
|
106
105
|
"axobject-query": "^4.1.0",
|