astro 2.9.6 → 2.10.0

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 (67) hide show
  1. package/components/ViewTransitions.astro +65 -12
  2. package/dist/@types/astro.d.ts +13 -1
  3. package/dist/assets/vite-plugin-assets.js +1 -1
  4. package/dist/cli/add/index.d.ts +1 -3
  5. package/dist/cli/add/index.js +11 -4
  6. package/dist/cli/build/index.d.ts +1 -3
  7. package/dist/cli/build/index.js +19 -9
  8. package/dist/cli/check/index.d.ts +4 -9
  9. package/dist/cli/check/index.js +23 -11
  10. package/dist/cli/dev/index.d.ts +1 -3
  11. package/dist/cli/dev/index.js +24 -20
  12. package/dist/cli/flags.d.ts +9 -0
  13. package/dist/cli/flags.js +40 -0
  14. package/dist/cli/index.js +7 -14
  15. package/dist/cli/info/index.js +4 -6
  16. package/dist/cli/preview/index.d.ts +1 -3
  17. package/dist/cli/preview/index.js +21 -5
  18. package/dist/cli/sync/index.d.ts +1 -3
  19. package/dist/cli/sync/index.js +17 -8
  20. package/dist/cli/throw-and-exit.js +3 -0
  21. package/dist/config/index.js +2 -2
  22. package/dist/content/vite-plugin-content-virtual-mod.js +1 -1
  23. package/dist/core/app/index.d.ts +6 -1
  24. package/dist/core/app/index.js +84 -62
  25. package/dist/core/build/index.d.ts +2 -7
  26. package/dist/core/build/index.js +18 -20
  27. package/dist/core/compile/compile.js +1 -0
  28. package/dist/core/config/config.d.ts +6 -22
  29. package/dist/core/config/config.js +55 -54
  30. package/dist/core/config/index.d.ts +3 -2
  31. package/dist/core/config/index.js +6 -14
  32. package/dist/core/config/logging.d.ts +3 -0
  33. package/dist/core/config/logging.js +12 -0
  34. package/dist/core/config/settings.d.ts +1 -2
  35. package/dist/core/config/settings.js +0 -9
  36. package/dist/core/constants.js +1 -1
  37. package/dist/core/dev/container.d.ts +6 -17
  38. package/dist/core/dev/container.js +8 -32
  39. package/dist/core/dev/dev.d.ts +2 -12
  40. package/dist/core/dev/dev.js +12 -43
  41. package/dist/core/dev/index.d.ts +1 -1
  42. package/dist/core/dev/index.js +1 -3
  43. package/dist/core/dev/restart.d.ts +9 -18
  44. package/dist/core/dev/restart.js +49 -74
  45. package/dist/core/errors/errors.d.ts +10 -0
  46. package/dist/core/errors/errors.js +10 -1
  47. package/dist/core/messages.js +2 -2
  48. package/dist/core/preview/index.d.ts +2 -9
  49. package/dist/core/preview/index.js +12 -21
  50. package/dist/core/sync/index.d.ts +14 -10
  51. package/dist/core/sync/index.js +19 -20
  52. package/dist/core/util.js +2 -2
  53. package/dist/runtime/server/astro-island.js +16 -1
  54. package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
  55. package/dist/runtime/server/astro-island.prebuilt.js +1 -1
  56. package/dist/runtime/server/hydration.js +9 -0
  57. package/dist/runtime/server/render/component.js +11 -8
  58. package/dist/runtime/server/transition.d.ts +1 -0
  59. package/dist/runtime/server/transition.js +1 -0
  60. package/dist/vite-plugin-astro-postprocess/index.js +1 -1
  61. package/dist/vite-plugin-env/index.js +1 -1
  62. package/dist/vite-plugin-html/transform/index.js +1 -1
  63. package/dist/vite-plugin-scanner/index.js +4 -1
  64. package/dist/vite-plugin-scripts/page-ssr.js +1 -1
  65. package/package.json +3 -3
  66. package/dist/cli/load-settings.d.ts +0 -15
  67. package/dist/cli/load-settings.js +0 -39
@@ -1,35 +1,34 @@
1
1
  import { dim } from "kleur/colors";
2
+ import fsMod from "node:fs";
2
3
  import { performance } from "node:perf_hooks";
4
+ import { fileURLToPath } from "node:url";
3
5
  import { createServer } from "vite";
4
6
  import { createContentTypesGenerator } from "../../content/index.js";
5
7
  import { globalContentConfigObserver } from "../../content/utils.js";
8
+ import { telemetry } from "../../events/index.js";
9
+ import { eventCliSession } from "../../events/session.js";
6
10
  import { runHookConfigSetup } from "../../integrations/index.js";
7
11
  import { setUpEnvTs } from "../../vite-plugin-inject-env-ts/index.js";
8
12
  import { getTimeStat } from "../build/util.js";
13
+ import { resolveConfig } from "../config/config.js";
14
+ import { createNodeLogging } from "../config/logging.js";
15
+ import { createSettings } from "../config/settings.js";
9
16
  import { createVite } from "../create-vite.js";
10
17
  import { AstroError, AstroErrorData, createSafeError, isAstroError } from "../errors/index.js";
11
18
  import { info } from "../logger/core.js";
12
- import { printHelp } from "../messages.js";
13
- async function syncCli(settings, { logging, fs, flags }) {
14
- if ((flags == null ? void 0 : flags.help) || (flags == null ? void 0 : flags.h)) {
15
- printHelp({
16
- commandName: "astro sync",
17
- usage: "[...flags]",
18
- tables: {
19
- Flags: [["--help (-h)", "See all available flags."]]
20
- },
21
- description: `Generates TypeScript types for all Astro modules.`
22
- });
23
- return 0;
24
- }
25
- const resolvedSettings = await runHookConfigSetup({
26
- settings,
19
+ async function sync(inlineConfig, options) {
20
+ const logging = createNodeLogging(inlineConfig);
21
+ const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, "sync");
22
+ telemetry.record(eventCliSession("sync", userConfig));
23
+ const _settings = createSettings(astroConfig, fileURLToPath(astroConfig.root));
24
+ const settings = await runHookConfigSetup({
25
+ settings: _settings,
27
26
  logging,
28
27
  command: "build"
29
28
  });
30
- return sync(resolvedSettings, { logging, fs });
29
+ return await syncInternal(settings, { logging, fs: options == null ? void 0 : options.fs });
31
30
  }
32
- async function sync(settings, { logging, fs }) {
31
+ async function syncInternal(settings, { logging, fs }) {
33
32
  const timerStart = performance.now();
34
33
  const tempViteServer = await createServer(
35
34
  await createVite(
@@ -53,7 +52,7 @@ async function sync(settings, { logging, fs }) {
53
52
  const contentTypesGenerator = await createContentTypesGenerator({
54
53
  contentConfigObserver: globalContentConfigObserver,
55
54
  logging,
56
- fs,
55
+ fs: fs ?? fsMod,
57
56
  settings,
58
57
  viteServer: tempViteServer
59
58
  });
@@ -86,10 +85,10 @@ async function sync(settings, { logging, fs }) {
86
85
  await tempViteServer.close();
87
86
  }
88
87
  info(logging, "content", `Types generated ${dim(getTimeStat(timerStart, performance.now()))}`);
89
- await setUpEnvTs({ settings, logging, fs });
88
+ await setUpEnvTs({ settings, logging, fs: fs ?? fsMod });
90
89
  return 0;
91
90
  }
92
91
  export {
93
92
  sync,
94
- syncCli
93
+ syncInternal
95
94
  };
package/dist/core/util.js CHANGED
@@ -27,7 +27,7 @@ function padMultilineString(source, n = 2) {
27
27
  return lines.map((l) => ` `.repeat(n) + l).join(`
28
28
  `);
29
29
  }
30
- const REGEXP_404_OR_500_ROUTE = /(404)|(500)\/?$/;
30
+ const STATUS_CODE_PAGES = /* @__PURE__ */ new Set(["/404", "/500"]);
31
31
  function getOutputFilename(astroConfig, name, type) {
32
32
  if (type === "endpoint") {
33
33
  return name;
@@ -35,7 +35,7 @@ function getOutputFilename(astroConfig, name, type) {
35
35
  if (name === "/" || name === "") {
36
36
  return path.posix.join(name, "index.html");
37
37
  }
38
- if (astroConfig.build.format === "file" || REGEXP_404_OR_500_ROUTE.test(name)) {
38
+ if (astroConfig.build.format === "file" || STATUS_CODE_PAGES.has(name)) {
39
39
  return `${removeTrailingForwardSlash(name || "index")}.html`;
40
40
  }
41
41
  return path.posix.join(name, "index.html");
@@ -52,7 +52,22 @@ var _a;
52
52
  continue;
53
53
  slots[slot.getAttribute("name") || "default"] = slot.innerHTML;
54
54
  }
55
- const props = this.hasAttribute("props") ? JSON.parse(this.getAttribute("props"), reviver) : {};
55
+ let props;
56
+ try {
57
+ props = this.hasAttribute("props") ? JSON.parse(this.getAttribute("props"), reviver) : {};
58
+ } catch (e) {
59
+ let componentName = this.getAttribute("component-url") || "<unknown>";
60
+ const componentExport = this.getAttribute("component-export");
61
+ if (componentExport) {
62
+ componentName += ` (export ${componentExport})`;
63
+ }
64
+ console.error(
65
+ `[hydrate] Error parsing props for component ${componentName}`,
66
+ this.getAttribute("props"),
67
+ e
68
+ );
69
+ throw e;
70
+ }
56
71
  await this.hydrator(this)(this.Component, props, slots, {
57
72
  client: this.getAttribute("client")
58
73
  });
@@ -3,5 +3,5 @@
3
3
  * Do not edit this directly, but instead edit that file and rerun the prebuild
4
4
  * to generate this file.
5
5
  */
6
- declare const _default: "(()=>{var d;{let h={0:t=>t,1:t=>JSON.parse(t,a),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,a)),5:t=>new Set(JSON.parse(t,a)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},a=(t,e)=>{if(t===\"\"||!Array.isArray(e))return e;let[r,n]=e;return r in h?h[r](n):void 0};customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var o;if(!this.hydrator||!this.isConnected)return;let e=(o=this.parentElement)==null?void 0:o.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let r=this.querySelectorAll(\"astro-slot\"),n={},c=this.querySelectorAll(\"template[data-astro-template]\");for(let s of c){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute(\"data-astro-template\")||\"default\"]=s.innerHTML,s.remove())}for(let s of r){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute(\"name\")||\"default\"]=s.innerHTML)}let l=this.hasAttribute(\"props\")?JSON.parse(this.getAttribute(\"props\"),a):{};await this.hydrator(this)(this.Component,l,n,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))}}connectedCallback(){!this.hasAttribute(\"await-children\")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((e,r)=>{r.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let n=this.getAttribute(\"renderer-url\"),[c,{default:l}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),o=this.getAttribute(\"component-export\")||\"default\";if(!o.includes(\".\"))this.Component=c[o];else{this.Component=c;for(let s of o.split(\".\"))this.Component=this.Component[s]}return this.hydrator=l,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=[\"props\"],d))}})();";
6
+ declare const _default: "(()=>{var d;{let p={0:t=>t,1:t=>JSON.parse(t,a),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,a)),5:t=>new Set(JSON.parse(t,a)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},a=(t,r)=>{if(t===\"\"||!Array.isArray(r))return r;let[s,i]=r;return s in p?p[s](i):void 0};customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var o;if(!this.hydrator||!this.isConnected)return;let r=(o=this.parentElement)==null?void 0:o.closest(\"astro-island[ssr]\");if(r){r.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let s=this.querySelectorAll(\"astro-slot\"),i={},c=this.querySelectorAll(\"template[data-astro-template]\");for(let e of c){let n=e.closest(this.tagName);n!=null&&n.isSameNode(this)&&(i[e.getAttribute(\"data-astro-template\")||\"default\"]=e.innerHTML,e.remove())}for(let e of s){let n=e.closest(this.tagName);n!=null&&n.isSameNode(this)&&(i[e.getAttribute(\"name\")||\"default\"]=e.innerHTML)}let l;try{l=this.hasAttribute(\"props\")?JSON.parse(this.getAttribute(\"props\"),a):{}}catch(e){let n=this.getAttribute(\"component-url\")||\"<unknown>\",h=this.getAttribute(\"component-export\");throw h&&(n+=` (export ${h})`),console.error(`[hydrate] Error parsing props for component ${n}`,this.getAttribute(\"props\"),e),e}await this.hydrator(this)(this.Component,l,i,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))}}connectedCallback(){!this.hasAttribute(\"await-children\")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,s)=>{s.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let r=this.getAttribute(\"before-hydration-url\");r&&await import(r),this.start()}start(){let r=JSON.parse(this.getAttribute(\"opts\")),s=this.getAttribute(\"client\");if(Astro[s]===void 0){window.addEventListener(`astro:${s}`,()=>this.start(),{once:!0});return}Astro[s](async()=>{let i=this.getAttribute(\"renderer-url\"),[c,{default:l}]=await Promise.all([import(this.getAttribute(\"component-url\")),i?import(i):()=>()=>{}]),o=this.getAttribute(\"component-export\")||\"default\";if(!o.includes(\".\"))this.Component=c[o];else{this.Component=c;for(let e of o.split(\".\"))this.Component=this.Component[e]}return this.hydrator=l,this.hydrate},r,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=[\"props\"],d))}})();";
7
7
  export default _default;
@@ -1,4 +1,4 @@
1
- var astro_island_prebuilt_default = `(()=>{var d;{let h={0:t=>t,1:t=>JSON.parse(t,a),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,a)),5:t=>new Set(JSON.parse(t,a)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},a=(t,e)=>{if(t===""||!Array.isArray(e))return e;let[r,n]=e;return r in h?h[r](n):void 0};customElements.get("astro-island")||customElements.define("astro-island",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var o;if(!this.hydrator||!this.isConnected)return;let e=(o=this.parentElement)==null?void 0:o.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),n={},c=this.querySelectorAll("template[data-astro-template]");for(let s of c){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute("data-astro-template")||"default"]=s.innerHTML,s.remove())}for(let s of r){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute("name")||"default"]=s.innerHTML)}let l=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),a):{};await this.hydrator(this)(this.Component,l,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((e,r)=>{r.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let n=this.getAttribute("renderer-url"),[c,{default:l}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),o=this.getAttribute("component-export")||"default";if(!o.includes("."))this.Component=c[o];else{this.Component=c;for(let s of o.split("."))this.Component=this.Component[s]}return this.hydrator=l,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=["props"],d))}})();`;
1
+ var astro_island_prebuilt_default = `(()=>{var d;{let p={0:t=>t,1:t=>JSON.parse(t,a),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,a)),5:t=>new Set(JSON.parse(t,a)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},a=(t,r)=>{if(t===""||!Array.isArray(r))return r;let[s,i]=r;return s in p?p[s](i):void 0};customElements.get("astro-island")||customElements.define("astro-island",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var o;if(!this.hydrator||!this.isConnected)return;let r=(o=this.parentElement)==null?void 0:o.closest("astro-island[ssr]");if(r){r.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let s=this.querySelectorAll("astro-slot"),i={},c=this.querySelectorAll("template[data-astro-template]");for(let e of c){let n=e.closest(this.tagName);n!=null&&n.isSameNode(this)&&(i[e.getAttribute("data-astro-template")||"default"]=e.innerHTML,e.remove())}for(let e of s){let n=e.closest(this.tagName);n!=null&&n.isSameNode(this)&&(i[e.getAttribute("name")||"default"]=e.innerHTML)}let l;try{l=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),a):{}}catch(e){let n=this.getAttribute("component-url")||"<unknown>",h=this.getAttribute("component-export");throw h&&(n+=\` (export \${h})\`),console.error(\`[hydrate] Error parsing props for component \${n}\`,this.getAttribute("props"),e),e}await this.hydrator(this)(this.Component,l,i,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,s)=>{s.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let r=this.getAttribute("before-hydration-url");r&&await import(r),this.start()}start(){let r=JSON.parse(this.getAttribute("opts")),s=this.getAttribute("client");if(Astro[s]===void 0){window.addEventListener(\`astro:\${s}\`,()=>this.start(),{once:!0});return}Astro[s](async()=>{let i=this.getAttribute("renderer-url"),[c,{default:l}]=await Promise.all([import(this.getAttribute("component-url")),i?import(i):()=>()=>{}]),o=this.getAttribute("component-export")||"default";if(!o.includes("."))this.Component=c[o];else{this.Component=c;for(let e of o.split("."))this.Component=this.Component[e]}return this.hydrator=l,this.hydrate},r,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=["props"],d))}})();`;
2
2
  export {
3
3
  astro_island_prebuilt_default as default
4
4
  };
@@ -2,6 +2,10 @@ import { AstroError, AstroErrorData } from "../../core/errors/index.js";
2
2
  import { escapeHTML } from "./escape.js";
3
3
  import { serializeProps } from "./serialize.js";
4
4
  import { serializeListValue } from "./util.js";
5
+ const transitionDirectivesToCopyOnIsland = Object.freeze([
6
+ "data-astro-transition-scope",
7
+ "data-astro-transition-persist"
8
+ ]);
5
9
  function extractDirectives(inputProps, clientDirectives) {
6
10
  let extracted = {
7
11
  isPage: false,
@@ -104,6 +108,11 @@ async function generateHydrateScript(scriptOptions, metadata) {
104
108
  value: metadata.hydrateArgs || ""
105
109
  })
106
110
  );
111
+ transitionDirectivesToCopyOnIsland.forEach((name) => {
112
+ if (props[name]) {
113
+ island.props[name] = props[name];
114
+ }
115
+ });
107
116
  return island;
108
117
  }
109
118
  export {
@@ -319,18 +319,21 @@ async function renderHTMLComponent(result, Component, _props, slots = {}) {
319
319
  }
320
320
  };
321
321
  }
322
- async function renderAstroComponent(result, displayName, Component, props, slots = {}) {
322
+ function renderAstroComponent(result, displayName, Component, props, slots = {}) {
323
323
  const instance = createAstroComponentInstance(result, displayName, Component, props, slots);
324
- const chunks = [];
325
- const temporaryDestination = {
326
- write: (chunk) => chunks.push(chunk)
324
+ const bufferChunks = [];
325
+ const bufferDestination = {
326
+ write: (chunk) => bufferChunks.push(chunk)
327
327
  };
328
- await instance.render(temporaryDestination);
328
+ const renderPromise = instance.render(bufferDestination);
329
329
  return {
330
- render(destination) {
331
- for (const chunk of chunks) {
330
+ async render(destination) {
331
+ for (const chunk of bufferChunks) {
332
332
  destination.write(chunk);
333
333
  }
334
+ bufferChunks.length = 0;
335
+ bufferDestination.write = (chunk) => destination.write(chunk);
336
+ await renderPromise;
334
337
  }
335
338
  };
336
339
  }
@@ -345,7 +348,7 @@ async function renderComponent(result, displayName, Component, props, slots = {}
345
348
  return await renderHTMLComponent(result, Component, props, slots);
346
349
  }
347
350
  if (isAstroComponentFactory(Component)) {
348
- return await renderAstroComponent(result, displayName, Component, props, slots);
351
+ return renderAstroComponent(result, displayName, Component, props, slots);
349
352
  }
350
353
  return await renderFrameworkComponent(result, displayName, Component, props, slots);
351
354
  }
@@ -1,2 +1,3 @@
1
1
  import type { SSRResult, TransitionAnimationValue } from '../../@types/astro';
2
+ export declare function createTransitionScope(result: SSRResult, hash: string): string;
2
3
  export declare function renderTransition(result: SSRResult, hash: string, animationName: TransitionAnimationValue | undefined, transitionName: string): string;
@@ -129,5 +129,6 @@ function toTimeValue(num) {
129
129
  return typeof num === "number" ? num + "ms" : num;
130
130
  }
131
131
  export {
132
+ createTransitionScope,
132
133
  renderTransition
133
134
  };
@@ -37,7 +37,7 @@ function astro() {
37
37
  if (s) {
38
38
  return {
39
39
  code: s.toString(),
40
- map: s.generateMap({ hires: true })
40
+ map: s.generateMap({ hires: "boundary" })
41
41
  };
42
42
  }
43
43
  }
@@ -98,7 +98,7 @@ function envVitePlugin({ settings }) {
98
98
  if (s) {
99
99
  return {
100
100
  code: s.toString(),
101
- map: s.generateMap({ hires: true })
101
+ map: s.generateMap({ hires: "boundary" })
102
102
  };
103
103
  }
104
104
  }
@@ -13,7 +13,7 @@ async function transform(code, id) {
13
13
  s.append('`\n }\nrender["astro:html"] = true;\nexport default render;');
14
14
  return {
15
15
  code: s.toString(),
16
- map: s.generateMap()
16
+ map: s.generateMap({ hires: "boundary" })
17
17
  };
18
18
  }
19
19
  export {
@@ -1,9 +1,11 @@
1
1
  import { bold } from "kleur/colors";
2
+ import { extname } from "node:path";
2
3
  import { normalizePath } from "vite";
3
4
  import { warn } from "../core/logger/core.js";
4
5
  import { isEndpoint, isPage, rootRelativePath } from "../core/util.js";
5
6
  import { getPrerenderDefault, isServerLikeOutput } from "../prerender/utils.js";
6
7
  import { scan } from "./scan.js";
8
+ const KNOWN_FILE_EXTENSIONS = [".astro", ".js", ".ts"];
7
9
  function astroScannerPlugin({
8
10
  settings,
9
11
  logging
@@ -30,7 +32,8 @@ function astroScannerPlugin({
30
32
  if (typeof pageOptions.prerender === "undefined") {
31
33
  pageOptions.prerender = defaultPrerender;
32
34
  }
33
- if (!pageOptions.prerender && isServerLikeOutput(settings.config) && code.includes("getStaticPaths")) {
35
+ if (!pageOptions.prerender && isServerLikeOutput(settings.config) && code.includes("getStaticPaths") && // this should only be valid for `.astro`, `.js` and `.ts` files
36
+ KNOWN_FILE_EXTENSIONS.includes(extname(filename))) {
34
37
  const reason = ` because \`output: "${settings.config.output}"\` is set`;
35
38
  warn(
36
39
  logging,
@@ -29,7 +29,7 @@ function astroScriptsPostPlugin({
29
29
  `);
30
30
  return {
31
31
  code: s.toString(),
32
- map: s.generateMap({ hires: true })
32
+ map: s.generateMap({ hires: "boundary" })
33
33
  };
34
34
  }
35
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "2.9.6",
3
+ "version": "2.10.0",
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",
@@ -102,7 +102,7 @@
102
102
  "vendor"
103
103
  ],
104
104
  "dependencies": {
105
- "@astrojs/compiler": "^1.6.3",
105
+ "@astrojs/compiler": "^1.8.0",
106
106
  "@astrojs/internal-helpers": "^0.1.1",
107
107
  "@astrojs/language-server": "^1.0.0",
108
108
  "@astrojs/markdown-remark": "^2.2.1",
@@ -137,7 +137,7 @@
137
137
  "html-escaper": "^3.0.3",
138
138
  "js-yaml": "^4.1.0",
139
139
  "kleur": "^4.1.4",
140
- "magic-string": "^0.27.0",
140
+ "magic-string": "^0.30.2",
141
141
  "mime": "^3.0.0",
142
142
  "network-information-types": "^0.1.1",
143
143
  "ora": "^6.3.1",
@@ -1,15 +0,0 @@
1
- import type { Arguments as Flags } from 'yargs-parser';
2
- import { type LogOptions } from '../core/logger/core.js';
3
- interface LoadSettingsOptions {
4
- cmd: string;
5
- flags: Flags;
6
- logging: LogOptions;
7
- }
8
- export declare function loadSettings({ cmd, flags, logging }: LoadSettingsOptions): Promise<import("../@types/astro.js").AstroSettings | undefined>;
9
- export declare function handleConfigError(e: any, { cmd, cwd, flags, logging }: {
10
- cmd: string;
11
- cwd?: string;
12
- flags?: Flags;
13
- logging: LogOptions;
14
- }): Promise<void>;
15
- export {};
@@ -1,39 +0,0 @@
1
- import * as colors from "kleur/colors";
2
- import fs from "node:fs";
3
- import { ZodError } from "zod";
4
- import { createSettings, openConfig, resolveConfigPath } from "../core/config/index.js";
5
- import { collectErrorMetadata } from "../core/errors/dev/index.js";
6
- import { error } from "../core/logger/core.js";
7
- import { formatConfigErrorMessage, formatErrorMessage } from "../core/messages.js";
8
- import * as event from "../events/index.js";
9
- import { eventConfigError, telemetry } from "../events/index.js";
10
- async function loadSettings({ cmd, flags, logging }) {
11
- const root = flags.root;
12
- const { astroConfig: initialAstroConfig, userConfig: initialUserConfig } = await openConfig({
13
- cwd: root,
14
- flags,
15
- cmd
16
- }).catch(async (e) => {
17
- await handleConfigError(e, { cmd, cwd: root, flags, logging });
18
- return {};
19
- });
20
- if (!initialAstroConfig)
21
- return;
22
- telemetry.record(event.eventCliSession(cmd, initialUserConfig, flags));
23
- return createSettings(initialAstroConfig, root);
24
- }
25
- async function handleConfigError(e, { cmd, cwd, flags, logging }) {
26
- const path = await resolveConfigPath({ cwd, flags, fs });
27
- error(logging, "astro", `Unable to load ${path ? colors.bold(path) : "your Astro config"}
28
- `);
29
- if (e instanceof ZodError) {
30
- console.error(formatConfigErrorMessage(e) + "\n");
31
- telemetry.record(eventConfigError({ cmd, err: e, isFatal: true }));
32
- } else if (e instanceof Error) {
33
- console.error(formatErrorMessage(collectErrorMetadata(e)) + "\n");
34
- }
35
- }
36
- export {
37
- handleConfigError,
38
- loadSettings
39
- };