astro 6.0.0-beta.12 → 6.0.0-beta.14

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.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/bin/astro.mjs +1 -1
  3. package/components/Code.astro +26 -2
  4. package/components/Image.astro +2 -2
  5. package/dist/actions/runtime/client.js +2 -4
  6. package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +1 -1
  7. package/dist/assets/fonts/infra/levenshtein-string-matcher.js +1 -1
  8. package/dist/assets/fonts/providers/index.d.ts +19 -15
  9. package/dist/assets/fonts/providers/index.js +23 -1
  10. package/dist/assets/index.d.ts +1 -1
  11. package/dist/assets/index.js +0 -1
  12. package/dist/assets/services/service.js +5 -5
  13. package/dist/assets/utils/queryParams.js +2 -2
  14. package/dist/cli/add/index.js +1 -1
  15. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  16. package/dist/content/content-layer.js +3 -3
  17. package/dist/content/utils.js +2 -2
  18. package/dist/content/vite-plugin-content-virtual-mod.js +1 -0
  19. package/dist/core/app/entrypoints/virtual/dev.d.ts +2 -2
  20. package/dist/core/app/entrypoints/virtual/dev.js +7 -3
  21. package/dist/core/app/entrypoints/virtual/index.d.ts +2 -2
  22. package/dist/core/app/entrypoints/virtual/prod.d.ts +2 -2
  23. package/dist/core/app/entrypoints/virtual/prod.js +3 -3
  24. package/dist/core/app/types.d.ts +4 -0
  25. package/dist/core/app/validate-headers.js +3 -1
  26. package/dist/core/build/generate.js +1 -1
  27. package/dist/core/config/schemas/base.js +1 -1
  28. package/dist/core/constants.js +1 -1
  29. package/dist/core/create-vite.js +9 -3
  30. package/dist/core/dev/container.js +1 -1
  31. package/dist/core/dev/dev.js +1 -1
  32. package/dist/core/messages.js +2 -2
  33. package/dist/core/preview/vite-plugin-astro-preview.js +2 -2
  34. package/dist/core/render/paginate.js +1 -1
  35. package/dist/core/render-context.js +12 -8
  36. package/dist/core/routing/rewrite.js +1 -1
  37. package/dist/env/validators.js +1 -1
  38. package/dist/events/session.js +1 -1
  39. package/dist/integrations/features-validation.js +1 -1
  40. package/dist/integrations/hooks.js +1 -1
  41. package/dist/manifest/virtual-module.js +1 -1
  42. package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +3 -3
  43. package/dist/runtime/client/dev-toolbar/apps/utils/icons.js +1 -1
  44. package/dist/runtime/server/astro-island.js +1 -1
  45. package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
  46. package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
  47. package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
  48. package/dist/runtime/server/astro-island.prebuilt.js +1 -1
  49. package/dist/runtime/server/jsx.js +1 -1
  50. package/dist/runtime/server/render/head.js +1 -1
  51. package/dist/runtime/server/render/util.js +5 -2
  52. package/dist/runtime/server/serialize.js +2 -2
  53. package/dist/types/public/integrations.d.ts +71 -29
  54. package/dist/vite-plugin-adapter-config/index.js +9 -4
  55. package/dist/vite-plugin-app/app.d.ts +5 -0
  56. package/dist/vite-plugin-app/app.js +7 -0
  57. package/dist/vite-plugin-app/createAstroServerApp.js +4 -0
  58. package/dist/vite-plugin-markdown/index.js +6 -3
  59. package/dist/vite-plugin-renderers/index.d.ts +4 -2
  60. package/dist/vite-plugin-renderers/index.js +9 -0
  61. package/dist/vite-plugin-shiki-styles/index.d.ts +9 -0
  62. package/dist/vite-plugin-shiki-styles/index.js +44 -0
  63. package/package.json +3 -3
  64. package/types/content.d.ts +0 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  npm create astro@latest
16
16
 
17
17
  # Manual:
18
- npm install --save-dev astro
18
+ npm install astro
19
19
  ```
20
20
 
21
21
  Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide.
package/bin/astro.mjs CHANGED
@@ -19,7 +19,7 @@ const skipSemverCheckIfAbove = IS_STACKBLITZ ? 21 : 23;
19
19
  async function main() {
20
20
  const version = process.versions.node;
21
21
  // Fast-path for higher Node.js versions
22
- if ((parseInt(version) || 0) <= skipSemverCheckIfAbove) {
22
+ if ((Number.parseInt(version) || 0) <= skipSemverCheckIfAbove) {
23
23
  const semver = await import('semver');
24
24
  try {
25
25
  if (!semver.satisfies(version, engines)) {
@@ -1,10 +1,18 @@
1
1
  ---
2
- import { type ThemePresets, createShikiHighlighter } from '@astrojs/markdown-remark';
2
+ import {
3
+ type ThemePresets,
4
+ createShikiHighlighter,
5
+ globalShikiStyleCollector,
6
+ transformerStyleToClass,
7
+ } from '@astrojs/markdown-remark';
3
8
  import type { ShikiTransformer, ThemeRegistration, ThemeRegistrationRaw } from 'shiki';
4
9
  import { bundledLanguages } from 'shiki/langs';
5
10
  import type { CodeLanguage } from '../dist/types/public/common.js';
6
11
  import type { HTMLAttributes } from '../types.js';
7
12
 
13
+ // Code.astro always uses Shiki, so import the virtual CSS module
14
+ import 'virtual:astro:shiki-styles.css';
15
+
8
16
  interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
9
17
  /** The code to highlight. Required. */
10
18
  code: string;
@@ -16,6 +24,14 @@ interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
16
24
  * @default "plaintext"
17
25
  */
18
26
  lang?: CodeLanguage;
27
+ /**
28
+ * Additional languages to load.
29
+ * Useful if `code` embeds languages not included by the given `lang`
30
+ * For example, TSX in Vue
31
+ *
32
+ * @default []
33
+ */
34
+ embeddedLangs?: CodeLanguage[];
19
35
  /**
20
36
  * A metastring to pass to the highlighter.
21
37
  * Allows passing information to transformers: https://shiki.style/guide/transformers#meta
@@ -72,6 +88,7 @@ interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
72
88
  const {
73
89
  code,
74
90
  lang = 'plaintext',
91
+ embeddedLangs = [],
75
92
  meta,
76
93
  theme = 'github-dark',
77
94
  themes = {},
@@ -101,16 +118,23 @@ const highlighter = await createShikiHighlighter({
101
118
  ? lang
102
119
  : 'plaintext'
103
120
  : (lang as any),
121
+ ...embeddedLangs,
104
122
  ],
105
123
  theme,
106
124
  themes,
107
125
  });
108
126
 
127
+ // Combine style-to-class transformer with user-provided transformers
128
+ const allTransformers = [
129
+ globalShikiStyleCollector.register(transformerStyleToClass()),
130
+ ...transformers,
131
+ ];
132
+
109
133
  const html = await highlighter.codeToHtml(code, typeof lang === 'string' ? lang : lang.name, {
110
134
  defaultColor,
111
135
  wrap,
112
136
  inline,
113
- transformers,
137
+ transformers: allTransformers,
114
138
  meta,
115
139
  attributes: rest as any,
116
140
  });
@@ -17,11 +17,11 @@ if (props.alt === undefined || props.alt === null) {
17
17
 
18
18
  // As a convenience, allow width and height to be string with a number in them, to match HTML's native `img`.
19
19
  if (typeof props.width === 'string') {
20
- props.width = parseInt(props.width);
20
+ props.width = Number.parseInt(props.width);
21
21
  }
22
22
 
23
23
  if (typeof props.height === 'string') {
24
- props.height = parseInt(props.height);
24
+ props.height = Number.parseInt(props.height);
25
25
  }
26
26
 
27
27
  const layout = props.layout ?? imageConfig.layout ?? 'none';
@@ -43,10 +43,8 @@ const codeToStatusMap = {
43
43
  LOOP_DETECTED: 508,
44
44
  NETWORK_AUTHENTICATION_REQUIRED: 511
45
45
  };
46
- const statusToCodeMap = Object.entries(codeToStatusMap).reduce(
47
- // reverse the key-value pairs
48
- (acc, [key, value]) => ({ ...acc, [value]: key }),
49
- {}
46
+ const statusToCodeMap = Object.fromEntries(
47
+ Object.entries(codeToStatusMap).map(([key, value]) => [value, key])
50
48
  );
51
49
  class ActionError extends Error {
52
50
  type = "AstroActionError";
@@ -16,7 +16,7 @@ function filterRequiredMetrics({
16
16
  };
17
17
  }
18
18
  function round(value) {
19
- return parseFloat(value.toFixed(4));
19
+ return Number.parseFloat(value.toFixed(4));
20
20
  }
21
21
  function toPercentString(value) {
22
22
  return `${round(value * 100)}%`;
@@ -125,7 +125,7 @@ class LevenshteinStringMatcher {
125
125
  return this.#myers_x(a, b);
126
126
  }
127
127
  #closest(str, arr) {
128
- let min_distance = Infinity;
128
+ let min_distance = Number.POSITIVE_INFINITY;
129
129
  let min_index = 0;
130
130
  for (let i = 0; i < arr.length; i++) {
131
131
  const dist = this.#distance(str, arr[i]);
@@ -1,29 +1,32 @@
1
- import { type AdobeProviderOptions, type GoogleFamilyOptions, type GoogleiconsFamilyOptions } from 'unifont';
1
+ import { type AdobeProviderOptions, type GoogleFamilyOptions, type GoogleiconsFamilyOptions, type NpmProviderOptions, type NpmFamilyOptions } from 'unifont';
2
2
  import type { FontProvider } from '../types.js';
3
3
  import { type LocalFamilyOptions } from './local.js';
4
- /** [Adobe](https://fonts.adobe.com/) */
4
+ /** [Adobe](https://v6.docs.astro.build/en/reference/font-provider-reference/#adobe) */
5
5
  declare function adobe(config: AdobeProviderOptions): FontProvider;
6
- /** [Bunny](https://fonts.bunny.net/) */
6
+ /** [Bunny](https://v6.docs.astro.build/en/reference/font-provider-reference/#bunny) */
7
7
  declare function bunny(): FontProvider;
8
- /** [Fontshare](https://www.fontshare.com/) */
8
+ /** [Fontshare](https://v6.docs.astro.build/en/reference/font-provider-reference/#fontshare) */
9
9
  declare function fontshare(): FontProvider;
10
- /** [Fontsource](https://fontsource.org/) */
10
+ /** [Fontsource](https://v6.docs.astro.build/en/reference/font-provider-reference/#fontsource) */
11
11
  declare function fontsource(): FontProvider;
12
- /** [Google](https://fonts.google.com/) */
12
+ /** [Google](https://v6.docs.astro.build/en/reference/font-provider-reference/#google) */
13
13
  declare function google(): FontProvider<GoogleFamilyOptions | undefined>;
14
- /** [Google Icons](https://fonts.google.com/icons) */
14
+ /** [Google Icons](https://v6.docs.astro.build/en/reference/font-provider-reference/#google-icons) */
15
15
  declare function googleicons(): FontProvider<GoogleiconsFamilyOptions | undefined>;
16
- /** A provider that handles local files. */
16
+ /** [Local](https://v6.docs.astro.build/en/reference/font-provider-reference/#local) */
17
17
  declare function local(): FontProvider<LocalFamilyOptions>;
18
+ /** [NPM](https://v6.docs.astro.build/en/reference/font-provider-reference/#npm) */
19
+ declare function npm(options?: Omit<NpmProviderOptions, 'root' | 'readFile'>): FontProvider<NpmFamilyOptions | undefined>;
18
20
  /**
19
21
  * Astro exports a few built-in providers:
20
- * - [Adobe](https://fonts.adobe.com/)
21
- * - [Bunny](https://fonts.bunny.net/)
22
- * - [Fontshare](https://www.fontshare.com/)
23
- * - [Fontsource](https://fontsource.org/)
24
- * - [Google](https://fonts.google.com/)
25
- * - [Google Icons](https://fonts.google.com/icons)
26
- * - Local
22
+ * - [Adobe](https://v6.docs.astro.build/en/reference/font-provider-reference/#adobe)
23
+ * - [Bunny](https://v6.docs.astro.build/en/reference/font-provider-reference/#bunny)
24
+ * - [Fontshare](https://v6.docs.astro.build/en/reference/font-provider-reference/#fontshare)
25
+ * - [Fontsource](https://v6.docs.astro.build/en/reference/font-provider-reference/#fontsource)
26
+ * - [Google](https://v6.docs.astro.build/en/reference/font-provider-reference/#google)
27
+ * - [Google Icons](https://v6.docs.astro.build/en/reference/font-provider-reference/#google-icons)
28
+ * - [Local](https://v6.docs.astro.build/en/reference/font-provider-reference/#local)
29
+ * - [NPM](TODO:)
27
30
  */
28
31
  export declare const fontProviders: {
29
32
  adobe: typeof adobe;
@@ -33,5 +36,6 @@ export declare const fontProviders: {
33
36
  google: typeof google;
34
37
  googleicons: typeof googleicons;
35
38
  local: typeof local;
39
+ npm: typeof npm;
36
40
  };
37
41
  export {};
@@ -3,6 +3,8 @@ import {
3
3
  } from "unifont";
4
4
  import { FontaceFontFileReader } from "../infra/fontace-font-file-reader.js";
5
5
  import { LocalFontProvider } from "./local.js";
6
+ import { fileURLToPath } from "node:url";
7
+ import { readFile } from "node:fs/promises";
6
8
  function adobe(config) {
7
9
  const provider = providers.adobe(config);
8
10
  let initializedProvider;
@@ -105,6 +107,25 @@ function local() {
105
107
  fontFileReader: new FontaceFontFileReader()
106
108
  });
107
109
  }
110
+ function npm(options) {
111
+ let initializedProvider;
112
+ return {
113
+ name: providers.npm()._name,
114
+ async init(context) {
115
+ initializedProvider = await providers.npm({
116
+ ...options,
117
+ root: fileURLToPath(context.root),
118
+ readFile: (path) => readFile(path, "utf-8").catch(() => null)
119
+ })(context);
120
+ },
121
+ async resolveFont({ familyName, ...rest }) {
122
+ return await initializedProvider?.resolveFont(familyName, rest);
123
+ },
124
+ async listFonts() {
125
+ return await initializedProvider?.listFonts?.();
126
+ }
127
+ };
128
+ }
108
129
  const fontProviders = {
109
130
  adobe,
110
131
  bunny,
@@ -112,7 +133,8 @@ const fontProviders = {
112
133
  fontsource,
113
134
  google,
114
135
  googleicons,
115
- local
136
+ local,
137
+ npm
116
138
  };
117
139
  export {
118
140
  fontProviders
@@ -1,3 +1,3 @@
1
1
  export { getConfiguredImageService, getImage } from './internal.js';
2
2
  export { baseService, isLocalService } from './services/service.js';
3
- export { type LocalImageProps, type RemoteImageProps } from './types.js';
3
+ export type { LocalImageProps, RemoteImageProps } from './types.js';
@@ -1,6 +1,5 @@
1
1
  import { getConfiguredImageService, getImage } from "./internal.js";
2
2
  import { baseService, isLocalService } from "./services/service.js";
3
- import {} from "./types.js";
4
3
  export {
5
4
  baseService,
6
5
  getConfiguredImageService,
@@ -11,7 +11,7 @@ function isLocalService(service) {
11
11
  return "transform" in service;
12
12
  }
13
13
  function parseQuality(quality) {
14
- let result = parseInt(quality);
14
+ let result = Number.parseInt(quality);
15
15
  if (Number.isNaN(result)) {
16
16
  return quality;
17
17
  }
@@ -124,7 +124,7 @@ const baseService = {
124
124
  const targetFormat = options.format ?? DEFAULT_OUTPUT_FORMAT;
125
125
  let transformedWidths = (widths ?? []).sort(sortNumeric);
126
126
  let imageWidth = options.width;
127
- let maxWidth = Infinity;
127
+ let maxWidth = Number.POSITIVE_INFINITY;
128
128
  if (isESMImportedImage(options.src)) {
129
129
  imageWidth = options.src.width;
130
130
  maxWidth = imageWidth;
@@ -145,7 +145,7 @@ const baseService = {
145
145
  if (typeof density === "number") {
146
146
  return density;
147
147
  } else {
148
- return parseFloat(density);
148
+ return Number.parseFloat(density);
149
149
  }
150
150
  });
151
151
  const densityWidths = densityValues.sort(sortNumeric).map((density) => Math.round(targetWidth * density));
@@ -209,8 +209,8 @@ const baseService = {
209
209
  }
210
210
  const transform = {
211
211
  src: params.get("href"),
212
- width: params.has("w") ? parseInt(params.get("w")) : void 0,
213
- height: params.has("h") ? parseInt(params.get("h")) : void 0,
212
+ width: params.has("w") ? Number.parseInt(params.get("w")) : void 0,
213
+ height: params.has("h") ? Number.parseInt(params.get("h")) : void 0,
214
214
  format: params.get("f"),
215
215
  quality: params.get("q"),
216
216
  fit: params.get("fit"),
@@ -6,8 +6,8 @@ function getOrigQueryParams(params) {
6
6
  return void 0;
7
7
  }
8
8
  return {
9
- width: parseInt(width),
10
- height: parseInt(height),
9
+ width: Number.parseInt(width),
10
+ height: Number.parseInt(height),
11
11
  format
12
12
  };
13
13
  }
@@ -692,7 +692,7 @@ async function tryToInstallIntegrations({
692
692
  logger.debug("add", `package manager: "${packageManager?.name}"`);
693
693
  if (!packageManager) return 0 /* none */;
694
694
  const inheritedFlags = Object.entries(flags).map(([flag]) => {
695
- if (flag == "_") return;
695
+ if (flag === "_") return;
696
696
  if (INHERITED_FLAGS.has(flag)) {
697
697
  if (flag.length === 1) return `-${flag}`;
698
698
  return `--${flag}`;
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "6.0.0-beta.12";
3
+ version = "6.0.0-beta.14";
4
4
  }
5
5
  export {
6
6
  BuildTimeAstroVersionProvider
@@ -181,7 +181,7 @@ ${contentConfig.error.message}`
181
181
  logger.info("Content config changed");
182
182
  shouldClear = true;
183
183
  }
184
- if (previousAstroVersion && previousAstroVersion !== "6.0.0-beta.12") {
184
+ if (previousAstroVersion && previousAstroVersion !== "6.0.0-beta.14") {
185
185
  logger.info("Astro version changed");
186
186
  shouldClear = true;
187
187
  }
@@ -189,8 +189,8 @@ ${contentConfig.error.message}`
189
189
  logger.info("Clearing content store");
190
190
  this.#store.clearAll();
191
191
  }
192
- if ("6.0.0-beta.12") {
193
- await this.#store.metaStore().set("astro-version", "6.0.0-beta.12");
192
+ if ("6.0.0-beta.14") {
193
+ await this.#store.metaStore().set("astro-version", "6.0.0-beta.14");
194
194
  }
195
195
  if (currentConfigDigest) {
196
196
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -176,10 +176,10 @@ async function getEntryData(entry, collectionConfig, shouldEmitFile, pluginConte
176
176
  return data;
177
177
  }
178
178
  function getContentEntryExts(settings) {
179
- return settings.contentEntryTypes.map((t) => t.extensions).flat();
179
+ return settings.contentEntryTypes.flatMap((t) => t.extensions);
180
180
  }
181
181
  function getDataEntryExts(settings) {
182
- return settings.dataEntryTypes.map((t) => t.extensions).flat();
182
+ return settings.dataEntryTypes.flatMap((t) => t.extensions);
183
183
  }
184
184
  function getEntryConfigByExtMap(entryTypes) {
185
185
  const map = /* @__PURE__ */ new Map();
@@ -30,6 +30,7 @@ function invalidateDataStore(viteServer) {
30
30
  const timestamp = Date.now();
31
31
  environment.moduleGraph.invalidateModule(module, void 0, timestamp, true);
32
32
  }
33
+ environment.hot.send("astro:content-changed", {});
33
34
  viteServer.environments.client.hot.send({
34
35
  type: "full-reload",
35
36
  path: "*"
@@ -1,2 +1,2 @@
1
- import type { BaseApp } from '../../base.js';
2
- export declare function createApp(): BaseApp;
1
+ import type { CreateApp } from '../../types.js';
2
+ export declare const createApp: CreateApp;
@@ -2,9 +2,9 @@ import { manifest } from "virtual:astro:manifest";
2
2
  import { DevApp } from "../../dev/app.js";
3
3
  import { createConsoleLogger } from "../../logging.js";
4
4
  let currentDevApp = null;
5
- function createApp() {
5
+ const createApp = ({ streaming } = {}) => {
6
6
  const logger = createConsoleLogger(manifest.logLevel);
7
- currentDevApp = new DevApp(manifest, true, logger);
7
+ currentDevApp = new DevApp(manifest, streaming, logger);
8
8
  if (import.meta.hot) {
9
9
  import.meta.hot.on("astro:routes-updated", async () => {
10
10
  if (!currentDevApp) return;
@@ -19,9 +19,13 @@ function createApp() {
19
19
  ${e}`);
20
20
  }
21
21
  });
22
+ import.meta.hot.on("astro:content-changed", () => {
23
+ if (!currentDevApp) return;
24
+ currentDevApp.pipeline.routeCache.clearAll();
25
+ });
22
26
  }
23
27
  return currentDevApp;
24
- }
28
+ };
25
29
  export {
26
30
  createApp
27
31
  };
@@ -1,2 +1,2 @@
1
- import type { BaseApp } from '../../base.js';
2
- export declare const createApp: () => BaseApp;
1
+ import type { CreateApp } from '../../types.js';
2
+ export declare const createApp: CreateApp;
@@ -1,2 +1,2 @@
1
- import type { BaseApp } from '../../base.js';
2
- export declare function createApp(): BaseApp;
1
+ import type { CreateApp } from '../../types.js';
2
+ export declare const createApp: CreateApp;
@@ -1,8 +1,8 @@
1
1
  import { manifest } from "virtual:astro:manifest";
2
2
  import { App } from "../../app.js";
3
- function createApp() {
4
- return new App(manifest);
5
- }
3
+ const createApp = ({ streaming } = {}) => {
4
+ return new App(manifest, streaming);
5
+ };
6
6
  export {
7
7
  createApp
8
8
  };
@@ -9,6 +9,7 @@ import type { LoggerLevel } from '../logger/core.js';
9
9
  import type { RoutingStrategies } from './common.js';
10
10
  import type { BaseSessionConfig, SessionDriverFactory } from '../session/types.js';
11
11
  import type { DevToolbarPlacement } from '../../types/public/toolbar.js';
12
+ import type { BaseApp } from './base.js';
12
13
  type ComponentPath = string;
13
14
  export type StylesheetAsset = {
14
15
  type: 'inline';
@@ -168,4 +169,7 @@ export type NodeAppHeadersJson = {
168
169
  value: string;
169
170
  }[];
170
171
  }[];
172
+ export type CreateApp = (options?: {
173
+ streaming?: boolean;
174
+ }) => BaseApp;
171
175
  export {};
@@ -39,7 +39,9 @@ function validateForwardedHeaders(forwardedProtocol, forwardedHost, forwardedPor
39
39
  if (hasProtocolPatterns) {
40
40
  try {
41
41
  const testUrl = new URL(`${forwardedProtocol}://example.com`);
42
- const isAllowed = allowedDomains.some((pattern) => matchPattern(testUrl, pattern));
42
+ const isAllowed = allowedDomains.some(
43
+ (pattern) => matchPattern(testUrl, { protocol: pattern.protocol })
44
+ );
43
45
  if (isAllowed) {
44
46
  result.protocol = forwardedProtocol;
45
47
  }
@@ -181,7 +181,7 @@ async function generatePathWithPrerenderer(prerenderer, pathname, route, options
181
181
  if (routeData.pattern.test(pathname)) {
182
182
  if (routeData.params && routeData.params.length !== 0) {
183
183
  if (routeData.distURL && !routeData.distURL.find(
184
- (url2) => url2.href.replace(config.outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") == trimSlashes(pathname)
184
+ (url2) => url2.href.replace(config.outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") === trimSlashes(pathname)
185
185
  )) {
186
186
  return false;
187
187
  }
@@ -80,7 +80,7 @@ const AstroConfigSchema = z.object({
80
80
  adapter: z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }).optional(),
81
81
  integrations: z.preprocess(
82
82
  // preprocess
83
- (val) => Array.isArray(val) ? val.flat(Infinity).filter(Boolean) : val,
83
+ (val) => Array.isArray(val) ? val.flat(Number.POSITIVE_INFINITY).filter(Boolean) : val,
84
84
  // validate
85
85
  z.array(z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) })).default(ASTRO_CONFIG_DEFAULTS.integrations)
86
86
  ),
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "6.0.0-beta.12";
1
+ const ASTRO_VERSION = "6.0.0-beta.14";
2
2
  const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`;
3
3
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
4
4
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
@@ -49,6 +49,7 @@ import { vitePluginEnvironment } from "../vite-plugin-environment/index.js";
49
49
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "./constants.js";
50
50
  import { vitePluginChromedevtools } from "../vite-plugin-chromedevtools/index.js";
51
51
  import { vitePluginAstroServerClient } from "../vite-plugin-overlay/index.js";
52
+ import { vitePluginShikiStyles } from "../vite-plugin-shiki-styles/index.js";
52
53
  async function createVite(commandConfig, { settings, logger, mode, command, fs = nodeFs, sync, routesList }) {
53
54
  const astroPkgsConfig = await crawlFrameworkPkgs({
54
55
  root: fileURLToPath(settings.config.root),
@@ -90,7 +91,11 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
90
91
  appType: "custom",
91
92
  plugins: [
92
93
  serializedManifestPlugin({ settings, command, sync }),
93
- vitePluginRenderers({ settings }),
94
+ vitePluginRenderers({
95
+ settings,
96
+ routesList,
97
+ command: command === "dev" ? "serve" : "build"
98
+ }),
94
99
  vitePluginStaticPaths(),
95
100
  await astroPluginRoutes({ routesList, settings, logger, fsMod: fs, command }),
96
101
  astroVirtualManifestPlugin(),
@@ -130,7 +135,8 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
130
135
  vitePluginSessionDriver({ settings }),
131
136
  astroContainer(),
132
137
  astroHmrReloadPlugin(),
133
- vitePluginChromedevtools({ settings })
138
+ vitePluginChromedevtools({ settings }),
139
+ vitePluginShikiStyles()
134
140
  ],
135
141
  publicDir: fileURLToPath(settings.config.publicDir),
136
142
  root: fileURLToPath(settings.config.root),
@@ -202,7 +208,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
202
208
  { ...settings.config.vite, mode },
203
209
  { command: command === "dev" ? "serve" : command, mode }
204
210
  ];
205
- plugins = plugins.flat(Infinity).filter((p) => {
211
+ plugins = plugins.flat(Number.POSITIVE_INFINITY).filter((p) => {
206
212
  if (!p || p?.apply === applyToFilter) {
207
213
  return false;
208
214
  }
@@ -27,7 +27,7 @@ async function createContainer({
27
27
  base,
28
28
  server: { host, headers, open: serverOpen, allowedHosts }
29
29
  } = settings.config;
30
- const isServerOpenURL = typeof serverOpen == "string" && !isRestart;
30
+ const isServerOpenURL = typeof serverOpen === "string" && !isRestart;
31
31
  const isServerOpenBoolean = serverOpen && !isRestart;
32
32
  const open = isServerOpenURL ? serverOpen : isServerOpenBoolean ? base : false;
33
33
  const rendererClientEntries = settings.renderers.map((r) => r.clientEntrypoint).filter(Boolean);
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "6.0.0-beta.12";
25
+ const currentVersion = "6.0.0-beta.14";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -28,7 +28,7 @@ function serverStart({
28
28
  host,
29
29
  base
30
30
  }) {
31
- const version = "6.0.0-beta.12";
31
+ const version = "6.0.0-beta.14";
32
32
  const localPrefix = `${dim("\u2503")} Local `;
33
33
  const networkPrefix = `${dim("\u2503")} Network `;
34
34
  const emptyPrefix = " ".repeat(11);
@@ -265,7 +265,7 @@ function printHelp({
265
265
  message.push(
266
266
  linebreak(),
267
267
  ` ${bgGreen(black(` ${commandName} `))} ${green(
268
- `v${"6.0.0-beta.12"}`
268
+ `v${"6.0.0-beta.14"}`
269
269
  )} ${headline}`
270
270
  );
271
271
  }
@@ -31,12 +31,12 @@ function vitePluginAstroPreview(settings) {
31
31
  const isRoot = pathname === "/";
32
32
  if (!isRoot) {
33
33
  const hasTrailingSlash = pathname.endsWith("/");
34
- if (hasTrailingSlash && trailingSlash == "never") {
34
+ if (hasTrailingSlash && trailingSlash === "never") {
35
35
  res.statusCode = 404;
36
36
  res.end(notFoundTemplate(pathname, 'Not Found (trailingSlash is set to "never")'));
37
37
  return;
38
38
  }
39
- if (!hasTrailingSlash && trailingSlash == "always" && !HAS_FILE_EXTENSION_REGEXP.test(pathname)) {
39
+ if (!hasTrailingSlash && trailingSlash === "always" && !HAS_FILE_EXTENSION_REGEXP.test(pathname)) {
40
40
  res.statusCode = 404;
41
41
  res.end(notFoundTemplate(pathname, 'Not Found (trailingSlash is set to "always")'));
42
42
  return;
@@ -23,7 +23,7 @@ function generatePaginateFunction(routeMatch, base, trailingSlash) {
23
23
  const lastPage = Math.max(1, Math.ceil(data.length / pageSize));
24
24
  const result = [...Array(lastPage).keys()].map((num) => {
25
25
  const pageNum = num + 1;
26
- const start = pageSize === Infinity ? 0 : (pageNum - 1) * pageSize;
26
+ const start = pageSize === Number.POSITIVE_INFINITY ? 0 : (pageNum - 1) * pageSize;
27
27
  const end = Math.min(start + pageSize, data.length);
28
28
  const params = {
29
29
  ...additionalParams,
@@ -382,10 +382,12 @@ class RenderContext {
382
382
  },
383
383
  get csp() {
384
384
  if (!pipeline.manifest.csp) {
385
- pipeline.logger.warn(
386
- "csp",
387
- `context.csp was used when rendering the route ${colors.green(this.routePattern)}, but CSP was not configured. For more information, see https://docs.astro.build/en/reference/experimental-flags/csp/`
388
- );
385
+ if (pipeline.runtimeMode === "production") {
386
+ pipeline.logger.warn(
387
+ "csp",
388
+ `context.csp was used when rendering the route ${colors.green(this.routePattern)}, but CSP was not configured. For more information, see https://docs.astro.build/en/reference/experimental-flags/csp/`
389
+ );
390
+ }
389
391
  return void 0;
390
392
  }
391
393
  return {
@@ -601,10 +603,12 @@ class RenderContext {
601
603
  },
602
604
  get csp() {
603
605
  if (!pipeline.manifest.csp) {
604
- pipeline.logger.warn(
605
- "csp",
606
- `Astro.csp was used when rendering the route ${colors.green(this.routePattern)}, but CSP was not configured. For more information, see https://docs.astro.build/en/reference/experimental-flags/csp/`
607
- );
606
+ if (pipeline.runtimeMode === "production") {
607
+ pipeline.logger.warn(
608
+ "csp",
609
+ `Astro.csp was used when rendering the route ${colors.green(this.routePattern)}, but CSP was not configured. For more information, see https://docs.astro.build/en/reference/experimental-flags/csp/`
610
+ );
611
+ }
608
612
  return void 0;
609
613
  }
610
614
  return {
@@ -58,7 +58,7 @@ function findRouteToRewrite({
58
58
  if (route.pattern.test(decodedPathname)) {
59
59
  if (route.params && route.params.length !== 0 && route.distURL && route.distURL.length !== 0) {
60
60
  if (!route.distURL.find(
61
- (url) => url.href.replace(outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") == trimSlashes(pathname)
61
+ (url) => url.href.replace(outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") === trimSlashes(pathname)
62
62
  )) {
63
63
  continue;
64
64
  }
@@ -49,7 +49,7 @@ const stringValidator = ({ max, min, length, url, includes, startsWith, endsWith
49
49
  };
50
50
  };
51
51
  const numberValidator = ({ gt, min, lt, max, int }) => (input) => {
52
- const num = parseFloat(input ?? "");
52
+ const num = Number.parseFloat(input ?? "");
53
53
  if (isNaN(num)) {
54
54
  return {
55
55
  ok: false,