astro 7.2.0 → 7.2.2
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/constants.d.ts +8 -0
- package/dist/assets/fonts/constants.js +2 -0
- package/dist/assets/fonts/vite-plugin-fonts.js +3 -1
- package/dist/assets/utils/node.js +35 -3
- package/dist/assets/utils/resolveImports.d.ts +0 -1
- package/dist/assets/utils/resolveImports.js +1 -4
- package/dist/cli/dev/index.js +2 -2
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/preview/index.js +1 -1
- package/dist/cli/server.js +4 -4
- package/dist/content/content-layer.js +63 -3
- package/dist/content/loaders/file.js +20 -5
- package/dist/content/loaders/glob.js +18 -4
- package/dist/content/mutable-data-store.js +3 -3
- package/dist/content/runtime.d.ts +1 -0
- package/dist/content/runtime.js +6 -2
- package/dist/core/app/types.d.ts +2 -0
- package/dist/core/build/generate.js +10 -1
- package/dist/core/build/plugins/plugin-incremental.js +162 -36
- package/dist/core/build/plugins/plugin-manifest.js +11 -2
- package/dist/core/config/settings.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.d.ts +19 -2
- package/dist/core/dev/lockfile.js +25 -2
- package/dist/core/fetch/fetch-state.js +1 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +11 -24
- package/dist/core/routing/dev.d.ts +3 -1
- package/dist/core/routing/dev.js +10 -2
- package/dist/core/util.js +2 -2
- package/dist/prefetch/index.js +18 -1
- package/dist/prefetch/speculation-rules.d.ts +6 -0
- package/dist/prefetch/speculation-rules.js +22 -0
- package/dist/runtime/server/render/head.js +10 -0
- package/dist/transitions/swap-functions.js +49 -4
- package/dist/types/public/config.d.ts +22 -7
- package/dist/types/public/internal.d.ts +2 -0
- package/dist/vite-plugin-app/app.d.ts +3 -1
- package/dist/vite-plugin-app/app.js +4 -3
- package/dist/vite-plugin-css/index.js +2 -2
- package/package.json +5 -4
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import { SERVER_ISLAND_START } from "../runtime/server/render/server-islands-shared.js";
|
|
2
2
|
const PERSIST_ATTR = "data-astro-transition-persist";
|
|
3
3
|
const NON_OVERRIDABLE_ASTRO_ATTRS = ["data-astro-transition", "data-astro-transition-fallback"];
|
|
4
|
-
const
|
|
4
|
+
const viteStyleState = import.meta.env.DEV ? /* @__PURE__ */ (() => {
|
|
5
|
+
const styles = /* @__PURE__ */ new Map();
|
|
6
|
+
let observer;
|
|
7
|
+
return {
|
|
8
|
+
styles,
|
|
9
|
+
observe() {
|
|
10
|
+
if (observer) return;
|
|
11
|
+
observer = new MutationObserver((records) => {
|
|
12
|
+
for (const record of records) {
|
|
13
|
+
for (const node of record.addedNodes) {
|
|
14
|
+
if (!(node instanceof HTMLStyleElement)) continue;
|
|
15
|
+
const viteDevId = node.dataset.viteDevId;
|
|
16
|
+
if (!viteDevId) continue;
|
|
17
|
+
const knownStyle = styles.get(viteDevId);
|
|
18
|
+
if (node === knownStyle) continue;
|
|
19
|
+
knownStyle?.remove();
|
|
20
|
+
styles.set(viteDevId, node);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
observer.observe(document.head, { childList: true });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
})() : void 0;
|
|
5
28
|
const scriptsAlreadyRan = /* @__PURE__ */ new Set();
|
|
6
29
|
function detectScriptExecuted(script) {
|
|
7
30
|
const key = script.src ? new URL(script.src, location.href).href : script.textContent;
|
|
@@ -41,8 +64,8 @@ function swapHeadElements(doc) {
|
|
|
41
64
|
newEl.remove();
|
|
42
65
|
} else {
|
|
43
66
|
if (import.meta.env.DEV && el instanceof HTMLStyleElement) {
|
|
44
|
-
const viteDevId =
|
|
45
|
-
viteDevId &&
|
|
67
|
+
const viteDevId = el.dataset.viteDevId;
|
|
68
|
+
viteDevId && viteStyleState?.styles.set(viteDevId, el);
|
|
46
69
|
}
|
|
47
70
|
el.remove();
|
|
48
71
|
}
|
|
@@ -50,7 +73,18 @@ function swapHeadElements(doc) {
|
|
|
50
73
|
relevantNodes(document.head, "commentsOnly").forEach((node) => node.remove());
|
|
51
74
|
if (import.meta.env.DEV) {
|
|
52
75
|
relevantNodes(doc.head).forEach((child) => {
|
|
53
|
-
|
|
76
|
+
const viteDevId = child instanceof HTMLStyleElement && child.dataset.viteDevId;
|
|
77
|
+
const knownStyle = viteDevId && viteStyleState?.styles.get(viteDevId);
|
|
78
|
+
if (knownStyle) {
|
|
79
|
+
if (!vueScopedStyleId(knownStyle)) knownStyle.textContent = child.textContent;
|
|
80
|
+
document.head.append(knownStyle);
|
|
81
|
+
} else {
|
|
82
|
+
if (viteDevId) {
|
|
83
|
+
viteStyleState?.styles.set(viteDevId, child);
|
|
84
|
+
viteStyleState?.observe();
|
|
85
|
+
}
|
|
86
|
+
document.head.append(child);
|
|
87
|
+
}
|
|
54
88
|
});
|
|
55
89
|
} else {
|
|
56
90
|
document.head.append(...relevantNodes(doc.head));
|
|
@@ -85,6 +119,17 @@ function swapBodyElement(newElement, oldElement) {
|
|
|
85
119
|
}
|
|
86
120
|
}
|
|
87
121
|
attachShadowRoots(newElement);
|
|
122
|
+
reifyMediaElements(newElement);
|
|
123
|
+
}
|
|
124
|
+
function reifyMediaElements(root) {
|
|
125
|
+
for (const media of root.querySelectorAll("video, audio")) {
|
|
126
|
+
const fresh = document.createElement(media.localName);
|
|
127
|
+
for (const attr of media.attributes) {
|
|
128
|
+
fresh.setAttribute(attr.name, attr.value);
|
|
129
|
+
}
|
|
130
|
+
fresh.innerHTML = media.innerHTML;
|
|
131
|
+
media.replaceWith(fresh);
|
|
132
|
+
}
|
|
88
133
|
}
|
|
89
134
|
function attachShadowRoots(root) {
|
|
90
135
|
root.querySelectorAll("template[shadowrootmode]").forEach((template) => {
|
|
@@ -2246,7 +2246,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2246
2246
|
* @docs
|
|
2247
2247
|
* @name markdown.remarkPlugins
|
|
2248
2248
|
* @type {RemarkPlugins}
|
|
2249
|
-
* @deprecated
|
|
2249
|
+
* @deprecated This property is deprecated and will be removed in a future major version. Pass plugins to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead.
|
|
2250
|
+
*
|
|
2251
|
+
* Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using plugins](https://docs.astro.build/en/guides/markdown-content/#markdown-processor-plugins) in the Markdown guide.
|
|
2250
2252
|
* @description
|
|
2251
2253
|
* Pass [remark plugins](https://github.com/remarkjs/remark) to customize how your Markdown is built. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
|
2252
2254
|
*
|
|
@@ -2264,7 +2266,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2264
2266
|
* @docs
|
|
2265
2267
|
* @name markdown.rehypePlugins
|
|
2266
2268
|
* @type {RehypePlugins}
|
|
2267
|
-
* @deprecated
|
|
2269
|
+
* @deprecated This property is deprecated and will be removed in a future major version. Pass plugins to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead.
|
|
2270
|
+
*
|
|
2271
|
+
* Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using plugins](https://docs.astro.build/en/guides/markdown-content/#markdown-processor-plugins) in the Markdown guide.
|
|
2268
2272
|
* @description
|
|
2269
2273
|
* Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
|
2270
2274
|
*
|
|
@@ -2284,7 +2288,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2284
2288
|
* @type {boolean}
|
|
2285
2289
|
* @default `true`
|
|
2286
2290
|
* @version 2.0.0
|
|
2287
|
-
* @deprecated
|
|
2291
|
+
* @deprecated This property is deprecated and will be removed in a future major version. Pass `gfm` to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead.
|
|
2292
|
+
*
|
|
2293
|
+
* Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using GitHub-flavored Markdown](https://docs.astro.build/en/guides/markdown-content/#github-flavored-markdown) in the Markdown guide.
|
|
2288
2294
|
* @description
|
|
2289
2295
|
* Astro uses [GitHub-flavored Markdown](https://github.com/remarkjs/remark-gfm) by default. To disable this, set the `gfm` flag to `false`:
|
|
2290
2296
|
*
|
|
@@ -2303,7 +2309,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2303
2309
|
* @type {boolean | Smartypants}
|
|
2304
2310
|
* @default `true`
|
|
2305
2311
|
* @version 2.0.0
|
|
2306
|
-
* @deprecated Pass
|
|
2312
|
+
* @deprecated This property is deprecated and will be removed in a future major version. Pass it to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead. Use `smartypants` for `unified()` or `smartPunctuation` for `satteri()`.
|
|
2313
|
+
*
|
|
2314
|
+
* Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using smart punctuation](https://docs.astro.build/en/guides/markdown-content/#smart-punctuation) in the Markdown guide.
|
|
2307
2315
|
* @description
|
|
2308
2316
|
* Whether to use the [SmartyPants formatter](https://daringfireball.net/projects/smartypants/) to transform straight quotes into smart quotes, dashes into en/em dashes, and triple dots into ellipses.
|
|
2309
2317
|
*
|
|
@@ -2316,7 +2324,11 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2316
2324
|
* @docs
|
|
2317
2325
|
* @name markdown.remarkRehype
|
|
2318
2326
|
* @type {RemarkRehype}
|
|
2319
|
-
* @deprecated
|
|
2327
|
+
* @deprecated This property is deprecated and will be removed in a future major version.
|
|
2328
|
+
*
|
|
2329
|
+
* To configure footnotes, pass `remarkRehype` to the `unified()` processor or `gfm.footnotes` to the `satteri()` processor instead. Other `remark-rehype` options are only supported when using `unified()`.
|
|
2330
|
+
*
|
|
2331
|
+
* Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using built-in features](https://docs.astro.build/en/guides/markdown-content/#built-in-features) in the Markdown guide.
|
|
2320
2332
|
* @description
|
|
2321
2333
|
* Pass options to [remark-rehype](https://github.com/remarkjs/remark-rehype#api).
|
|
2322
2334
|
*
|
|
@@ -2336,8 +2348,9 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2336
2348
|
* @type {MarkdownProcessor}
|
|
2337
2349
|
* @version 6.4.0
|
|
2338
2350
|
* @description
|
|
2339
|
-
* Configures the Markdown processor used to render `.md` files.
|
|
2340
|
-
*
|
|
2351
|
+
* Configures the [Markdown processor](https://docs.astro.build/en/guides/markdown-content/#markdown-processors) used to render `.md` files.
|
|
2352
|
+
*
|
|
2353
|
+
* Sätteri, Astro’s native Markdown pipeline, is the default processor. To configure it, install `@astrojs/markdown-satteri` and pass options to `satteri()`:
|
|
2341
2354
|
*
|
|
2342
2355
|
* ```js
|
|
2343
2356
|
* // astro.config.mjs
|
|
@@ -2369,6 +2382,8 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
2369
2382
|
* },
|
|
2370
2383
|
* });
|
|
2371
2384
|
* ```
|
|
2385
|
+
*
|
|
2386
|
+
* Learn more about the [official Markdown processors and how to choose one](https://docs.astro.build/en/guides/markdown-content/#choosing-a-markdown-processor) in the Markdown guide.
|
|
2372
2387
|
*/
|
|
2373
2388
|
processor?: MarkdownProcessor;
|
|
2374
2389
|
};
|
|
@@ -231,6 +231,8 @@ export interface SSRResult {
|
|
|
231
231
|
isStrictDynamic: SSRManifestCSP['isStrictDynamic'];
|
|
232
232
|
scriptDirective: SSRManifestCSP['scriptDirective'];
|
|
233
233
|
styleDirective: SSRManifestCSP['styleDirective'];
|
|
234
|
+
/** Static speculation rules JSON to inject in the head when CSP + clientPrerender are both enabled. */
|
|
235
|
+
speculationRulesContent?: string;
|
|
234
236
|
internalFetchHeaders?: Record<string, string>;
|
|
235
237
|
}
|
|
236
238
|
/**
|
|
@@ -35,7 +35,9 @@ export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
|
35
35
|
* Called via HMR when action files change.
|
|
36
36
|
*/
|
|
37
37
|
clearActions(): void;
|
|
38
|
-
devMatch(pathname: string
|
|
38
|
+
devMatch(pathname: string, { prerenderOnly }?: {
|
|
39
|
+
prerenderOnly?: boolean;
|
|
40
|
+
}): Promise<DevMatch | undefined>;
|
|
39
41
|
static create(manifest: SSRManifest, routesList: RoutesList, logger: AstroLogger, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>): Promise<AstroServerApp>;
|
|
40
42
|
createPipeline(_streaming: boolean, manifest: SSRManifest, settings: AstroSettings, logger: AstroLogger, loader: ModuleLoader, manifestData: RoutesList, getDebugInfo: () => Promise<string>): RunnablePipeline;
|
|
41
43
|
/**
|
|
@@ -70,12 +70,13 @@ class AstroServerApp extends BaseApp {
|
|
|
70
70
|
clearActions() {
|
|
71
71
|
this.pipeline.clearActions();
|
|
72
72
|
}
|
|
73
|
-
async devMatch(pathname) {
|
|
73
|
+
async devMatch(pathname, { prerenderOnly } = {}) {
|
|
74
74
|
const matchedRoute = await matchRoute(
|
|
75
75
|
pathname,
|
|
76
76
|
this.manifestData,
|
|
77
77
|
this.pipeline,
|
|
78
|
-
this.manifest
|
|
78
|
+
this.manifest,
|
|
79
|
+
{ prerenderOnly }
|
|
79
80
|
);
|
|
80
81
|
if (!matchedRoute) {
|
|
81
82
|
return void 0;
|
|
@@ -132,7 +133,7 @@ class AstroServerApp extends BaseApp {
|
|
|
132
133
|
controller,
|
|
133
134
|
pathname,
|
|
134
135
|
async run() {
|
|
135
|
-
const matchedRoute = await self.devMatch(pathname);
|
|
136
|
+
const matchedRoute = await self.devMatch(pathname, { prerenderOnly });
|
|
136
137
|
if (!matchedRoute) {
|
|
137
138
|
if (prerenderOnly) {
|
|
138
139
|
handled = false;
|
|
@@ -76,7 +76,7 @@ function astroDevCssPlugin({
|
|
|
76
76
|
server = viteServer;
|
|
77
77
|
},
|
|
78
78
|
applyToEnvironment(env) {
|
|
79
|
-
return env.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.client || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
79
|
+
return command === "dev" && env.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.client || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
80
80
|
},
|
|
81
81
|
resolveId: {
|
|
82
82
|
filter: {
|
|
@@ -163,7 +163,7 @@ function astroDevCssPlugin({
|
|
|
163
163
|
{
|
|
164
164
|
name: MODULE_DEV_CSS_ALL,
|
|
165
165
|
applyToEnvironment(env) {
|
|
166
|
-
return env.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.client || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
166
|
+
return command === "dev" && env.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.client || env.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
167
167
|
},
|
|
168
168
|
resolveId: {
|
|
169
169
|
filter: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.2",
|
|
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",
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
"dset": "^3.1.4",
|
|
113
113
|
"es-module-lexer": "^2.0.0",
|
|
114
114
|
"esbuild": "^0.28.0",
|
|
115
|
+
"find-process": "^2.1.1",
|
|
115
116
|
"flattie": "^1.1.1",
|
|
116
117
|
"fontace": "~0.4.1",
|
|
117
118
|
"get-tsconfig": "5.0.0-beta.4",
|
|
@@ -145,9 +146,9 @@
|
|
|
145
146
|
"xxhash-wasm": "^1.1.0",
|
|
146
147
|
"yargs-parser": "^22.0.0",
|
|
147
148
|
"zod": "^4.3.6",
|
|
148
|
-
"@astrojs/
|
|
149
|
+
"@astrojs/telemetry": "3.3.3",
|
|
149
150
|
"@astrojs/markdown-satteri": "0.3.5",
|
|
150
|
-
"@astrojs/
|
|
151
|
+
"@astrojs/internal-helpers": "0.10.2"
|
|
151
152
|
},
|
|
152
153
|
"optionalDependencies": {
|
|
153
154
|
"sharp": "^0.34.0 || ^0.35.0"
|
|
@@ -185,8 +186,8 @@
|
|
|
185
186
|
"typescript": "^6.0.3",
|
|
186
187
|
"undici": "^7.22.0",
|
|
187
188
|
"vitest": "^4.1.0",
|
|
188
|
-
"@astrojs/check": "0.9.10",
|
|
189
189
|
"@astrojs/markdown-remark": "7.2.2",
|
|
190
|
+
"@astrojs/check": "0.9.10",
|
|
190
191
|
"astro-scripts": "0.0.14"
|
|
191
192
|
},
|
|
192
193
|
"engines": {
|