astro 6.1.4 → 6.1.5

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.
@@ -1,6 +1,8 @@
1
1
  export declare const VIRTUAL_MODULE_ID = "astro:assets";
2
2
  export declare const RESOLVED_VIRTUAL_MODULE_ID: string;
3
3
  export declare const VIRTUAL_SERVICE_ID = "virtual:image-service";
4
+ export declare const VIRTUAL_GET_IMAGE_ID = "virtual:astro:get-image";
5
+ export declare const RESOLVED_VIRTUAL_GET_IMAGE_ID: string;
4
6
  export declare const VIRTUAL_IMAGE_STYLES_ID = "virtual:astro:image-styles.css";
5
7
  export declare const RESOLVED_VIRTUAL_IMAGE_STYLES_ID: string;
6
8
  export declare const VALID_INPUT_FORMATS: readonly ["jpeg", "jpg", "png", "tiff", "webp", "gif", "svg", "avif"];
@@ -1,6 +1,8 @@
1
1
  const VIRTUAL_MODULE_ID = "astro:assets";
2
2
  const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
3
3
  const VIRTUAL_SERVICE_ID = "virtual:image-service";
4
+ const VIRTUAL_GET_IMAGE_ID = "virtual:astro:get-image";
5
+ const RESOLVED_VIRTUAL_GET_IMAGE_ID = "\0" + VIRTUAL_GET_IMAGE_ID;
4
6
  const VIRTUAL_IMAGE_STYLES_ID = "virtual:astro:image-styles.css";
5
7
  const RESOLVED_VIRTUAL_IMAGE_STYLES_ID = "\0" + VIRTUAL_IMAGE_STYLES_ID;
6
8
  const VALID_INPUT_FORMATS = [
@@ -38,11 +40,13 @@ const DEFAULT_HASH_PROPS = [
38
40
  export {
39
41
  DEFAULT_HASH_PROPS,
40
42
  DEFAULT_OUTPUT_FORMAT,
43
+ RESOLVED_VIRTUAL_GET_IMAGE_ID,
41
44
  RESOLVED_VIRTUAL_IMAGE_STYLES_ID,
42
45
  RESOLVED_VIRTUAL_MODULE_ID,
43
46
  VALID_INPUT_FORMATS,
44
47
  VALID_OUTPUT_FORMATS,
45
48
  VALID_SUPPORTED_FORMATS,
49
+ VIRTUAL_GET_IMAGE_ID,
46
50
  VIRTUAL_IMAGE_STYLES_ID,
47
51
  VIRTUAL_MODULE_ID,
48
52
  VIRTUAL_SERVICE_ID
@@ -13,9 +13,11 @@ import { normalizePath } from "../core/viteUtils.js";
13
13
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
14
14
  import { isAstroServerEnvironment } from "../environments.js";
15
15
  import {
16
+ RESOLVED_VIRTUAL_GET_IMAGE_ID,
16
17
  RESOLVED_VIRTUAL_IMAGE_STYLES_ID,
17
18
  RESOLVED_VIRTUAL_MODULE_ID,
18
19
  VALID_INPUT_FORMATS,
20
+ VIRTUAL_GET_IMAGE_ID,
19
21
  VIRTUAL_IMAGE_STYLES_ID,
20
22
  VIRTUAL_MODULE_ID,
21
23
  VIRTUAL_SERVICE_ID
@@ -99,7 +101,7 @@ function assets({ fs, settings, sync, logger }) {
99
101
  },
100
102
  resolveId: {
101
103
  filter: {
102
- id: new RegExp(`^(${VIRTUAL_SERVICE_ID}|${VIRTUAL_MODULE_ID})$`)
104
+ id: new RegExp(`^(${VIRTUAL_SERVICE_ID}|${VIRTUAL_MODULE_ID}|${VIRTUAL_GET_IMAGE_ID})$`)
103
105
  },
104
106
  async handler(id) {
105
107
  if (id === VIRTUAL_SERVICE_ID) {
@@ -111,13 +113,41 @@ function assets({ fs, settings, sync, logger }) {
111
113
  if (id === VIRTUAL_MODULE_ID) {
112
114
  return RESOLVED_VIRTUAL_MODULE_ID;
113
115
  }
116
+ if (id === VIRTUAL_GET_IMAGE_ID) {
117
+ return RESOLVED_VIRTUAL_GET_IMAGE_ID;
118
+ }
114
119
  }
115
120
  },
116
121
  load: {
117
122
  filter: {
118
- id: new RegExp(`^(${RESOLVED_VIRTUAL_MODULE_ID})$`)
123
+ id: new RegExp(`^(${RESOLVED_VIRTUAL_MODULE_ID}|${RESOLVED_VIRTUAL_GET_IMAGE_ID})$`)
119
124
  },
120
- handler() {
125
+ handler(id) {
126
+ if (id === RESOLVED_VIRTUAL_GET_IMAGE_ID) {
127
+ const isServerEnvironment2 = isAstroServerEnvironment(this.environment);
128
+ const getImageExport2 = isServerEnvironment2 ? `import { getImage as getImageInternal } from "astro/assets";
129
+ export const getImage = async (options) => await getImageInternal(options, imageConfig);` : `import { AstroError, AstroErrorData } from "astro/errors";
130
+ export const getImage = async () => {
131
+ throw new AstroError(
132
+ AstroErrorData.GetImageNotUsedOnServer.message,
133
+ AstroErrorData.GetImageNotUsedOnServer.hint,
134
+ );
135
+ };`;
136
+ const assetQueryParams = settings.adapter?.client?.assetQueryParams ? `new URLSearchParams(${JSON.stringify(
137
+ Array.from(settings.adapter.client.assetQueryParams.entries())
138
+ )})` : "undefined";
139
+ return {
140
+ code: `
141
+ export const imageConfig = ${JSON.stringify(settings.config.image)};
142
+ Object.defineProperty(imageConfig, 'assetQueryParams', {
143
+ value: ${assetQueryParams},
144
+ enumerable: false,
145
+ configurable: true,
146
+ });
147
+ ${getImageExport2}
148
+ `
149
+ };
150
+ }
121
151
  const isServerEnvironment = isAstroServerEnvironment(this.environment);
122
152
  const getImageExport = isServerEnvironment ? `import { getImage as getImageInternal } from "astro/assets";
123
153
  export const getImage = async (options) => await getImageInternal(options, imageConfig);` : `import { AstroError, AstroErrorData } from "astro/errors";
@@ -1,5 +1,4 @@
1
1
  import fsMod, { existsSync, promises as fs } from "node:fs";
2
- import { createRequire } from "node:module";
3
2
  import path from "node:path";
4
3
  import { fileURLToPath, pathToFileURL } from "node:url";
5
4
  import * as clack from "@clack/prompts";
@@ -182,16 +181,7 @@ async function add(names, { flags }) {
182
181
  );
183
182
  if (await askToContinue({ flags, logger })) {
184
183
  const data = await getPackageJson();
185
- let compatibilityDate;
186
- try {
187
- const require2 = createRequire(root);
188
- const { getLocalWorkerdCompatibilityDate } = await import(require2.resolve("@astrojs/cloudflare/info"));
189
- ({ date: compatibilityDate } = getLocalWorkerdCompatibilityDate({
190
- projectPath: rootPath
191
- }));
192
- } catch {
193
- compatibilityDate = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
194
- }
184
+ let compatibilityDate = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
195
185
  await fs.writeFile(
196
186
  wranglerConfigURL,
197
187
  STUBS.CLOUDFLARE_WRANGLER_CONFIG(data?.name ?? "example", compatibilityDate),
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "6.1.4";
3
+ version = "6.1.5";
4
4
  }
5
5
  export {
6
6
  BuildTimeAstroVersionProvider
@@ -1,6 +1,5 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import { formatWithOptions } from "node:util";
3
- import dlv from "dlv";
4
3
  import { flattie } from "flattie";
5
4
  import colors from "piccolore";
6
5
  import { resolveConfig } from "../../core/config/config.js";
@@ -8,6 +7,7 @@ import { createSettings } from "../../core/config/settings.js";
8
7
  import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
9
8
  import * as msg from "../../core/messages/runtime.js";
10
9
  import { DEFAULT_PREFERENCES } from "../../preferences/defaults.js";
10
+ import dlv from "../../preferences/dlv.js";
11
11
  import { coerce, isValidKey } from "../../preferences/index.js";
12
12
  import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
13
13
  const { bgGreen, black, bold, dim, yellow } = colors;
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
192
192
  logger.info("Content config changed");
193
193
  shouldClear = true;
194
194
  }
195
- if (previousAstroVersion && previousAstroVersion !== "6.1.4") {
195
+ if (previousAstroVersion && previousAstroVersion !== "6.1.5") {
196
196
  logger.info("Astro version changed");
197
197
  shouldClear = true;
198
198
  }
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
200
200
  logger.info("Clearing content store");
201
201
  this.#store.clearAll();
202
202
  }
203
- if ("6.1.4") {
204
- this.#store.metaStore().set("astro-version", "6.1.4");
203
+ if ("6.1.5") {
204
+ this.#store.metaStore().set("astro-version", "6.1.5");
205
205
  }
206
206
  if (currentConfigDigest) {
207
207
  this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -318,7 +318,7 @@ const CONTENT_LAYER_IMAGE_REGEX = /__ASTRO_IMAGE_="([^"]+)"/g;
318
318
  async function updateImageReferencesInBody(html, fileName) {
319
319
  const { default: imageAssetMap } = await import("astro:asset-imports");
320
320
  const imageObjects = /* @__PURE__ */ new Map();
321
- const { getImage } = await import("astro:assets");
321
+ const { getImage } = await import("virtual:astro:get-image");
322
322
  for (const [_full, imagePath] of html.matchAll(CONTENT_LAYER_IMAGE_REGEX)) {
323
323
  try {
324
324
  const decodedImagePath = JSON.parse(imagePath.replaceAll(""", '"'));
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "6.1.4";
1
+ const ASTRO_VERSION = "6.1.5";
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";
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
37
37
  await telemetry.record([]);
38
38
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
39
39
  const logger = restart.container.logger;
40
- const currentVersion = "6.1.4";
40
+ const currentVersion = "6.1.5";
41
41
  const isPrerelease = currentVersion.includes("-");
42
42
  if (!isPrerelease) {
43
43
  try {
@@ -276,7 +276,7 @@ function printHelp({
276
276
  message.push(
277
277
  linebreak(),
278
278
  ` ${bgGreen(black(` ${commandName} `))} ${green(
279
- `v${"6.1.4"}`
279
+ `v${"6.1.5"}`
280
280
  )} ${headline}`
281
281
  );
282
282
  }
@@ -1,6 +1,6 @@
1
1
  import type { AstroConfig } from '../types/public/index.js';
2
2
  import type { EnvFieldType } from './schema.js';
3
- export type ValidationResultValue = EnvFieldType['default'];
3
+ type ValidationResultValue = EnvFieldType['default'];
4
4
  export type ValidationResultErrors = ['missing'] | ['type'] | Array<string>;
5
5
  interface ValidationResultValid {
6
6
  ok: true;
@@ -0,0 +1 @@
1
+ export default function dlv(obj: Record<string, unknown>, key: string): any;
@@ -0,0 +1,9 @@
1
+ function dlv(obj, key) {
2
+ for (const k of key.split(".")) {
3
+ obj = obj?.[k];
4
+ }
5
+ return obj;
6
+ }
7
+ export {
8
+ dlv as default
9
+ };
@@ -2,8 +2,8 @@ import os from "node:os";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import { fileURLToPath } from "node:url";
5
- import dget from "dlv";
6
5
  import { DEFAULT_PREFERENCES } from "./defaults.js";
6
+ import dget from "./dlv.js";
7
7
  import { PreferenceStore } from "./store.js";
8
8
  function isValidKey(key) {
9
9
  return dget(DEFAULT_PREFERENCES, key) !== void 0;
@@ -1,8 +1,8 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import dget from "dlv";
4
3
  import { dset } from "dset";
5
4
  import { SETTINGS_FILE } from "./constants.js";
5
+ import dget from "./dlv.js";
6
6
  class PreferenceStore {
7
7
  dir;
8
8
  file;
@@ -18,7 +18,7 @@ import { componentIsHTMLElement, renderHTMLElement } from "./dom.js";
18
18
  import { maybeRenderHead } from "./head.js";
19
19
  import { createRenderInstruction } from "./instruction.js";
20
20
  import { containsServerDirective, ServerIslandComponent } from "./server-islands.js";
21
- import { renderSlots, renderSlotToString } from "./slot.js";
21
+ import { renderSlot, renderSlots, renderSlotToString } from "./slot.js";
22
22
  import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from "./util.js";
23
23
  const needsHeadRenderingSymbol = /* @__PURE__ */ Symbol.for("astro.needsHeadRendering");
24
24
  const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
@@ -331,12 +331,12 @@ function sanitizeElementName(tag) {
331
331
  if (!unsafe.test(tag)) return tag;
332
332
  return tag.trim().split(unsafe)[0].trim();
333
333
  }
334
- async function renderFragmentComponent(result, slots = {}) {
335
- const children = await renderSlotToString(result, slots?.default);
334
+ function renderFragmentComponent(result, slots = {}) {
335
+ const slot = slots?.default;
336
336
  return {
337
337
  render(destination) {
338
- if (children == null) return;
339
- destination.write(children);
338
+ if (slot == null) return;
339
+ return renderSlot(result, slot).render(destination);
340
340
  }
341
341
  };
342
342
  }
@@ -370,7 +370,7 @@ function renderComponent(result, displayName, Component, props, slots = {}) {
370
370
  });
371
371
  }
372
372
  if (isFragmentComponent(Component)) {
373
- return renderFragmentComponent(result, slots).catch(handleCancellation);
373
+ return renderFragmentComponent(result, slots);
374
374
  }
375
375
  props = normalizeProps(props);
376
376
  if (isHTMLComponent(Component)) {
@@ -118,7 +118,7 @@ const persistedHeadElement = (el, newDoc) => {
118
118
  }
119
119
  if (import.meta.env.DEV && el.tagName === "STYLE") {
120
120
  const viteDevId = el.getAttribute("data-vite-dev-id");
121
- if (viteDevId) {
121
+ if (/\?vue&type=style&.*lang.css$/.test(viteDevId || "")) {
122
122
  return newDoc.head.querySelector(`style[data-vite-dev-id="${viteDevId}"]`);
123
123
  }
124
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "6.1.4",
3
+ "version": "6.1.5",
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",
@@ -114,7 +114,6 @@
114
114
  "cookie": "^1.1.1",
115
115
  "devalue": "^5.6.3",
116
116
  "diff": "^8.0.3",
117
- "dlv": "^1.1.3",
118
117
  "dset": "^3.1.4",
119
118
  "es-module-lexer": "^2.0.0",
120
119
  "esbuild": "^0.27.3",
@@ -153,9 +152,9 @@
153
152
  "xxhash-wasm": "^1.1.0",
154
153
  "yargs-parser": "^22.0.0",
155
154
  "zod": "^4.3.6",
156
- "@astrojs/internal-helpers": "0.8.0",
157
155
  "@astrojs/markdown-remark": "7.1.0",
158
- "@astrojs/telemetry": "3.3.0"
156
+ "@astrojs/telemetry": "3.3.0",
157
+ "@astrojs/internal-helpers": "0.8.0"
159
158
  },
160
159
  "optionalDependencies": {
161
160
  "sharp": "^0.34.0"
@@ -164,7 +163,6 @@
164
163
  "@astrojs/compiler-rs": "^0.1.6",
165
164
  "@playwright/test": "1.58.2",
166
165
  "@types/aria-query": "^5.0.4",
167
- "@types/dlv": "^1.1.5",
168
166
  "@types/hast": "^3.0.4",
169
167
  "@types/html-escaper": "3.0.4",
170
168
  "@types/http-cache-semantics": "^4.2.0",