astro 7.2.7 → 7.2.9
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 +5 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/build/internal.d.ts +8 -0
- package/dist/core/build/internal.js +1 -0
- package/dist/core/build/plugins/plugin-internals.js +8 -1
- package/dist/core/build/plugins/plugin-manifest.js +11 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.js +1 -1
- package/dist/core/fetch/fetch-state.js +4 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/jsx-runtime/index.js +3 -2
- package/env.d.ts +0 -5
- package/package.json +5 -5
package/client.d.ts
CHANGED
|
@@ -282,6 +282,11 @@ declare module '*.mdx' {
|
|
|
282
282
|
export default load;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
+
declare module '*.html' {
|
|
286
|
+
const Component: (opts?: { slots?: Record<string, string> }) => string;
|
|
287
|
+
export default Component;
|
|
288
|
+
}
|
|
289
|
+
|
|
285
290
|
declare module 'astro:static-paths' {
|
|
286
291
|
export const StaticPaths: typeof import('./dist/runtime/prerender/static-paths.js').StaticPaths;
|
|
287
292
|
}
|
|
@@ -196,7 +196,7 @@ ${contentConfig.error.message}`
|
|
|
196
196
|
logger.info("Content config changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
199
|
-
if (previousAstroVersion && previousAstroVersion !== "7.2.
|
|
199
|
+
if (previousAstroVersion && previousAstroVersion !== "7.2.9") {
|
|
200
200
|
logger.info("Astro version changed");
|
|
201
201
|
shouldClear = true;
|
|
202
202
|
}
|
|
@@ -204,8 +204,8 @@ ${contentConfig.error.message}`
|
|
|
204
204
|
logger.info("Clearing content store");
|
|
205
205
|
this.#store.clearAll();
|
|
206
206
|
}
|
|
207
|
-
if ("7.2.
|
|
208
|
-
this.#store.metaStore().set("astro-version", "7.2.
|
|
207
|
+
if ("7.2.9") {
|
|
208
|
+
this.#store.metaStore().set("astro-version", "7.2.9");
|
|
209
209
|
}
|
|
210
210
|
if (currentConfigDigest) {
|
|
211
211
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -25,6 +25,14 @@ export interface BuildInternals {
|
|
|
25
25
|
*/
|
|
26
26
|
inlinedScripts: Map<string, string>;
|
|
27
27
|
entrySpecifierToBundleMap: Map<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Specifiers written to `entrySpecifierToBundleMap` by the prerender environment
|
|
30
|
+
* that have not been overwritten by the SSR or client environments. These point
|
|
31
|
+
* to chunk files inside the prerender output directory, which is deleted after
|
|
32
|
+
* page generation. They must be stripped from the SSR manifest to avoid dangling
|
|
33
|
+
* references.
|
|
34
|
+
*/
|
|
35
|
+
prerenderOnlyEntrySpecifiers: Set<string>;
|
|
28
36
|
/**
|
|
29
37
|
* A map for page-specific information.
|
|
30
38
|
*/
|
|
@@ -7,6 +7,7 @@ function createBuildInternals() {
|
|
|
7
7
|
prerenderCssAssetByModuleKey: /* @__PURE__ */ new Map(),
|
|
8
8
|
inlinedScripts: /* @__PURE__ */ new Map(),
|
|
9
9
|
entrySpecifierToBundleMap: /* @__PURE__ */ new Map(),
|
|
10
|
+
prerenderOnlyEntrySpecifiers: /* @__PURE__ */ new Set(),
|
|
10
11
|
pagesByKeys: /* @__PURE__ */ new Map(),
|
|
11
12
|
pagesByViteID: /* @__PURE__ */ new Map(),
|
|
12
13
|
pagesByClientOnly: /* @__PURE__ */ new Map(),
|
|
@@ -56,6 +56,7 @@ function pluginInternals(options, internals) {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
await Promise.all(promises);
|
|
59
|
+
const isPrerender = this.environment?.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
59
60
|
for (const [_, chunk] of Object.entries(bundle)) {
|
|
60
61
|
if (chunk.fileName.startsWith(options.settings.config.build.assets)) {
|
|
61
62
|
internals.clientChunksAndAssets.add(chunk.fileName);
|
|
@@ -63,7 +64,13 @@ function pluginInternals(options, internals) {
|
|
|
63
64
|
if (chunk.type === "chunk" && chunk.facadeModuleId) {
|
|
64
65
|
const specifiers = mapping.get(chunk.facadeModuleId) || /* @__PURE__ */ new Set([chunk.facadeModuleId]);
|
|
65
66
|
for (const specifier of specifiers) {
|
|
66
|
-
|
|
67
|
+
const normalizedId = normalizeEntryId(specifier);
|
|
68
|
+
internals.entrySpecifierToBundleMap.set(normalizedId, chunk.fileName);
|
|
69
|
+
if (isPrerender) {
|
|
70
|
+
internals.prerenderOnlyEntrySpecifiers.add(normalizedId);
|
|
71
|
+
} else {
|
|
72
|
+
internals.prerenderOnlyEntrySpecifiers.delete(normalizedId);
|
|
73
|
+
}
|
|
67
74
|
}
|
|
68
75
|
}
|
|
69
76
|
}
|
|
@@ -49,7 +49,8 @@ async function manifestBuildPostHook(options, internals, {
|
|
|
49
49
|
logger: options.logger,
|
|
50
50
|
middlewareEntryPoint: shouldPassMiddlewareEntryPoint ? internals.middlewareEntryPoint : void 0
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
let ssrManifest = stripPrerenderedRouteStyles(manifest);
|
|
53
|
+
ssrManifest = stripPrerenderOnlyEntryModules(ssrManifest, internals);
|
|
53
54
|
const code = injectManifest(ssrManifest, ssrManifestChunk.code);
|
|
54
55
|
mutate(ssrManifestChunk.fileName, code, false);
|
|
55
56
|
}
|
|
@@ -94,6 +95,15 @@ function stripPrerenderedRouteStyles(manifest) {
|
|
|
94
95
|
});
|
|
95
96
|
return stripped ? { ...manifest, routes } : manifest;
|
|
96
97
|
}
|
|
98
|
+
function stripPrerenderOnlyEntryModules(manifest, internals) {
|
|
99
|
+
if (internals.prerenderOnlyEntrySpecifiers.size === 0) return manifest;
|
|
100
|
+
const filtered = Object.fromEntries(
|
|
101
|
+
Object.entries(manifest.entryModules).filter(
|
|
102
|
+
([key]) => !internals.prerenderOnlyEntrySpecifiers.has(key)
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
return { ...manifest, entryModules: filtered };
|
|
106
|
+
}
|
|
97
107
|
async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
98
108
|
const { settings } = opts;
|
|
99
109
|
const routes = [];
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -26,7 +26,7 @@ async function dev(inlineConfig) {
|
|
|
26
26
|
await telemetry.record([]);
|
|
27
27
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
28
28
|
const logger = restart.container.logger;
|
|
29
|
-
const currentVersion = "7.2.
|
|
29
|
+
const currentVersion = "7.2.9";
|
|
30
30
|
const isPrerelease = currentVersion.includes("-");
|
|
31
31
|
if (!isPrerelease) {
|
|
32
32
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync, unlinkSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import findProcess from "find-
|
|
3
|
+
import findProcess from "find-proc";
|
|
4
4
|
const GRACEFUL_SHUTDOWN_TIMEOUT = 5e3;
|
|
5
5
|
function getLockFileURL(root, command = "dev") {
|
|
6
6
|
return new URL(`.astro/${command}.json`, root);
|
|
@@ -722,10 +722,14 @@ class FetchState {
|
|
|
722
722
|
*/
|
|
723
723
|
#stripHtmlExtension() {
|
|
724
724
|
if (this.routeData && this.routeData.type === "page" && !routeHasHtmlExtension(this.routeData)) {
|
|
725
|
+
const original = this.pathname;
|
|
725
726
|
this.pathname = this.pathname.replace(/\/index\.html$/, "/").replace(/\.html$/, "");
|
|
726
727
|
if (this.manifest.trailingSlash === "always" && this.pathname !== "" && !this.pathname.endsWith("/")) {
|
|
727
728
|
this.pathname += "/";
|
|
728
729
|
}
|
|
730
|
+
if (this.pathname !== original && this.routeData.pattern.test(original) && !this.routeData.pattern.test(this.pathname)) {
|
|
731
|
+
this.pathname = original;
|
|
732
|
+
}
|
|
729
733
|
}
|
|
730
734
|
}
|
|
731
735
|
#resolveRouteData() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, markHTMLString, Renderer } from "../runtime/server/index.js";
|
|
1
|
+
import { escapeHTML, Fragment, markHTMLString, Renderer } from "../runtime/server/index.js";
|
|
2
2
|
const AstroJSX = "astro:jsx";
|
|
3
3
|
const Empty = /* @__PURE__ */ Symbol("empty");
|
|
4
4
|
const toSlotName = (slotAttr) => slotAttr;
|
|
@@ -48,7 +48,8 @@ function transformSetDirectives(vnode) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
if ("set:text" in vnode.props) {
|
|
51
|
-
const
|
|
51
|
+
const value = vnode.props["set:text"];
|
|
52
|
+
const children = typeof value === "string" ? markHTMLString(escapeHTML(value)) : value;
|
|
52
53
|
delete vnode.props["set:text"];
|
|
53
54
|
Object.assign(vnode.props, { children });
|
|
54
55
|
return;
|
package/env.d.ts
CHANGED
|
@@ -16,8 +16,3 @@ type Astro = import('./dist/types/public/context.js').AstroGlobal;
|
|
|
16
16
|
declare const Astro: Readonly<Astro>;
|
|
17
17
|
|
|
18
18
|
declare const Fragment: any;
|
|
19
|
-
|
|
20
|
-
declare module '*.html' {
|
|
21
|
-
const Component: (opts?: { slots?: Record<string, string> }) => string;
|
|
22
|
-
export default Component;
|
|
23
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.9",
|
|
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",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"dset": "^3.1.4",
|
|
120
120
|
"es-module-lexer": "^2.0.0",
|
|
121
121
|
"esbuild": "^0.28.0",
|
|
122
|
-
"find-
|
|
122
|
+
"find-proc": "0.1.0",
|
|
123
123
|
"flattie": "^1.1.1",
|
|
124
124
|
"fontace": "~0.4.1",
|
|
125
125
|
"get-tsconfig": "5.0.0-beta.4",
|
|
@@ -153,12 +153,12 @@
|
|
|
153
153
|
"xxhash-wasm": "^1.1.0",
|
|
154
154
|
"yargs-parser": "^22.0.0",
|
|
155
155
|
"zod": "^4.3.6",
|
|
156
|
-
"@astrojs/internal-helpers": "0.10.4",
|
|
157
156
|
"@astrojs/markdown-satteri": "0.3.8",
|
|
157
|
+
"@astrojs/internal-helpers": "0.10.4",
|
|
158
158
|
"@astrojs/telemetry": "3.3.3"
|
|
159
159
|
},
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"sharp": "^0.
|
|
161
|
+
"sharp": "^0.35.4"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
164
164
|
"@astrojs/markdown-remark": "7.2.4"
|
|
@@ -193,8 +193,8 @@
|
|
|
193
193
|
"typescript": "^6.0.3",
|
|
194
194
|
"undici": "^7.22.0",
|
|
195
195
|
"vitest": "^4.1.0",
|
|
196
|
-
"@astrojs/check": "0.9.10",
|
|
197
196
|
"@astrojs/markdown-remark": "7.2.4",
|
|
197
|
+
"@astrojs/check": "0.9.10",
|
|
198
198
|
"astro-scripts": "0.0.14"
|
|
199
199
|
},
|
|
200
200
|
"engines": {
|