astro 6.1.3 → 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.
Files changed (50) hide show
  1. package/dist/assets/consts.d.ts +2 -0
  2. package/dist/assets/consts.js +4 -0
  3. package/dist/assets/utils/index.d.ts +1 -1
  4. package/dist/assets/utils/index.js +1 -9
  5. package/dist/assets/utils/vendor/image-size/utils/bit-reader.d.ts +2 -2
  6. package/dist/assets/utils/vendor/image-size/utils/bit-reader.js +5 -3
  7. package/dist/assets/vite-plugin-assets.js +33 -3
  8. package/dist/cli/add/index.js +38 -55
  9. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  10. package/dist/cli/preferences/index.js +1 -1
  11. package/dist/content/content-layer.js +3 -3
  12. package/dist/content/loaders/errors.d.ts +2 -2
  13. package/dist/content/loaders/errors.js +3 -0
  14. package/dist/content/runtime.js +1 -1
  15. package/dist/core/app/base.js +1 -1
  16. package/dist/core/base-pipeline.d.ts +22 -35
  17. package/dist/core/base-pipeline.js +41 -8
  18. package/dist/core/build/generate.js +9 -1
  19. package/dist/core/build/pipeline.d.ts +3 -7
  20. package/dist/core/build/pipeline.js +30 -28
  21. package/dist/core/config/schemas/refined-validators.d.ts +44 -0
  22. package/dist/core/config/schemas/refined-validators.js +168 -0
  23. package/dist/core/config/schemas/refined.js +28 -141
  24. package/dist/core/constants.js +1 -1
  25. package/dist/core/cookies/cookies.js +1 -0
  26. package/dist/core/dev/dev.js +1 -1
  27. package/dist/core/dev/restart.js +63 -68
  28. package/dist/core/messages/runtime.js +1 -1
  29. package/dist/core/render-context.d.ts +2 -2
  30. package/dist/core/render-context.js +20 -0
  31. package/dist/core/routing/create-manifest.js +12 -4
  32. package/dist/core/routing/default.d.ts +2 -3
  33. package/dist/env/validators.d.ts +1 -1
  34. package/dist/integrations/features-validation.d.ts +3 -1
  35. package/dist/integrations/features-validation.js +2 -0
  36. package/dist/preferences/dlv.d.ts +1 -0
  37. package/dist/preferences/dlv.js +9 -0
  38. package/dist/preferences/index.js +1 -1
  39. package/dist/preferences/store.js +3 -2
  40. package/dist/runtime/server/render/component.js +6 -6
  41. package/dist/runtime/server/transition.d.ts +2 -2
  42. package/dist/runtime/server/transition.js +4 -2
  43. package/dist/transitions/swap-functions.js +1 -1
  44. package/dist/vite-plugin-app/pipeline.d.ts +4 -13
  45. package/dist/vite-plugin-app/pipeline.js +27 -12
  46. package/dist/vite-plugin-astro-server/base.d.ts +52 -0
  47. package/dist/vite-plugin-astro-server/base.js +66 -36
  48. package/dist/vite-plugin-astro-server/trailing-slash.d.ts +34 -0
  49. package/dist/vite-plugin-astro-server/trailing-slash.js +24 -11
  50. package/package.json +3 -5
@@ -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
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * If some functions don't need to be exposed, just import the file that contains the functions.
6
6
  */
7
- export { isRemoteAllowed, matchHostname, matchPathname, matchPattern, matchPort, matchProtocol, type RemotePattern, } from '@astrojs/internal-helpers/remote';
7
+ export { isRemoteAllowed, matchPattern, type RemotePattern, } from '@astrojs/internal-helpers/remote';
8
8
  export { emitClientAsset } from './assets.js';
9
9
  export { isESMImportedImage, isRemoteImage, resolveSrc } from './imageKind.js';
10
10
  export { imageMetadata } from './metadata.js';
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  isRemoteAllowed,
3
- matchHostname,
4
- matchPathname,
5
- matchPattern,
6
- matchPort,
7
- matchProtocol
3
+ matchPattern
8
4
  } from "@astrojs/internal-helpers/remote";
9
5
  import { emitClientAsset } from "./assets.js";
10
6
  import { isESMImportedImage, isRemoteImage, resolveSrc } from "./imageKind.js";
@@ -19,10 +15,6 @@ export {
19
15
  isESMImportedImage,
20
16
  isRemoteAllowed,
21
17
  isRemoteImage,
22
- matchHostname,
23
- matchPathname,
24
18
  matchPattern,
25
- matchPort,
26
- matchProtocol,
27
19
  resolveSrc
28
20
  };
@@ -1,9 +1,9 @@
1
1
  /** This class helps read Uint8Array bit-by-bit */
2
2
  export declare class BitReader {
3
- private readonly input;
4
- private readonly endianness;
5
3
  private byteOffset;
6
4
  private bitOffset;
5
+ private readonly input;
6
+ private readonly endianness;
7
7
  constructor(input: Uint8Array, endianness: 'big-endian' | 'little-endian');
8
8
  /** Reads a specified number of bits, and move the offset */
9
9
  getBits(length?: number): number;
@@ -1,11 +1,13 @@
1
1
  class BitReader {
2
+ // Skip the first 16 bits (2 bytes) of signature
3
+ byteOffset = 2;
4
+ bitOffset = 0;
5
+ input;
6
+ endianness;
2
7
  constructor(input, endianness) {
3
8
  this.input = input;
4
9
  this.endianness = endianness;
5
10
  }
6
- // Skip the first 16 bits (2 bytes) of signature
7
- byteOffset = 2;
8
- bitOffset = 0;
9
11
  /** Reads a specified number of bits, and move the offset */
10
12
  getBits(length = 1) {
11
13
  let result = 0;
@@ -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";
@@ -170,7 +169,7 @@ async function add(names, { flags }) {
170
169
  return null;
171
170
  }
172
171
  switch (installResult) {
173
- case 1 /* updated */: {
172
+ case "updated": {
174
173
  if (hasCloudflareIntegration) {
175
174
  const wranglerConfigURL = new URL("./wrangler.jsonc", configURL);
176
175
  if (!existsSync(wranglerConfigURL)) {
@@ -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),
@@ -332,7 +322,7 @@ ${gitignoreEntry}
332
322
  }
333
323
  break;
334
324
  }
335
- case 2 /* cancelled */: {
325
+ case "cancelled": {
336
326
  logger.info(
337
327
  "SKIP_FORMAT",
338
328
  msg.cancelled(
@@ -342,10 +332,10 @@ ${gitignoreEntry}
342
332
  );
343
333
  break;
344
334
  }
345
- case 3 /* failure */: {
335
+ case "failure": {
346
336
  throw createPrettyError(new Error(`Unable to install dependencies`));
347
337
  }
348
- case 0 /* none */:
338
+ case "none":
349
339
  break;
350
340
  }
351
341
  let mod;
@@ -402,14 +392,14 @@ ${gitignoreEntry}
402
392
  }
403
393
  }
404
394
  switch (configResult) {
405
- case 2 /* cancelled */: {
395
+ case "cancelled": {
406
396
  logger.info(
407
397
  "SKIP_FORMAT",
408
398
  msg.cancelled(`Your configuration has ${bold("NOT")} been updated.`)
409
399
  );
410
400
  break;
411
401
  }
412
- case 0 /* none */: {
402
+ case "none": {
413
403
  const data = await getPackageJson();
414
404
  if (data) {
415
405
  const { dependencies = {}, devDependencies = {} } = data;
@@ -426,9 +416,9 @@ ${gitignoreEntry}
426
416
  break;
427
417
  }
428
418
  // NOTE: failure shouldn't happen in practice because `updateAstroConfig` doesn't return that.
429
- // Pipe this to the same handling as `UpdateResult.updated` for now.
430
- case 3 /* failure */:
431
- case 1 /* updated */:
419
+ // Pipe this to the same handling as `'updated'` for now.
420
+ case "failure":
421
+ case "updated":
432
422
  case void 0: {
433
423
  const list = integrations.map((integration) => ` - ${integration.integrationName}`).join("\n");
434
424
  logger.info(
@@ -461,22 +451,22 @@ ${list}`
461
451
  addIncludes: hasCloudflareIntegration ? ["./worker-configuration.d.ts"] : []
462
452
  });
463
453
  switch (updateTSConfigResult) {
464
- case 0 /* none */: {
454
+ case "none": {
465
455
  break;
466
456
  }
467
- case 2 /* cancelled */: {
457
+ case "cancelled": {
468
458
  logger.info(
469
459
  "SKIP_FORMAT",
470
460
  msg.cancelled(`Your TypeScript configuration has ${bold("NOT")} been updated.`)
471
461
  );
472
462
  break;
473
463
  }
474
- case 3 /* failure */: {
464
+ case "failure": {
475
465
  throw new Error(
476
466
  `Unknown error parsing tsconfig.json or jsconfig.json. Could not update TypeScript settings.`
477
467
  );
478
468
  }
479
- case 1 /* updated */:
469
+ case "updated":
480
470
  logger.info("SKIP_FORMAT", msg.success(`Successfully updated tsconfig`));
481
471
  }
482
472
  }
@@ -548,13 +538,6 @@ function setAdapter(mod, adapter, exportName) {
548
538
  break;
549
539
  }
550
540
  }
551
- var UpdateResult = /* @__PURE__ */ ((UpdateResult2) => {
552
- UpdateResult2[UpdateResult2["none"] = 0] = "none";
553
- UpdateResult2[UpdateResult2["updated"] = 1] = "updated";
554
- UpdateResult2[UpdateResult2["cancelled"] = 2] = "cancelled";
555
- UpdateResult2[UpdateResult2["failure"] = 3] = "failure";
556
- return UpdateResult2;
557
- })(UpdateResult || {});
558
541
  async function updateAstroConfig({
559
542
  configURL,
560
543
  mod,
@@ -571,11 +554,11 @@ async function updateAstroConfig({
571
554
  }
572
555
  }).code;
573
556
  if (input === output) {
574
- return 0 /* none */;
557
+ return "none";
575
558
  }
576
559
  const diff = getDiffContent(input, output);
577
560
  if (!diff) {
578
- return 0 /* none */;
561
+ return "none";
579
562
  }
580
563
  logger.info(
581
564
  "SKIP_FORMAT",
@@ -602,9 +585,9 @@ async function updateAstroConfig({
602
585
  if (await askToContinue({ flags, logger })) {
603
586
  await fs.writeFile(fileURLToPath(configURL), output, { encoding: "utf-8" });
604
587
  logger.debug("add", `Updated astro config`);
605
- return 1 /* updated */;
588
+ return "updated";
606
589
  } else {
607
- return 2 /* cancelled */;
590
+ return "cancelled";
608
591
  }
609
592
  }
610
593
  async function updatePackageJsonOverrides({
@@ -616,7 +599,7 @@ async function updatePackageJsonOverrides({
616
599
  const pkgURL = new URL("./package.json", configURL);
617
600
  if (!existsSync(pkgURL)) {
618
601
  logger.debug("add", "No package.json found, skipping overrides update");
619
- return 0 /* none */;
602
+ return "none";
620
603
  }
621
604
  const pkgPath = fileURLToPath(pkgURL);
622
605
  const input = await fs.readFile(pkgPath, { encoding: "utf-8" });
@@ -630,12 +613,12 @@ async function updatePackageJsonOverrides({
630
613
  }
631
614
  }
632
615
  if (!hasChanges) {
633
- return 0 /* none */;
616
+ return "none";
634
617
  }
635
618
  const output = JSON.stringify(pkgJson, null, 2);
636
619
  const diff = getDiffContent(input, output);
637
620
  if (!diff) {
638
- return 0 /* none */;
621
+ return "none";
639
622
  }
640
623
  logger.info(
641
624
  "SKIP_FORMAT",
@@ -650,9 +633,9 @@ async function updatePackageJsonOverrides({
650
633
  if (await askToContinue({ flags, logger })) {
651
634
  await fs.writeFile(pkgPath, output, { encoding: "utf-8" });
652
635
  logger.debug("add", "Updated package.json overrides");
653
- return 1 /* updated */;
636
+ return "updated";
654
637
  } else {
655
- return 2 /* cancelled */;
638
+ return "cancelled";
656
639
  }
657
640
  }
658
641
  async function updatePackageJsonScripts({
@@ -664,7 +647,7 @@ async function updatePackageJsonScripts({
664
647
  const pkgURL = new URL("./package.json", configURL);
665
648
  if (!existsSync(pkgURL)) {
666
649
  logger.debug("add", "No package.json found, skipping scripts update");
667
- return 0 /* none */;
650
+ return "none";
668
651
  }
669
652
  const pkgPath = fileURLToPath(pkgURL);
670
653
  const input = await fs.readFile(pkgPath, { encoding: "utf-8" });
@@ -678,12 +661,12 @@ async function updatePackageJsonScripts({
678
661
  }
679
662
  }
680
663
  if (!hasChanges) {
681
- return 0 /* none */;
664
+ return "none";
682
665
  }
683
666
  const output = JSON.stringify(pkgJson, null, 2);
684
667
  const diff = getDiffContent(input, output);
685
668
  if (!diff) {
686
- return 0 /* none */;
669
+ return "none";
687
670
  }
688
671
  logger.info(
689
672
  "SKIP_FORMAT",
@@ -698,9 +681,9 @@ async function updatePackageJsonScripts({
698
681
  if (await askToContinue({ flags, logger })) {
699
682
  await fs.writeFile(pkgPath, output, { encoding: "utf-8" });
700
683
  logger.debug("add", "Updated package.json scripts");
701
- return 1 /* updated */;
684
+ return "updated";
702
685
  } else {
703
- return 2 /* cancelled */;
686
+ return "cancelled";
704
687
  }
705
688
  }
706
689
  async function convertIntegrationsToInstallSpecifiers(integrations) {
@@ -744,7 +727,7 @@ async function tryToInstallIntegrations({
744
727
  strategies: ["install-metadata", "lockfile", "packageManager-field"]
745
728
  });
746
729
  logger.debug("add", `package manager: "${packageManager?.name}"`);
747
- if (!packageManager) return 0 /* none */;
730
+ if (!packageManager) return "none";
748
731
  const inheritedFlags = Object.entries(flags).map(([flag]) => {
749
732
  if (flag === "_") return;
750
733
  if (INHERITED_FLAGS.has(flag)) {
@@ -753,7 +736,7 @@ async function tryToInstallIntegrations({
753
736
  }
754
737
  }).filter(Boolean).flat();
755
738
  const installCommand = resolveCommand(packageManager?.agent ?? "npm", "add", inheritedFlags);
756
- if (!installCommand) return 0 /* none */;
739
+ if (!installCommand) return "none";
757
740
  const installSpecifiers = await convertIntegrationsToInstallSpecifiers(integrations).then(
758
741
  (specifiers) => installCommand.command === "deno" ? specifiers.map((specifier) => `npm:${specifier}`) : specifiers
759
742
  );
@@ -783,15 +766,15 @@ async function tryToInstallIntegrations({
783
766
  }
784
767
  });
785
768
  spinner.stop("Dependencies installed.");
786
- return 1 /* updated */;
769
+ return "updated";
787
770
  } catch (err) {
788
771
  spinner.error("Error installing dependencies.");
789
772
  logger.debug("add", "Error installing dependencies", err);
790
773
  console.error("\n", err.stdout || err.message, "\n");
791
- return 3 /* failure */;
774
+ return "failure";
792
775
  }
793
776
  } else {
794
- return 2 /* cancelled */;
777
+ return "cancelled";
795
778
  }
796
779
  }
797
780
  async function validateIntegrations(integrations, flags, logger) {
@@ -911,12 +894,12 @@ async function updateTSConfig(cwd = process.cwd(), logger, integrationsInfo, fla
911
894
  (integration) => presets.has(integration)
912
895
  );
913
896
  if (!firstIntegrationWithTSSettings && includesToAppend.length === 0) {
914
- return 0 /* none */;
897
+ return "none";
915
898
  }
916
899
  let inputConfig = await loadTSConfig(cwd);
917
900
  let inputConfigText = "";
918
901
  if (inputConfig === "invalid-config" || inputConfig === "unknown-error") {
919
- return 3 /* failure */;
902
+ return "failure";
920
903
  } else if (inputConfig === "missing-config") {
921
904
  logger.debug("add", "Couldn't find tsconfig.json or jsconfig.json, generating one");
922
905
  inputConfig = {
@@ -938,7 +921,7 @@ async function updateTSConfig(cwd = process.cwd(), logger, integrationsInfo, fla
938
921
  const output = JSON.stringify(outputConfig, null, 2);
939
922
  const diff = getDiffContent(inputConfigText, output);
940
923
  if (!diff) {
941
- return 0 /* none */;
924
+ return "none";
942
925
  }
943
926
  logger.info(
944
927
  "SKIP_FORMAT",
@@ -975,9 +958,9 @@ async function updateTSConfig(cwd = process.cwd(), logger, integrationsInfo, fla
975
958
  encoding: "utf-8"
976
959
  });
977
960
  logger.debug("add", `Updated ${configFileName} file`);
978
- return 1 /* updated */;
961
+ return "updated";
979
962
  } else {
980
- return 2 /* cancelled */;
963
+ return "cancelled";
981
964
  }
982
965
  }
983
966
  function parseIntegrationName(spec) {
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "6.1.3";
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.3") {
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.3") {
204
- this.#store.metaStore().set("astro-version", "6.1.3");
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);
@@ -2,8 +2,8 @@ import type * as z from 'zod/v4/core';
2
2
  export declare class LiveCollectionError extends Error {
3
3
  readonly collection: string;
4
4
  readonly message: string;
5
- readonly cause?: Error | undefined;
6
- constructor(collection: string, message: string, cause?: Error | undefined);
5
+ readonly cause?: Error;
6
+ constructor(collection: string, message: string, cause?: Error);
7
7
  static is(error: unknown): error is LiveCollectionError;
8
8
  }
9
9
  export declare class LiveEntryNotFoundError extends LiveCollectionError {
@@ -2,6 +2,9 @@ function formatZodError(error) {
2
2
  return error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`);
3
3
  }
4
4
  class LiveCollectionError extends Error {
5
+ collection;
6
+ message;
7
+ cause;
5
8
  constructor(collection, message, cause) {
6
9
  super(message);
7
10
  this.collection = collection;
@@ -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(""", '"'));
@@ -8,7 +8,7 @@ import {
8
8
  prependForwardSlash,
9
9
  removeTrailingForwardSlash
10
10
  } from "@astrojs/internal-helpers/path";
11
- import { matchPattern } from "../../assets/utils/index.js";
11
+ import { matchPattern } from "@astrojs/internal-helpers/remote";
12
12
  import { normalizeTheLocale } from "../../i18n/index.js";
13
13
  import {
14
14
  clientAddressSymbol,
@@ -8,6 +8,7 @@ import type { ServerIslandMappings } from './app/types.js';
8
8
  import type { SinglePageBuiltModule } from './build/types.js';
9
9
  import type { Logger } from './logger/core.js';
10
10
  import { RouteCache } from './render/route-cache.js';
11
+ import { type DefaultRouteParams } from './routing/default.js';
11
12
  import type { CacheProvider, CacheProviderFactory } from './cache/types.js';
12
13
  import type { CompiledCacheRoute } from './cache/runtime/route-matching.js';
13
14
  import type { SessionDriverFactory } from './session/types.js';
@@ -20,6 +21,14 @@ import { HTMLStringCache } from '../runtime/server/html-string-cache.js';
20
21
  * Thus, a `Pipeline` is created once at process start and then used by every `RenderContext`.
21
22
  */
22
23
  export declare abstract class Pipeline {
24
+ readonly internalMiddleware: MiddlewareHandler[];
25
+ resolvedMiddleware: MiddlewareHandler | undefined;
26
+ resolvedActions: SSRActions | undefined;
27
+ resolvedSessionDriver: SessionDriverFactory | null | undefined;
28
+ resolvedCacheProvider: CacheProvider | null | undefined;
29
+ compiledCacheRoutes: CompiledCacheRoute[] | undefined;
30
+ nodePool: NodePool | undefined;
31
+ htmlStringCache: HTMLStringCache | undefined;
23
32
  readonly logger: Logger;
24
33
  readonly manifest: SSRManifest;
25
34
  /**
@@ -32,12 +41,12 @@ export declare abstract class Pipeline {
32
41
  /**
33
42
  * Used to provide better error messages for `Astro.clientAddress`
34
43
  */
35
- readonly adapterName: string;
36
- readonly clientDirectives: Map<string, string>;
37
- readonly inlinedScripts: Map<string, string>;
38
- readonly compressHTML: boolean;
39
- readonly i18n: import("./app/types.js").SSRManifestI18n | undefined;
40
- readonly middleware: (() => Promise<import("../types/public/common.js").AstroMiddlewareInstance> | import("../types/public/common.js").AstroMiddlewareInstance) | undefined;
44
+ readonly adapterName: SSRManifest['adapterName'];
45
+ readonly clientDirectives: SSRManifest['clientDirectives'];
46
+ readonly inlinedScripts: SSRManifest['inlinedScripts'];
47
+ readonly compressHTML: SSRManifest['compressHTML'];
48
+ readonly i18n: SSRManifest['i18n'];
49
+ readonly middleware: SSRManifest['middleware'];
41
50
  readonly routeCache: RouteCache;
42
51
  /**
43
52
  * Used for `Astro.site`.
@@ -47,29 +56,12 @@ export declare abstract class Pipeline {
47
56
  * Array of built-in, internal, routes.
48
57
  * Used to find the route module
49
58
  */
50
- readonly defaultRoutes: {
51
- instance: ComponentInstance;
52
- matchesComponent(filePath: URL): boolean;
53
- route: string;
54
- component: string;
55
- }[];
56
- readonly actions: (() => Promise<SSRActions> | SSRActions) | undefined;
57
- readonly sessionDriver: (() => Promise<{
58
- default: SessionDriverFactory | null;
59
- }>) | undefined;
60
- readonly cacheProvider: (() => Promise<{
61
- default: CacheProviderFactory | null;
62
- }>) | undefined;
63
- readonly cacheConfig: import("./cache/types.js").SSRManifestCache | undefined;
64
- readonly serverIslands: (() => Promise<ServerIslandMappings> | ServerIslandMappings) | undefined;
65
- readonly internalMiddleware: MiddlewareHandler[];
66
- resolvedMiddleware: MiddlewareHandler | undefined;
67
- resolvedActions: SSRActions | undefined;
68
- resolvedSessionDriver: SessionDriverFactory | null | undefined;
69
- resolvedCacheProvider: CacheProvider | null | undefined;
70
- compiledCacheRoutes: CompiledCacheRoute[] | undefined;
71
- nodePool: NodePool | undefined;
72
- htmlStringCache: HTMLStringCache | undefined;
59
+ readonly defaultRoutes: Array<DefaultRouteParams>;
60
+ readonly actions: SSRManifest['actions'];
61
+ readonly sessionDriver: SSRManifest['sessionDriver'];
62
+ readonly cacheProvider: SSRManifest['cacheProvider'];
63
+ readonly cacheConfig: SSRManifest['cacheConfig'];
64
+ readonly serverIslands: SSRManifest['serverIslandMappings'];
73
65
  constructor(logger: Logger, manifest: SSRManifest,
74
66
  /**
75
67
  * "development" or "production" only
@@ -87,12 +79,7 @@ export declare abstract class Pipeline {
87
79
  * Array of built-in, internal, routes.
88
80
  * Used to find the route module
89
81
  */
90
- defaultRoutes?: {
91
- instance: ComponentInstance;
92
- matchesComponent(filePath: URL): boolean;
93
- route: string;
94
- component: string;
95
- }[], actions?: (() => Promise<SSRActions> | SSRActions) | undefined, sessionDriver?: (() => Promise<{
82
+ defaultRoutes?: DefaultRouteParams[], actions?: (() => Promise<SSRActions> | SSRActions) | undefined, sessionDriver?: (() => Promise<{
96
83
  default: SessionDriverFactory | null;
97
84
  }>) | undefined, cacheProvider?: (() => Promise<{
98
85
  default: CacheProviderFactory | null;