+2
-5
@@ -11,8 +11,5 @@ #!/usr/bin/env node | ||
| // TODO: remove once Stackblitz supports Node 22 | ||
| const IS_STACKBLITZ = !!process.versions.webcontainer; | ||
| // Hardcode supported Node.js version so we don't have to read differently in CJS & ESM. | ||
| const engines = IS_STACKBLITZ ? '>=20.19.1' : '>=22.12.0'; | ||
| const skipSemverCheckIfAbove = IS_STACKBLITZ ? 21 : 23; | ||
| const engines = '>=22.12.0'; | ||
| const skipSemverCheckIfAbove = 23; | ||
@@ -19,0 +16,0 @@ /** `astro *` */ |
| class BuildTimeAstroVersionProvider { | ||
| // Injected during the build through esbuild define | ||
| version = "6.0.5"; | ||
| version = "6.0.6"; | ||
| } | ||
@@ -5,0 +5,0 @@ export { |
@@ -192,3 +192,3 @@ import { existsSync, promises as fs } from "node:fs"; | ||
| } | ||
| if (previousAstroVersion && previousAstroVersion !== "6.0.5") { | ||
| if (previousAstroVersion && previousAstroVersion !== "6.0.6") { | ||
| logger.info("Astro version changed"); | ||
@@ -201,4 +201,4 @@ shouldClear = true; | ||
| } | ||
| if ("6.0.5") { | ||
| this.#store.metaStore().set("astro-version", "6.0.5"); | ||
| if ("6.0.6") { | ||
| this.#store.metaStore().set("astro-version", "6.0.6"); | ||
| } | ||
@@ -205,0 +205,0 @@ if (currentConfigDigest) { |
@@ -35,2 +35,3 @@ import { | ||
| import { ensure404Route } from "../routing/astro-designed-error-pages.js"; | ||
| import { routeHasHtmlExtension } from "../routing/helpers.js"; | ||
| import { matchRoute } from "../routing/match.js"; | ||
@@ -307,3 +308,3 @@ import { applyCacheHeaders } from "../cache/runtime/cache.js"; | ||
| let pathname = this.getPathnameFromRequest(request); | ||
| if (this.isDev()) { | ||
| if (this.isDev() && !routeHasHtmlExtension(routeData)) { | ||
| pathname = pathname.replace(/\/index\.html$/, "/").replace(/\.html$/, ""); | ||
@@ -310,0 +311,0 @@ } |
@@ -84,9 +84,15 @@ import { fileURLToPath } from "node:url"; | ||
| const domainLookupTable = {}; | ||
| const entryModules = Object.fromEntries(internals.entrySpecifierToBundleMap.entries()); | ||
| if (settings.scripts.some((script) => script.stage === "page")) { | ||
| staticFiles.push(entryModules[PAGE_SCRIPT_ID]); | ||
| } | ||
| const rawEntryModules = Object.fromEntries(internals.entrySpecifierToBundleMap.entries()); | ||
| const assetQueryParams = settings.adapter?.client?.assetQueryParams; | ||
| const assetQueryString = assetQueryParams ? assetQueryParams.toString() : void 0; | ||
| const appendAssetQuery = (pth) => assetQueryString ? `${pth}?${assetQueryString}` : pth; | ||
| const entryModules = Object.fromEntries( | ||
| Object.entries(rawEntryModules).map(([key, value]) => [ | ||
| key, | ||
| value ? appendAssetQuery(value) : value | ||
| ]) | ||
| ); | ||
| if (settings.scripts.some((script) => script.stage === "page")) { | ||
| staticFiles.push(rawEntryModules[PAGE_SCRIPT_ID]); | ||
| } | ||
| const prefixAssetPath = (pth) => { | ||
@@ -122,3 +128,3 @@ let result = ""; | ||
| if (settings.scripts.some((script) => script.stage === "page")) { | ||
| const src = entryModules[PAGE_SCRIPT_ID]; | ||
| const src = rawEntryModules[PAGE_SCRIPT_ID]; | ||
| scripts.push({ | ||
@@ -125,0 +131,0 @@ type: "external", |
@@ -1,2 +0,2 @@ | ||
| const ASTRO_VERSION = "6.0.5"; | ||
| const ASTRO_VERSION = "6.0.6"; | ||
| const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`; | ||
@@ -3,0 +3,0 @@ const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute"; |
@@ -29,3 +29,3 @@ import fs from "node:fs"; | ||
| const logger = restart.container.logger; | ||
| const currentVersion = "6.0.5"; | ||
| const currentVersion = "6.0.6"; | ||
| const isPrerelease = currentVersion.includes("-"); | ||
@@ -32,0 +32,0 @@ if (!isPrerelease) { |
@@ -272,3 +272,3 @@ import colors from "piccolore"; | ||
| ` ${bgGreen(black(` ${commandName} `))} ${green( | ||
| `v${"6.0.5"}` | ||
| `v${"6.0.6"}` | ||
| )} ${headline}` | ||
@@ -275,0 +275,0 @@ ); |
| import { DEFAULT_404_COMPONENT } from "../constants.js"; | ||
| import { AstroError, AstroErrorData } from "../errors/index.js"; | ||
| import { routeIsFallback, routeIsRedirect } from "../routing/helpers.js"; | ||
| import { routeHasHtmlExtension, routeIsFallback, routeIsRedirect } from "../routing/helpers.js"; | ||
| import { callGetStaticPaths, findPathItemByKey } from "./route-cache.js"; | ||
@@ -47,7 +47,5 @@ async function getProps(opts) { | ||
| if (!route.params.length) return {}; | ||
| let path = pathname; | ||
| if (pathname.endsWith(".html")) { | ||
| path = path.slice(0, -5); | ||
| } | ||
| const paramsMatch = route.pattern.exec(path) || route.fallbackRoutes.map((fallbackRoute) => fallbackRoute.pattern.exec(path)).find((x) => x); | ||
| const path = pathname.endsWith(".html") && !routeHasHtmlExtension(route) ? pathname.slice(0, -5) : pathname; | ||
| const allPatterns = [route, ...route.fallbackRoutes].map((r) => r.pattern); | ||
| const paramsMatch = allPatterns.map((pattern) => pattern.exec(path)).find((x) => x); | ||
| if (!paramsMatch) return {}; | ||
@@ -54,0 +52,0 @@ const params = {}; |
| import { getAssetsPrefix } from "../../assets/utils/getAssetsPrefix.js"; | ||
| import { fileExtension, joinPaths, prependForwardSlash, slash } from "../../core/path.js"; | ||
| const URL_PARSE_BASE = "https://astro.build"; | ||
| function splitAssetPath(path) { | ||
| const parsed = new URL(path, URL_PARSE_BASE); | ||
| const isAbsolute = URL.canParse(path); | ||
| const pathname = !isAbsolute && !path.startsWith("/") ? parsed.pathname.slice(1) : parsed.pathname; | ||
| return { | ||
| pathname, | ||
| suffix: `${parsed.search}${parsed.hash}` | ||
| }; | ||
| } | ||
| function appendQueryParams(path, queryParams) { | ||
| const queryString = queryParams.toString(); | ||
| if (!queryString) { | ||
| return path; | ||
| } | ||
| const hashIndex = path.indexOf("#"); | ||
| const basePath = hashIndex === -1 ? path : path.slice(0, hashIndex); | ||
| const hash = hashIndex === -1 ? "" : path.slice(hashIndex); | ||
| const separator = basePath.includes("?") ? "&" : "?"; | ||
| return `${basePath}${separator}${queryString}${hash}`; | ||
| } | ||
| function createAssetLink(href, base, assetsPrefix, queryParams) { | ||
| const { pathname, suffix } = splitAssetPath(href); | ||
| let url = ""; | ||
| if (assetsPrefix) { | ||
| const pf = getAssetsPrefix(fileExtension(href), assetsPrefix); | ||
| url = joinPaths(pf, slash(href)); | ||
| const pf = getAssetsPrefix(fileExtension(pathname), assetsPrefix); | ||
| url = joinPaths(pf, slash(pathname)) + suffix; | ||
| } else if (base) { | ||
| url = prependForwardSlash(joinPaths(base, slash(href))); | ||
| url = prependForwardSlash(joinPaths(base, slash(pathname))) + suffix; | ||
| } else { | ||
@@ -14,3 +36,3 @@ url = href; | ||
| if (queryParams) { | ||
| url += "?" + queryParams.toString(); | ||
| url = appendQueryParams(url, queryParams); | ||
| } | ||
@@ -17,0 +39,0 @@ return url; |
@@ -35,2 +35,8 @@ import type { RouteData } from '../../types/public/internal.js'; | ||
| export declare function getCustom500Route(manifestData: RoutesList): RouteData | undefined; | ||
| /** | ||
| * Returns true if the route definition contains `.html` as a static segment part, | ||
| * as is the case for routes like `[slug].html.astro`. Used to avoid stripping the | ||
| * `.html` suffix from pathnames that intentionally include it. | ||
| */ | ||
| export declare function routeHasHtmlExtension(route: RouteData): boolean; | ||
| export declare function hasNonPrerenderedProjectRoute(routes: Array<Pick<RouteData, 'type' | 'origin' | 'prerender'>>, options?: { | ||
@@ -37,0 +43,0 @@ includeEndpoints?: boolean; |
@@ -28,2 +28,7 @@ import { isRoute404, isRoute500 } from "./internal/route-errors.js"; | ||
| } | ||
| function routeHasHtmlExtension(route) { | ||
| return route.segments.some( | ||
| (segment) => segment.some((part) => !part.dynamic && part.content.includes(".html")) | ||
| ); | ||
| } | ||
| function hasNonPrerenderedProjectRoute(routes, options) { | ||
@@ -42,4 +47,5 @@ const includeEndpoints = options?.includeEndpoints ?? true; | ||
| hasNonPrerenderedProjectRoute, | ||
| routeHasHtmlExtension, | ||
| routeIsFallback, | ||
| routeIsRedirect | ||
| }; |
@@ -7,3 +7,9 @@ import type { ModuleLoader } from './module-loader/index.js'; | ||
| /** | ||
| * Resolve the hydration paths so that it can be imported in the client | ||
| * Resolve island component specifiers to stable paths for hydration metadata. | ||
| * | ||
| * Examples: | ||
| * - `./components/Button.jsx` from `/app/src/pages/index.astro` | ||
| * -> `/app/src/pages/components/Button.tsx` (when `.tsx` exists) | ||
| * - `#components/react/Counter.tsx` | ||
| * -> `/app/src/components/react/Counter.tsx` via package `imports` | ||
| */ | ||
@@ -10,0 +16,0 @@ export declare function resolvePath(specifier: string, importer: string): string; |
@@ -0,3 +1,4 @@ | ||
| import { createRequire } from "node:module"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { fileURLToPath, pathToFileURL } from "node:url"; | ||
| import { prependForwardSlash, slash } from "../core/path.js"; | ||
@@ -13,2 +14,18 @@ import { resolveJsToTs, unwrapId, VALID_ID_PREFIX, viteID } from "./util.js"; | ||
| return resolveJsToTs(normalizePath(absoluteSpecifier)); | ||
| } else if (specifier.startsWith("#")) { | ||
| try { | ||
| const resolved = createRequire(pathToFileURL(importer)).resolve(specifier); | ||
| return resolveJsToTs(normalizePath(resolved)); | ||
| } catch { | ||
| try { | ||
| const importerURL = pathToFileURL(importer).toString(); | ||
| const resolved = import.meta.resolve(specifier, importerURL); | ||
| const resolvedUrl = new URL(resolved); | ||
| if (resolvedUrl.protocol === "file:") { | ||
| return resolveJsToTs(normalizePath(fileURLToPath(resolvedUrl))); | ||
| } | ||
| } catch { | ||
| } | ||
| } | ||
| return specifier; | ||
| } else { | ||
@@ -15,0 +32,0 @@ return specifier; |
@@ -1,2 +0,2 @@ | ||
| import type { Plugin } from 'vite'; | ||
| import { type Plugin } from 'vite'; | ||
| import type { AstroSettings } from '../types/astro.js'; | ||
@@ -3,0 +3,0 @@ export declare const SERIALIZED_MANIFEST_ID = "virtual:astro:manifest"; |
@@ -0,1 +1,3 @@ | ||
| import { fileURLToPath } from "node:url"; | ||
| import { normalizePath } from "vite"; | ||
| import { ACTIONS_ENTRYPOINT_VIRTUAL_MODULE_ID } from "../actions/consts.js"; | ||
@@ -34,4 +36,5 @@ import { toFallbackType } from "../core/app/common.js"; | ||
| }) { | ||
| const normalizedSrcDir = normalizePath(fileURLToPath(settings.config.srcDir)); | ||
| function reloadManifest(path, server) { | ||
| if (path != null && path.startsWith(settings.config.srcDir.pathname)) { | ||
| if (path != null && normalizePath(path).startsWith(normalizedSrcDir)) { | ||
| const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]; | ||
@@ -38,0 +41,0 @@ const virtualMod = environment.moduleGraph.getModuleById(SERIALIZED_MANIFEST_RESOLVED_ID); |
@@ -48,5 +48,2 @@ import { AsyncLocalStorage } from "node:async_hooks"; | ||
| const runnablePrerenderEnvironment = isRunnableDevEnvironment(prerenderEnvironment) ? prerenderEnvironment : void 0; | ||
| if (!runnableSsrEnvironment && !runnablePrerenderEnvironment) { | ||
| return; | ||
| } | ||
| async function createHandler(environment) { | ||
@@ -88,6 +85,8 @@ const loader = createViteLoader(viteServer, environment); | ||
| } | ||
| process.on("unhandledRejection", handleUnhandledRejection); | ||
| viteServer.httpServer?.on("close", () => { | ||
| process.off("unhandledRejection", handleUnhandledRejection); | ||
| }); | ||
| if (ssrHandler || prerenderHandler) { | ||
| process.on("unhandledRejection", handleUnhandledRejection); | ||
| viteServer.httpServer?.on("close", () => { | ||
| process.off("unhandledRejection", handleUnhandledRejection); | ||
| }); | ||
| } | ||
| return () => { | ||
@@ -97,5 +96,2 @@ const shouldHandlePrerenderInCore = Boolean( | ||
| ); | ||
| if (!ssrHandler && !(prerenderHandler && shouldHandlePrerenderInCore)) { | ||
| return; | ||
| } | ||
| viteServer.middlewares.stack.unshift({ | ||
@@ -102,0 +98,0 @@ route: "", |
| import type { HmrContext } from 'vite'; | ||
| import type { Logger } from '../core/logger/core.js'; | ||
| import type { CompileAstroResult } from './compile.js'; | ||
| import type { CompileMetadata } from './types.js'; | ||
| interface HandleHotUpdateOptions { | ||
| logger: Logger; | ||
| compile: (code: string, filename: string) => Promise<CompileAstroResult>; | ||
| astroFileToCompileMetadata: Map<string, CompileMetadata>; | ||
| } | ||
| export declare function handleHotUpdate(ctx: HmrContext, { logger, astroFileToCompileMetadata }: HandleHotUpdateOptions): Promise<import("vite").ModuleNode[] | undefined>; | ||
| export declare function handleHotUpdate(ctx: HmrContext, { logger, compile, astroFileToCompileMetadata }: HandleHotUpdateOptions): Promise<import("vite").ModuleNode[] | undefined>; | ||
| export declare function isStyleOnlyChanged(oldCode: string, newCode: string): boolean; | ||
| export {}; |
| import { parseAstroRequest } from "./query.js"; | ||
| import { frontmatterRE } from "./utils.js"; | ||
| async function handleHotUpdate(ctx, { logger, astroFileToCompileMetadata }) { | ||
| async function handleHotUpdate(ctx, { logger, compile, astroFileToCompileMetadata }) { | ||
| for (const [astroFile, compileData] of astroFileToCompileMetadata) { | ||
@@ -15,3 +15,7 @@ const isUpdatedFileCssDep = compileData.css.some((css) => css.dependencies?.includes(ctx.file)); | ||
| logger.debug("watch", "style-only change"); | ||
| astroFileToCompileMetadata.delete(ctx.file); | ||
| try { | ||
| await compile(newCode, ctx.file); | ||
| } catch { | ||
| astroFileToCompileMetadata.delete(ctx.file); | ||
| } | ||
| return ctx.modules.filter((mod) => { | ||
@@ -18,0 +22,0 @@ if (!mod.id) { |
@@ -249,3 +249,3 @@ import { defaultClientConditions, defaultServerConditions, normalizePath } from "vite"; | ||
| async handleHotUpdate(ctx) { | ||
| return handleHotUpdate(ctx, { logger, astroFileToCompileMetadata }); | ||
| return handleHotUpdate(ctx, { logger, compile, astroFileToCompileMetadata }); | ||
| } | ||
@@ -252,0 +252,0 @@ }, |
@@ -55,7 +55,8 @@ import { extname } from "node:path"; | ||
| ); | ||
| const normalizedSrcDir = normalizePath(fileURLToPath(settings.config.srcDir)); | ||
| async function rebuildRoutes(path = null, server) { | ||
| if (path != null && path.startsWith(settings.config.srcDir.pathname)) { | ||
| if (path != null && normalizePath(path).startsWith(normalizedSrcDir)) { | ||
| logger.debug( | ||
| "update", | ||
| `Re-calculating routes for ${path.slice(settings.config.srcDir.pathname.length)}` | ||
| `Re-calculating routes for ${normalizePath(path).slice(normalizedSrcDir.length)}` | ||
| ); | ||
@@ -62,0 +63,0 @@ const file = pathToFileURL(normalizePath(path)); |
+3
-3
| { | ||
| "name": "astro", | ||
| "version": "6.0.5", | ||
| "version": "6.0.6", | ||
| "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", | ||
@@ -156,4 +156,4 @@ "type": "module", | ||
| "zod": "^4.3.6", | ||
| "@astrojs/markdown-remark": "7.0.0", | ||
| "@astrojs/internal-helpers": "0.8.0", | ||
| "@astrojs/markdown-remark": "7.0.1", | ||
| "@astrojs/telemetry": "3.3.0" | ||
@@ -198,3 +198,3 @@ }, | ||
| "engines": { | ||
| "node": "^20.19.1 || >=22.12.0", | ||
| "node": ">=22.12.0", | ||
| "npm": ">=9.6.5", | ||
@@ -201,0 +201,0 @@ "pnpm": ">=7.1.0" |
@@ -114,7 +114,8 @@ declare module 'astro:content' { | ||
| >; | ||
| type ExtractLoaderConfig<T> = T extends { loader: infer L } ? L : never; | ||
| type InferLoaderSchema< | ||
| C extends keyof DataEntryMap, | ||
| L = Required<ContentConfig['collections'][C]>['loader'], | ||
| L = ExtractLoaderConfig<ContentConfig['collections'][C]>, | ||
| > = L extends { schema: import('astro/zod').ZodSchema } | ||
| ? import('astro/zod').infer<Required<ContentConfig['collections'][C]>['loader']['schema']> | ||
| ? import('astro/zod').infer<L['schema']> | ||
| : any; | ||
@@ -121,0 +122,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2601993
0.11%68700
0.1%+ Added
+ Added
- Removed
- Removed