astro 5.12.7 → 5.12.9

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/dist/cli/index.js CHANGED
@@ -22,11 +22,6 @@ async function printAstroHelp() {
22
22
  ["preferences", "Configure user preferences."],
23
23
  ["telemetry", "Configure telemetry settings."]
24
24
  ],
25
- "Studio Commands": [
26
- ["login", "Authenticate your machine with Astro Studio."],
27
- ["logout", "End your authenticated session with Astro Studio."],
28
- ["link", "Link this project directory to an Astro Studio project."]
29
- ],
30
25
  "Global Flags": [
31
26
  ["--config <path>", "Specify your config file."],
32
27
  ["--root <path>", "Specify your project root folder."],
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
164
164
  logger.info("Content config changed");
165
165
  shouldClear = true;
166
166
  }
167
- if (previousAstroVersion && previousAstroVersion !== "5.12.7") {
167
+ if (previousAstroVersion && previousAstroVersion !== "5.12.9") {
168
168
  logger.info("Astro version changed");
169
169
  shouldClear = true;
170
170
  }
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
172
172
  logger.info("Clearing content store");
173
173
  this.#store.clearAll();
174
174
  }
175
- if ("5.12.7") {
176
- await this.#store.metaStore().set("astro-version", "5.12.7");
175
+ if ("5.12.9") {
176
+ await this.#store.metaStore().set("astro-version", "5.12.9");
177
177
  }
178
178
  if (currentConfigDigest) {
179
179
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.12.7";
1
+ const ASTRO_VERSION = "5.12.9";
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 = "5.12.7";
25
+ const currentVersion = "5.12.9";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "5.12.7";
40
+ const version = "5.12.9";
41
41
  const localPrefix = `${dim("\u2503")} Local `;
42
42
  const networkPrefix = `${dim("\u2503")} Network `;
43
43
  const emptyPrefix = " ".repeat(11);
@@ -274,7 +274,7 @@ function printHelp({
274
274
  message.push(
275
275
  linebreak(),
276
276
  ` ${bgGreen(black(` ${commandName} `))} ${green(
277
- `v${"5.12.7"}`
277
+ `v${"5.12.9"}`
278
278
  )} ${headline}`
279
279
  );
280
280
  }
@@ -445,9 +445,14 @@ async function createRoutesList(params, logger, { dev = false } = {}) {
445
445
  const hasRoute = fallbackFromRoutes && // we check if the fallback from locale (the origin) has already this route
446
446
  fallbackFromRoutes.some((route) => {
447
447
  if (fallbackToLocale === i18n.defaultLocale) {
448
- return route.route.replace(`/${fallbackFromLocale}`, "") === fallbackToRoute.route;
448
+ return route.route === `/${fallbackFromLocale}${fallbackToRoute.route}` || route.route.replace(`/${fallbackFromLocale}`, "") === fallbackToRoute.route;
449
449
  } else {
450
- return route.route.replace(`/${fallbackToLocale}`, `/${fallbackFromLocale}`) === fallbackToRoute.route;
450
+ const expectedRoute = replaceOrKeep(
451
+ fallbackToRoute.route,
452
+ fallbackToLocale,
453
+ fallbackFromLocale
454
+ );
455
+ return route.route === expectedRoute;
451
456
  }
452
457
  });
453
458
  if (!hasRoute) {
@@ -459,8 +464,8 @@ async function createRoutesList(params, logger, { dev = false } = {}) {
459
464
  }
460
465
  route = `/${fallbackFromLocale}${fallbackToRoute.route}`;
461
466
  } else {
462
- pathname = fallbackToRoute.pathname?.replace(`/${fallbackToLocale}/`, `/${fallbackFromLocale}/`).replace(`/${fallbackToLocale}`, `/${fallbackFromLocale}`);
463
- route = fallbackToRoute.route.replace(`/${fallbackToLocale}`, `/${fallbackFromLocale}`).replace(`/${fallbackToLocale}/`, `/${fallbackFromLocale}/`);
467
+ pathname = fallbackToRoute.pathname ? replaceOrKeep(fallbackToRoute.pathname, fallbackToLocale, fallbackFromLocale) : void 0;
468
+ route = replaceOrKeep(fallbackToRoute.route, fallbackToLocale, fallbackFromLocale);
464
469
  }
465
470
  const segments = removeLeadingForwardSlash(route).split(path.posix.sep).filter(Boolean).map((s) => {
466
471
  validateSegment(s);
@@ -520,6 +525,10 @@ function joinSegments(segments) {
520
525
  });
521
526
  return `/${arr.join("/")}`.toLowerCase();
522
527
  }
528
+ function replaceOrKeep(original, from, to) {
529
+ if (original.startsWith(`/${to}/`) || original === `/${to}`) return original;
530
+ return original.replace(`/${from}/`, `/${to}/`).replace(`/${from}`, `/${to}`);
531
+ }
523
532
  export {
524
533
  createRoutesList,
525
534
  resolveInjectedRoute
@@ -1,3 +1,4 @@
1
+ import { parseAstroRequest } from "./query.js";
1
2
  import { frontmatterRE } from "./utils.js";
2
3
  async function handleHotUpdate(ctx, { logger, astroFileToCompileMetadata }) {
3
4
  for (const [astroFile, compileData] of astroFileToCompileMetadata) {
@@ -12,7 +13,13 @@ async function handleHotUpdate(ctx, { logger, astroFileToCompileMetadata }) {
12
13
  if (isStyleOnlyChanged(oldCode, newCode)) {
13
14
  logger.debug("watch", "style-only change");
14
15
  astroFileToCompileMetadata.delete(ctx.file);
15
- return ctx.modules.filter((mod) => mod.id?.includes("astro&type=style"));
16
+ return ctx.modules.filter((mod) => {
17
+ if (!mod.id) {
18
+ return false;
19
+ }
20
+ const { query } = parseAstroRequest(mod.id);
21
+ return query.astro && query.type === "style" && !query.inline;
22
+ });
16
23
  }
17
24
  }
18
25
  const scriptRE = /<script(?:\s.*?)?>.*?<\/script>/gs;
@@ -5,6 +5,7 @@ interface AstroQuery {
5
5
  index?: number;
6
6
  lang?: string;
7
7
  raw?: boolean;
8
+ inline?: boolean;
8
9
  }
9
10
  interface ParsedRequestResult {
10
11
  filename: string;
@@ -13,6 +13,9 @@ function parseAstroRequest(id) {
13
13
  if (query.raw != null) {
14
14
  query.raw = true;
15
15
  }
16
+ if (query.inline != null) {
17
+ query.inline = true;
18
+ }
16
19
  return {
17
20
  filename,
18
21
  query
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.12.7",
3
+ "version": "5.12.9",
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",
@@ -158,8 +158,8 @@
158
158
  "zod": "^3.24.4",
159
159
  "zod-to-json-schema": "^3.24.5",
160
160
  "zod-to-ts": "^1.2.0",
161
- "@astrojs/internal-helpers": "0.7.0",
162
- "@astrojs/markdown-remark": "6.3.4",
161
+ "@astrojs/internal-helpers": "0.7.1",
162
+ "@astrojs/markdown-remark": "6.3.5",
163
163
  "@astrojs/telemetry": "3.3.0"
164
164
  },
165
165
  "optionalDependencies": {