astro 4.16.7 → 4.16.8

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 CHANGED
@@ -289,6 +289,7 @@ declare module '*.mdx' {
289
289
  export const url: MDX['url'];
290
290
  export const getHeadings: MDX['getHeadings'];
291
291
  export const Content: MDX['Content'];
292
+ export const components: MDX['components'];
292
293
 
293
294
  const load: MDX['default'];
294
295
  export default load;
@@ -2458,7 +2458,9 @@ export interface MarkdownInstance<T extends Record<string, any>> {
2458
2458
  default: AstroComponentFactory;
2459
2459
  }
2460
2460
  type MD = MarkdownInstance<Record<string, any>>;
2461
- export type MDXInstance<T extends Record<string, any>> = Omit<MarkdownInstance<T>, 'rawContent' | 'compiledContent'>;
2461
+ export interface MDXInstance<T extends Record<string, any>> extends Omit<MarkdownInstance<T>, 'rawContent' | 'compiledContent'> {
2462
+ components: Record<string, AstroComponentFactory> | undefined;
2463
+ }
2462
2464
  export interface MarkdownLayoutProps<T extends Record<string, any>> {
2463
2465
  frontmatter: {
2464
2466
  file: MarkdownInstance<T>['file'];
@@ -2470,7 +2472,9 @@ export interface MarkdownLayoutProps<T extends Record<string, any>> {
2470
2472
  rawContent: MarkdownInstance<T>['rawContent'];
2471
2473
  compiledContent: MarkdownInstance<T>['compiledContent'];
2472
2474
  }
2473
- export type MDXLayoutProps<T extends Record<string, any>> = Omit<MarkdownLayoutProps<T>, 'rawContent' | 'compiledContent'>;
2475
+ export interface MDXLayoutProps<T extends Record<string, any>> extends Omit<MarkdownLayoutProps<T>, 'rawContent' | 'compiledContent'> {
2476
+ components: MDXInstance<T>['components'];
2477
+ }
2474
2478
  export type GetHydrateCallback = () => Promise<() => void | Promise<void>>;
2475
2479
  /**
2476
2480
  * getStaticPaths() options
@@ -63,7 +63,8 @@ async function handlePost({
63
63
  if (contentType && hasContentType(contentType, formContentTypes)) {
64
64
  formData = await request.clone().formData();
65
65
  }
66
- const action = baseAction.bind(context);
66
+ const { getActionResult, callAction, props, redirect, ...actionAPIContext } = context;
67
+ const action = baseAction.bind(actionAPIContext);
67
68
  const actionResult = await action(formData);
68
69
  if (context.url.searchParams.get(ACTION_QUERY_PARAMS.actionRedirect) === "false") {
69
70
  return renderResult({
@@ -23,7 +23,8 @@ const POST = async (context) => {
23
23
  } else {
24
24
  return new Response(null, { status: 415 });
25
25
  }
26
- const action = baseAction.bind(context);
26
+ const { getActionResult, callAction, props, redirect, ...actionAPIContext } = context;
27
+ const action = baseAction.bind(actionAPIContext);
27
28
  const result = await action(args);
28
29
  const serialized = serializeActionResult(result);
29
30
  if (serialized.type === "empty") {
@@ -1,7 +1,7 @@
1
1
  import { ActionNotFoundError } from "../../../core/errors/errors-data.js";
2
2
  import { AstroError } from "../../../core/errors/errors.js";
3
3
  async function getAction(path) {
4
- const pathKeys = path.replace("/_actions/", "").split(".").map((key) => decodeURIComponent(key));
4
+ const pathKeys = path.replace(/^.*\/_actions\//, "").split(".").map((key) => decodeURIComponent(key));
5
5
  let { server: actionLookup } = await import("astro:internal-actions");
6
6
  if (actionLookup == null || !(typeof actionLookup === "object")) {
7
7
  throw new TypeError(
package/dist/cli/index.js CHANGED
@@ -61,7 +61,7 @@ function resolveCommand(flags) {
61
61
  "db",
62
62
  "info",
63
63
  "login",
64
- "loutout",
64
+ "logout",
65
65
  "link",
66
66
  "init"
67
67
  ]);
@@ -109,7 +109,13 @@ ${message}`
109
109
  await exec(
110
110
  installCommand.pm,
111
111
  [installCommand.command, ...installCommand.flags, ...installCommand.dependencies],
112
- { nodeOptions: { cwd } }
112
+ {
113
+ nodeOptions: {
114
+ cwd,
115
+ // reset NODE_ENV to ensure install command run in dev mode
116
+ env: { NODE_ENV: void 0 }
117
+ }
118
+ }
113
119
  );
114
120
  spinner.succeed();
115
121
  return true;
@@ -121,7 +121,7 @@ class ContentLayer {
121
121
  logger.info("Content config changed");
122
122
  shouldClear = true;
123
123
  }
124
- if (previousAstroVersion !== "4.16.7") {
124
+ if (previousAstroVersion !== "4.16.8") {
125
125
  logger.info("Astro version changed");
126
126
  shouldClear = true;
127
127
  }
@@ -129,8 +129,8 @@ class ContentLayer {
129
129
  logger.info("Clearing content store");
130
130
  this.#store.clearAll();
131
131
  }
132
- if ("4.16.7") {
133
- await this.#store.metaStore().set("astro-version", "4.16.7");
132
+ if ("4.16.8") {
133
+ await this.#store.metaStore().set("astro-version", "4.16.8");
134
134
  }
135
135
  if (currentConfigDigest) {
136
136
  await this.#store.metaStore().set("config-digest", currentConfigDigest);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.16.7";
1
+ const ASTRO_VERSION = "4.16.8";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -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 = "4.16.7";
25
+ const currentVersion = "4.16.8";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -405,8 +405,8 @@ export declare const PageNumberParamNotFound: {
405
405
  * @docs
406
406
  * @see
407
407
  * - [Images](https://docs.astro.build/en/guides/images/)
408
- * - [Image component](https://docs.astro.build/en/guides/images/#image--astroassets)
409
- * - [Image component#alt](https://docs.astro.build/en/guides/images/#alt-required)
408
+ * - [Image component](https://docs.astro.build/en/reference/modules/astro-assets/#image-)
409
+ * - [Image component#alt](https://docs.astro.build/en/reference/modules/astro-assets/#alt-required)
410
410
  * @description
411
411
  * The `alt` property allows you to provide descriptive alt text to users of screen readers and other assistive technologies. In order to ensure your images are accessible, the `Image` component requires that an `alt` be specified.
412
412
  *
@@ -438,9 +438,9 @@ export declare const InvalidImageService: {
438
438
  * Missing width and height attributes for `IMAGE_URL`. When using remote images, both dimensions are required in order to avoid cumulative layout shift (CLS).
439
439
  * @see
440
440
  * - [Images](https://docs.astro.build/en/guides/images/)
441
- * - [Image component#width-and-height-required](https://docs.astro.build/en/guides/images/#width-and-height-required-for-images-in-public)
441
+ * - [Image component#width-and-height-required](https://docs.astro.build/en/reference/modules/astro-assets/#width-and-height-required-for-images-in-public)
442
442
  * @description
443
- * For remote images, `width` and `height` cannot automatically be inferred from the original file. To avoid cumulative layout shift (CLS), either specify these two properties, or set [`inferSize`](https://docs.astro.build/en/guides/images/#infersize) to `true` to fetch a remote image's original dimensions.
443
+ * For remote images, `width` and `height` cannot automatically be inferred from the original file. To avoid cumulative layout shift (CLS), either specify these two properties, or set [`inferSize`](https://docs.astro.build/en/reference/modules/astro-assets/#infersize) to `true` to fetch a remote image's original dimensions.
444
444
  *
445
445
  * If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets).
446
446
  */
@@ -841,7 +841,6 @@ export declare const InvalidDynamicRoute: {
841
841
  * @docs
842
842
  * @see
843
843
  * - [Default Image Service](https://docs.astro.build/en/guides/images/#default-image-service)
844
- * - [Image Component](https://docs.astro.build/en/guides/images/#image--astroassets)
845
844
  * - [Image Services API](https://docs.astro.build/en/reference/image-service-reference/)
846
845
  * @description
847
846
  * Sharp is the default image service used for `astro:assets`. When using a [strict package manager](https://pnpm.io/pnpm-vs-npm#npms-flat-tree) like pnpm, Sharp must be installed manually into your project in order to use image processing.
@@ -1419,7 +1418,7 @@ export declare const ActionsWithoutServerOutputError: {
1419
1418
  /**
1420
1419
  * @docs
1421
1420
  * @see
1422
- * - [Actions handler reference](https://docs.astro.build/en/reference/api-reference/#handler-property)
1421
+ * - [Actions handler reference](https://docs.astro.build/en/reference/modules/astro-actions/#handler-property)
1423
1422
  * @description
1424
1423
  * Action handler returned invalid data. Handlers should return serializable data types, and cannot return a Response object.
1425
1424
  */
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "4.16.7";
41
+ const version = "4.16.8";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -270,7 +270,7 @@ function printHelp({
270
270
  message.push(
271
271
  linebreak(),
272
272
  ` ${bgGreen(black(` ${commandName} `))} ${green(
273
- `v${"4.16.7"}`
273
+ `v${"4.16.8"}`
274
274
  )} ${headline}`
275
275
  );
276
276
  }
@@ -13,9 +13,8 @@ function vitePluginMiddleware({ settings }) {
13
13
  let userMiddlewareIsPresent = false;
14
14
  return {
15
15
  name: "@astro/plugin-middleware",
16
- config(opts, { command }) {
16
+ config(_, { command }) {
17
17
  isCommandBuild = command === "build";
18
- return opts;
19
18
  },
20
19
  async resolveId(id) {
21
20
  if (id === MIDDLEWARE_MODULE_ID) {
@@ -56,13 +56,15 @@ function validateSupportedFeatures(adapterName, featureMap, config, adapterFeatu
56
56
  );
57
57
  }
58
58
  }
59
- validationResult.envGetSecret = validateSupportKind(
60
- envGetSecret,
61
- adapterName,
62
- logger,
63
- "astro:env getSecret",
64
- () => config?.experimental?.env !== void 0
65
- );
59
+ if (config.experimental?.env) {
60
+ validationResult.envGetSecret = validateSupportKind(
61
+ envGetSecret,
62
+ adapterName,
63
+ logger,
64
+ "astro:env getSecret",
65
+ () => true
66
+ );
67
+ }
66
68
  return validationResult;
67
69
  }
68
70
  function validateSupportKind(supportKind, adapterName, logger, featureName, hasCorrectConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.16.7",
3
+ "version": "4.16.8",
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",
@@ -109,14 +109,14 @@
109
109
  ],
110
110
  "dependencies": {
111
111
  "@astrojs/compiler": "^2.10.3",
112
- "@babel/core": "^7.25.8",
113
- "@babel/plugin-transform-react-jsx": "^7.25.7",
114
- "@babel/types": "^7.25.8",
112
+ "@babel/core": "^7.26.0",
113
+ "@babel/plugin-transform-react-jsx": "^7.25.9",
114
+ "@babel/types": "^7.26.0",
115
115
  "@oslojs/encoding": "^1.1.0",
116
- "@rollup/pluginutils": "^5.1.2",
116
+ "@rollup/pluginutils": "^5.1.3",
117
117
  "@types/babel__core": "^7.20.5",
118
118
  "@types/cookie": "^0.6.0",
119
- "acorn": "^8.13.0",
119
+ "acorn": "^8.14.0",
120
120
  "aria-query": "^5.3.2",
121
121
  "axobject-query": "^4.1.0",
122
122
  "boxen": "8.0.1",
@@ -154,18 +154,18 @@
154
154
  "prompts": "^2.4.2",
155
155
  "rehype": "^13.0.2",
156
156
  "semver": "^7.6.3",
157
- "shiki": "^1.22.0",
157
+ "shiki": "^1.22.2",
158
158
  "tinyexec": "^0.3.1",
159
159
  "tsconfck": "^3.1.4",
160
160
  "unist-util-visit": "^5.0.0",
161
161
  "vfile": "^6.0.3",
162
- "vite": "^5.4.9",
162
+ "vite": "^5.4.10",
163
163
  "vitefu": "^1.0.3",
164
164
  "which-pm": "^3.0.0",
165
165
  "xxhash-wasm": "^1.0.2",
166
166
  "yargs-parser": "^21.1.1",
167
167
  "zod": "^3.23.8",
168
- "zod-to-json-schema": "^3.23.3",
168
+ "zod-to-json-schema": "^3.23.5",
169
169
  "zod-to-ts": "^1.2.0",
170
170
  "@astrojs/internal-helpers": "0.4.1",
171
171
  "@astrojs/markdown-remark": "5.3.0",
@@ -176,7 +176,7 @@
176
176
  },
177
177
  "devDependencies": {
178
178
  "@astrojs/check": "^0.9.4",
179
- "@playwright/test": "^1.48.1",
179
+ "@playwright/test": "^1.48.2",
180
180
  "@types/aria-query": "^5.0.4",
181
181
  "@types/common-ancestor-path": "^1.0.2",
182
182
  "@types/cssesc": "^3.0.2",
@@ -204,8 +204,8 @@
204
204
  "rehype-slug": "^6.0.0",
205
205
  "rehype-toc": "^3.0.2",
206
206
  "remark-code-titles": "^0.1.2",
207
- "rollup": "^4.24.0",
208
- "sass": "^1.80.3",
207
+ "rollup": "^4.24.2",
208
+ "sass": "^1.80.4",
209
209
  "undici": "^6.20.1",
210
210
  "unified": "^11.0.5",
211
211
  "astro-scripts": "0.0.14"
@@ -92,7 +92,7 @@ async function handleAction(param, path, context) {
92
92
  headers.set('Content-Length', '0');
93
93
  }
94
94
  }
95
- const rawResult = await fetch(`/_actions/${path}`, {
95
+ const rawResult = await fetch(`${import.meta.env.BASE_URL.replace(/\/$/, '')}/_actions/${path}`, {
96
96
  method: 'POST',
97
97
  body,
98
98
  headers,