astro 3.5.2 → 3.5.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.
@@ -464,67 +464,6 @@ export interface AstroUserConfig {
464
464
  * ```
465
465
  */
466
466
  redirects?: Record<string, RedirectConfig>;
467
- /**
468
- * @docs
469
- * @name prefetch
470
- * @type {boolean | object}
471
- * @description
472
- * Enable prefetching for links on your site to provide faster page transitions.
473
- * (Enabled by default on pages using the `<ViewTransitions />` router. Set `prefetch: false` to opt out of this behaviour.)
474
- *
475
- * This configuration automatically adds a prefetch script to every page in the project
476
- * giving you access to the `data-astro-prefetch` attribute.
477
- * Add this attribute to any `<a />` link on your page to enable prefetching for that page.
478
- *
479
- * ```html
480
- * <a href="/about" data-astro-prefetch>About</a>
481
- * ```
482
- * Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
483
- *
484
- * See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
485
- */
486
- prefetch?: boolean | {
487
- /**
488
- * @docs
489
- * @name prefetch.prefetchAll
490
- * @type {boolean}
491
- * @description
492
- * Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
493
- * This value defaults to `true` when using the `<ViewTransitions />` router. Otherwise, the default value is `false`.
494
- *
495
- * ```js
496
- * prefetch: {
497
- * prefetchAll: true
498
- * }
499
- * ```
500
- *
501
- * When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
502
- *
503
- * ```html
504
- * <a href="/about" data-astro-prefetch="false">About</a>
505
- *```
506
- */
507
- prefetchAll?: boolean;
508
- /**
509
- * @docs
510
- * @name prefetch.defaultStrategy
511
- * @type {'tap' | 'hover' | 'viewport'}
512
- * @default `'hover'`
513
- * @description
514
- * The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
515
- *
516
- * - `'tap'`: Prefetch just before you click on the link.
517
- * - `'hover'`: Prefetch when you hover over or focus on the link. (default)
518
- * - `'viewport'`: Prefetch as the links enter the viewport.
519
- *
520
- * You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
521
- *
522
- * ```html
523
- * <a href="/about" data-astro-prefetch="viewport">About</a>
524
- * ```
525
- */
526
- defaultStrategy?: 'tap' | 'hover' | 'viewport';
527
- };
528
467
  /**
529
468
  * @docs
530
469
  * @name site
@@ -893,6 +832,68 @@ export interface AstroUserConfig {
893
832
  */
894
833
  excludeMiddleware?: boolean;
895
834
  };
835
+ /**
836
+ * @docs
837
+ * @kind heading
838
+ * @name Prefetch Options
839
+ * @type {boolean | object}
840
+ * @description
841
+ * Enable prefetching for links on your site to provide faster page transitions.
842
+ * (Enabled by default on pages using the `<ViewTransitions />` router. Set `prefetch: false` to opt out of this behaviour.)
843
+ *
844
+ * This configuration automatically adds a prefetch script to every page in the project
845
+ * giving you access to the `data-astro-prefetch` attribute.
846
+ * Add this attribute to any `<a />` link on your page to enable prefetching for that page.
847
+ *
848
+ * ```html
849
+ * <a href="/about" data-astro-prefetch>About</a>
850
+ * ```
851
+ * Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
852
+ *
853
+ * See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
854
+ */
855
+ prefetch?: boolean | {
856
+ /**
857
+ * @docs
858
+ * @name prefetch.prefetchAll
859
+ * @type {boolean}
860
+ * @description
861
+ * Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
862
+ * This value defaults to `true` when using the `<ViewTransitions />` router. Otherwise, the default value is `false`.
863
+ *
864
+ * ```js
865
+ * prefetch: {
866
+ * prefetchAll: true
867
+ * }
868
+ * ```
869
+ *
870
+ * When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
871
+ *
872
+ * ```html
873
+ * <a href="/about" data-astro-prefetch="false">About</a>
874
+ *```
875
+ */
876
+ prefetchAll?: boolean;
877
+ /**
878
+ * @docs
879
+ * @name prefetch.defaultStrategy
880
+ * @type {'tap' | 'hover' | 'viewport'}
881
+ * @default `'hover'`
882
+ * @description
883
+ * The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
884
+ *
885
+ * - `'tap'`: Prefetch just before you click on the link.
886
+ * - `'hover'`: Prefetch when you hover over or focus on the link. (default)
887
+ * - `'viewport'`: Prefetch as the links enter the viewport.
888
+ *
889
+ * You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
890
+ *
891
+ * ```html
892
+ * <a href="/about" data-astro-prefetch="viewport">About</a>
893
+ * ```
894
+ */
895
+ defaultStrategy?: 'tap' | 'hover' | 'viewport';
896
+ };
896
897
  /**
897
898
  * @docs
898
899
  * @kind heading
@@ -1351,6 +1352,7 @@ export interface AstroUserConfig {
1351
1352
  i18n?: {
1352
1353
  /**
1353
1354
  * @docs
1355
+ * @kind h4
1354
1356
  * @name experimental.i18n.defaultLocale
1355
1357
  * @type {string}
1356
1358
  * @version 3.5.0
@@ -1363,6 +1365,7 @@ export interface AstroUserConfig {
1363
1365
  defaultLocale: string;
1364
1366
  /**
1365
1367
  * @docs
1368
+ * @kind h4
1366
1369
  * @name experimental.i18n.locales
1367
1370
  * @type {string[]}
1368
1371
  * @version 3.5.0
@@ -1375,6 +1378,7 @@ export interface AstroUserConfig {
1375
1378
  locales: string[];
1376
1379
  /**
1377
1380
  * @docs
1381
+ * @kind h4
1378
1382
  * @name experimental.i18n.fallback
1379
1383
  * @type {Record<string, string>}
1380
1384
  * @version 3.5.0
@@ -1384,7 +1388,7 @@ export interface AstroUserConfig {
1384
1388
  *
1385
1389
  * Use this object to declare a fallback `locale` route for each language you support. If no fallback is specified, then unavailable pages will return a 404.
1386
1390
  *
1387
- * #### Example
1391
+ * ##### Example
1388
1392
  *
1389
1393
  * The following example configures your content fallback strategy to redirect unavailable pages in `/pt-br/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404.
1390
1394
  *
@@ -1406,6 +1410,7 @@ export interface AstroUserConfig {
1406
1410
  fallback?: Record<string, string>;
1407
1411
  /**
1408
1412
  * @docs
1413
+ * @kind h4
1409
1414
  * @name experimental.i18n.routingStrategy
1410
1415
  * @type {'prefix-always' | 'prefix-other-locales'}
1411
1416
  * @default 'prefix-other-locales'
@@ -139,7 +139,7 @@ function astroConfigBuildPlugin(options, internals) {
139
139
  const pageData = getPageDataByViteID(internals, pageViteID);
140
140
  if (!pageData)
141
141
  continue;
142
- const _entryCss = internals.propagatedStylesMap?.get(id);
142
+ const _entryCss = pageData.propagatedStyles?.get(id);
143
143
  const _entryScripts = pageData.propagatedScripts?.get(id);
144
144
  if (_entryCss) {
145
145
  for (const value of _entryCss) {
@@ -65,7 +65,7 @@ function astroContentVirtualModPlugin({
65
65
  hydratedComponents: [],
66
66
  clientOnlyComponents: [],
67
67
  scripts: [],
68
- containsHead: true,
68
+ containsHead: false,
69
69
  propagation: "in-tree",
70
70
  pageOptions: {}
71
71
  }
@@ -34,6 +34,7 @@ function rollupPluginAstroBuildCSS(options) {
34
34
  let resolvedConfig;
35
35
  const pagesToCss = {};
36
36
  const pagesToPropagatedCss = {};
37
+ const isContentCollectionCache = options.buildOptions.settings.config.output === "static" && options.buildOptions.settings.config.experimental.contentCollectionCache;
37
38
  const cssBuildPlugin = {
38
39
  name: "astro:rollup-plugin-build-css",
39
40
  outputOptions(outputOptions) {
@@ -52,7 +53,7 @@ function rollupPluginAstroBuildCSS(options) {
52
53
  if (new URL(pageInfo.id, "file://").searchParams.has(PROPAGATED_ASSET_FLAG)) {
53
54
  const chunkId2 = assetName.createNameHash(id, [id]);
54
55
  internals.cssModuleToChunkIdMap.set(id, chunkId2);
55
- if (options.buildOptions.settings.config.output === "static" && options.buildOptions.settings.config.experimental.contentCollectionCache) {
56
+ if (isContentCollectionCache) {
56
57
  const propagatedStyles = internals.propagatedStylesMap.get(pageInfo.id) ?? /* @__PURE__ */ new Set();
57
58
  propagatedStyles.add({ type: "external", src: chunkId2 });
58
59
  internals.propagatedStylesMap.set(pageInfo.id, propagatedStyles);
@@ -174,7 +175,12 @@ function rollupPluginAstroBuildCSS(options) {
174
175
  return;
175
176
  if (pageData.styles.some((s) => s.sheet === sheet))
176
177
  return;
177
- const propagatedStyles = internals.propagatedStylesMap.get(pageInfoId) ?? internals.propagatedStylesMap.set(pageInfoId, /* @__PURE__ */ new Set()).get(pageInfoId);
178
+ let propagatedStyles;
179
+ if (isContentCollectionCache) {
180
+ propagatedStyles = internals.propagatedStylesMap.get(pageInfoId) ?? internals.propagatedStylesMap.set(pageInfoId, /* @__PURE__ */ new Set()).get(pageInfoId);
181
+ } else {
182
+ propagatedStyles = pageData.propagatedStyles.get(pageInfoId) ?? pageData.propagatedStyles.set(pageInfoId, /* @__PURE__ */ new Set()).get(pageInfoId);
183
+ }
178
184
  propagatedStyles.add(sheet);
179
185
  sheetAddedToPage = true;
180
186
  });
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "3.5.2";
1
+ const ASTRO_VERSION = "3.5.3";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
20
20
  base: restart.container.settings.config.base
21
21
  })
22
22
  );
23
- const currentVersion = "3.5.2";
23
+ const currentVersion = "3.5.3";
24
24
  if (currentVersion.includes("-")) {
25
25
  logger.warn(null, msg.prerelease({ currentVersion }));
26
26
  }
@@ -50,7 +50,7 @@ function serverStart({
50
50
  base,
51
51
  isRestart = false
52
52
  }) {
53
- const version = "3.5.2";
53
+ const version = "3.5.3";
54
54
  const localPrefix = `${dim("\u2503")} Local `;
55
55
  const networkPrefix = `${dim("\u2503")} Network `;
56
56
  const emptyPrefix = " ".repeat(11);
@@ -235,7 +235,7 @@ function printHelp({
235
235
  message.push(
236
236
  linebreak(),
237
237
  ` ${bgGreen(black(` ${commandName} `))} ${green(
238
- `v${"3.5.2"}`
238
+ `v${"3.5.3"}`
239
239
  )} ${headline}`
240
240
  );
241
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
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",
@@ -165,8 +165,8 @@
165
165
  "yargs-parser": "^21.1.1",
166
166
  "zod": "^3.22.4",
167
167
  "@astrojs/internal-helpers": "0.2.1",
168
- "@astrojs/markdown-remark": "3.4.0",
169
- "@astrojs/telemetry": "3.0.4"
168
+ "@astrojs/telemetry": "3.0.4",
169
+ "@astrojs/markdown-remark": "3.4.0"
170
170
  },
171
171
  "optionalDependencies": {
172
172
  "sharp": "^0.32.5"