| export declare const ASTRO_CONFIG_DEFAULTS: { | ||
| root: string; | ||
| srcDir: string; | ||
| publicDir: string; | ||
| outDir: string; | ||
| cacheDir: string; | ||
| base: string; | ||
| trailingSlash: "ignore"; | ||
| build: { | ||
| format: "directory"; | ||
| client: string; | ||
| server: string; | ||
| assets: string; | ||
| serverEntry: string; | ||
| redirects: true; | ||
| inlineStylesheets: "auto"; | ||
| concurrency: number; | ||
| }; | ||
| image: { | ||
| endpoint: { | ||
| entrypoint: undefined; | ||
| route: "/_image"; | ||
| }; | ||
| service: { | ||
| entrypoint: "astro/assets/services/sharp"; | ||
| config: {}; | ||
| }; | ||
| dangerouslyProcessSVG: false; | ||
| responsiveStyles: false; | ||
| }; | ||
| devToolbar: { | ||
| enabled: true; | ||
| }; | ||
| compressHTML: "jsx"; | ||
| server: { | ||
| host: false; | ||
| port: number; | ||
| open: false; | ||
| allowedHosts: never[]; | ||
| }; | ||
| integrations: never[]; | ||
| markdown: Required<Omit<import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, "image">>; | ||
| vite: {}; | ||
| legacy: { | ||
| collectionsBackwardsCompat: false; | ||
| }; | ||
| redirects: {}; | ||
| security: { | ||
| checkOrigin: true; | ||
| allowedDomains: never[]; | ||
| csp: false; | ||
| actionBodySizeLimit: number; | ||
| serverIslandBodySizeLimit: number; | ||
| }; | ||
| env: { | ||
| schema: {}; | ||
| validateSecrets: false; | ||
| }; | ||
| prerenderConflictBehavior: "warn"; | ||
| fetchFile: string; | ||
| experimental: { | ||
| clientPrerender: false; | ||
| contentIntellisense: false; | ||
| chromeDevtoolsWorkspace: false; | ||
| collectionStorage: "single-file"; | ||
| }; | ||
| }; |
| import { markdownConfigDefaults } from "@astrojs/internal-helpers/markdown"; | ||
| const ASTRO_CONFIG_DEFAULTS = { | ||
| root: ".", | ||
| srcDir: "./src", | ||
| publicDir: "./public", | ||
| outDir: "./dist", | ||
| cacheDir: "./node_modules/.astro", | ||
| base: "/", | ||
| trailingSlash: "ignore", | ||
| build: { | ||
| format: "directory", | ||
| client: "./client/", | ||
| server: "./server/", | ||
| assets: "_astro", | ||
| serverEntry: "entry.mjs", | ||
| redirects: true, | ||
| inlineStylesheets: "auto", | ||
| concurrency: 1 | ||
| }, | ||
| image: { | ||
| endpoint: { entrypoint: void 0, route: "/_image" }, | ||
| service: { entrypoint: "astro/assets/services/sharp", config: {} }, | ||
| dangerouslyProcessSVG: false, | ||
| responsiveStyles: false | ||
| }, | ||
| devToolbar: { | ||
| enabled: true | ||
| }, | ||
| compressHTML: "jsx", | ||
| server: { | ||
| host: false, | ||
| port: 4321, | ||
| open: false, | ||
| allowedHosts: [] | ||
| }, | ||
| integrations: [], | ||
| markdown: markdownConfigDefaults, | ||
| vite: {}, | ||
| legacy: { | ||
| collectionsBackwardsCompat: false | ||
| }, | ||
| redirects: {}, | ||
| security: { | ||
| checkOrigin: true, | ||
| allowedDomains: [], | ||
| csp: false, | ||
| actionBodySizeLimit: 1024 * 1024, | ||
| serverIslandBodySizeLimit: 1024 * 1024 | ||
| }, | ||
| env: { | ||
| schema: {}, | ||
| validateSecrets: false | ||
| }, | ||
| prerenderConflictBehavior: "warn", | ||
| fetchFile: "fetch", | ||
| experimental: { | ||
| clientPrerender: false, | ||
| contentIntellisense: false, | ||
| chromeDevtoolsWorkspace: false, | ||
| collectionStorage: "single-file" | ||
| } | ||
| }; | ||
| export { | ||
| ASTRO_CONFIG_DEFAULTS | ||
| }; |
@@ -171,2 +171,13 @@ import type { OmitPreservingIndexSignature, Simplify, WithRequired } from '../type-utils.js'; | ||
| position?: string; | ||
| /** | ||
| * The background color to use when converting images with transparency to a format that does not support it (e.g. PNG to JPEG). | ||
| * | ||
| * The value is a string that specifies a CSS color value, e.g. `#fff`, `white`, `rgb(255, 255, 255)`. | ||
| * | ||
| * **Example**: | ||
| * ```astro | ||
| * <Image src={...} format="jpeg" background="#fff" alt="..." /> | ||
| * ``` | ||
| */ | ||
| background?: string; | ||
| } & ({ | ||
@@ -173,0 +184,0 @@ /** |
@@ -69,2 +69,3 @@ import { spawn } from "node:child_process"; | ||
| detached: true, | ||
| windowsHide: true, | ||
| stdio: ["ignore", logFd, logFd], | ||
@@ -71,0 +72,0 @@ cwd: rootPath, |
| class BuildTimeAstroVersionProvider { | ||
| // Injected during the build through esbuild define | ||
| version = "7.1.3"; | ||
| version = "7.1.4"; | ||
| } | ||
@@ -5,0 +5,0 @@ export { |
+17
-20
@@ -1,5 +0,3 @@ | ||
| import { posix } from "node:path"; | ||
| import { getDefaultClientDirectives } from "../core/client-directive/index.js"; | ||
| import { ASTRO_CONFIG_DEFAULTS } from "../core/config/schemas/index.js"; | ||
| import { validateConfig } from "../core/config/validate.js"; | ||
| import { getDefaultClientDirectives } from "../core/client-directive/default.js"; | ||
| import { ASTRO_CONFIG_DEFAULTS } from "../core/config/schemas/defaults.js"; | ||
| import { createKey } from "../core/encryption.js"; | ||
@@ -17,4 +15,2 @@ import { FetchState } from "../core/fetch/fetch-state.js"; | ||
| import { createConsoleLogger } from "../core/logger/impls/console.js"; | ||
| const { gfm: _, smartypants: __, ...containerMarkdownDefaults } = ASTRO_CONFIG_DEFAULTS.markdown; | ||
| const CONTAINER_CONFIG_DEFAULTS = { ...ASTRO_CONFIG_DEFAULTS, markdown: containerMarkdownDefaults }; | ||
| function createManifest(manifest, renderers, middleware) { | ||
@@ -26,3 +22,8 @@ function middlewareInstance() { | ||
| } | ||
| const root = new URL(import.meta.url); | ||
| let root; | ||
| try { | ||
| root = new URL(import.meta.url); | ||
| } catch { | ||
| root = new URL("file:///container/"); | ||
| } | ||
| return { | ||
@@ -86,8 +87,8 @@ rootDir: root, | ||
| renderers, | ||
| resolve, | ||
| astroConfig | ||
| resolve | ||
| }) { | ||
| const ssrManifest = createManifest(manifest, renderers); | ||
| this.#pipeline = ContainerPipeline.create({ | ||
| logger: createConsoleLogger({ level: "error" }), | ||
| manifest: createManifest(manifest, renderers), | ||
| manifest: ssrManifest, | ||
| streaming, | ||
@@ -97,3 +98,3 @@ renderers: renderers ?? manifest?.renderers ?? [], | ||
| if (this.#withManifest) { | ||
| return this.#containerResolve(specifier, astroConfig); | ||
| return this.#containerResolve(specifier, ssrManifest); | ||
| } else if (resolve) { | ||
@@ -108,6 +109,6 @@ return resolve(specifier); | ||
| } | ||
| async #containerResolve(specifier, astroConfig) { | ||
| const found = this.#pipeline.manifest.entryModules[specifier]; | ||
| async #containerResolve(specifier, manifest) { | ||
| const found = manifest.entryModules[specifier]; | ||
| if (found) { | ||
| return new URL(found, astroConfig?.build.client).toString(); | ||
| return new URL(found, manifest.buildClientDir).toString(); | ||
| } | ||
@@ -123,3 +124,2 @@ return found; | ||
| const { streaming = false, manifest, renderers = [], resolve } = containerOptions; | ||
| const astroConfig = await validateConfig(CONTAINER_CONFIG_DEFAULTS, process.cwd(), "container"); | ||
| return new experimental_AstroContainer({ | ||
@@ -129,3 +129,2 @@ streaming, | ||
| renderers, | ||
| astroConfig, | ||
| resolve | ||
@@ -218,6 +217,4 @@ }); | ||
| static async createFromManifest(manifest) { | ||
| const astroConfig = await validateConfig(CONTAINER_CONFIG_DEFAULTS, process.cwd(), "container"); | ||
| const container = new experimental_AstroContainer({ | ||
| manifest, | ||
| astroConfig | ||
| manifest | ||
| }); | ||
@@ -341,3 +338,3 @@ container.#withManifest = true; | ||
| #createRoute(url, params, type) { | ||
| const segments = removeLeadingForwardSlash(url.pathname).split(posix.sep).filter(Boolean).map((s) => { | ||
| const segments = removeLeadingForwardSlash(url.pathname).split("/").filter(Boolean).map((s) => { | ||
| validateSegment(s); | ||
@@ -344,0 +341,0 @@ return getParts(s, url.pathname); |
@@ -199,3 +199,3 @@ import { existsSync, promises as fs } from "node:fs"; | ||
| } | ||
| if (previousAstroVersion && previousAstroVersion !== "7.1.3") { | ||
| if (previousAstroVersion && previousAstroVersion !== "7.1.4") { | ||
| logger.info("Astro version changed"); | ||
@@ -208,4 +208,4 @@ shouldClear = true; | ||
| } | ||
| if ("7.1.3") { | ||
| this.#store.metaStore().set("astro-version", "7.1.3"); | ||
| if ("7.1.4") { | ||
| this.#store.metaStore().set("astro-version", "7.1.4"); | ||
| } | ||
@@ -212,0 +212,0 @@ if (currentConfigDigest) { |
| import { existsSync, promises as fs } from "node:fs"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import yaml from "js-yaml"; | ||
| import toml from "smol-toml"; | ||
| import * as toml from "smol-toml"; | ||
| import { FileGlobNotSupported, FileParserNotFound } from "../../core/errors/errors-data.js"; | ||
@@ -6,0 +6,0 @@ import { AstroError } from "../../core/errors/index.js"; |
@@ -235,3 +235,8 @@ import { existsSync, promises as fs } from "node:fs"; | ||
| watcher.add(filePath); | ||
| const matchesGlob = (entry) => !entry.startsWith("../") && picomatch.isMatch(entry, globOptions.pattern); | ||
| const patterns = Array.isArray(globOptions.pattern) ? globOptions.pattern : [globOptions.pattern]; | ||
| const positivePatterns = patterns.filter((p) => !p.startsWith("!")); | ||
| const negationPatterns = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1)); | ||
| const matchesGlob = (entry) => !entry.startsWith("../") && picomatch.isMatch(entry, positivePatterns, { | ||
| ignore: negationPatterns.length > 0 ? negationPatterns : void 0 | ||
| }); | ||
| const basePath = fileURLToPath(baseDir); | ||
@@ -238,0 +243,0 @@ async function onChange(changedPath) { |
@@ -14,2 +14,10 @@ import type { SSRResult } from '../../types/public/internal.js'; | ||
| /** | ||
| * Maps a key describing the exact set of CSS modules bundled into a chunk of the | ||
| * prerender environment to the CSS asset filename emitted for that chunk. The SSR | ||
| * environment renames its own CSS assets to these filenames when they are backed by | ||
| * the same CSS source modules, so the prerender and server builds don't emit | ||
| * duplicate stylesheets for shared layouts (#17298). | ||
| */ | ||
| prerenderCssAssetByModuleKey: Map<string, string>; | ||
| /** | ||
| * If script is inlined, its id and inlined code is mapped here. The resolved id is | ||
@@ -16,0 +24,0 @@ * an URL like "/_astro/something.js" but will no longer exist as the content is now |
@@ -7,2 +7,3 @@ import { prependForwardSlash, removeFileExtension } from "../path.js"; | ||
| cssModuleToChunkIdMap: /* @__PURE__ */ new Map(), | ||
| prerenderCssAssetByModuleKey: /* @__PURE__ */ new Map(), | ||
| inlinedScripts: /* @__PURE__ */ new Map(), | ||
@@ -9,0 +10,0 @@ entrySpecifierToBundleMap: /* @__PURE__ */ new Map(), |
@@ -49,2 +49,16 @@ import { isCSSRequest } from "vite"; | ||
| } | ||
| const cssModuleIds = Object.keys(chunk.modules || {}).filter(isCSSRequest); | ||
| const importedCss = chunk.viteMetadata?.importedCss; | ||
| if (cssModuleIds.length > 0 && importedCss?.size === 1) { | ||
| const moduleKey = cssModuleIds.sort().join("\n"); | ||
| const [assetFileName] = importedCss; | ||
| if (this.environment?.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender) { | ||
| internals.prerenderCssAssetByModuleKey.set(moduleKey, assetFileName); | ||
| } else { | ||
| const prerenderFileName = internals.prerenderCssAssetByModuleKey.get(moduleKey); | ||
| if (prerenderFileName && prerenderFileName !== assetFileName) { | ||
| renameBundleAsset(bundle, assetFileName, prerenderFileName); | ||
| } | ||
| } | ||
| } | ||
| for (const [moduleId, moduleInfo] of Object.entries(chunk.modules || {})) { | ||
@@ -116,2 +130,17 @@ if (moduleInfo.renderedExports.length > 0) { | ||
| cssToInfoRecord[importedCssImport] = { depth: -1, order: -1 }; | ||
| if (deletedCssAssets.has(importedCssImport)) { | ||
| const cssAsset = deletedCssAssets.get(importedCssImport); | ||
| if (cssAsset.type === "asset" && typeof cssAsset.source === "string" && cssAsset.source.length > 0) { | ||
| const sheet = { | ||
| type: "inline", | ||
| content: cssAsset.source | ||
| }; | ||
| const alreadyAdded = pageData.styles.some( | ||
| (s) => s.sheet.type === "inline" && s.sheet.content === sheet.content | ||
| ); | ||
| if (!alreadyAdded) { | ||
| pageData.styles.push({ depth: -1, order: -1, sheet }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
@@ -321,2 +350,17 @@ } | ||
| } | ||
| function renameBundleAsset(bundle, fromFileName, toFileName) { | ||
| const asset = bundle[fromFileName]; | ||
| if (!asset || asset.type !== "asset" || bundle[toFileName]) return; | ||
| asset.fileName = toFileName; | ||
| for (const chunk of Object.values(bundle)) { | ||
| if (chunk.type !== "chunk") continue; | ||
| const meta = chunk.viteMetadata; | ||
| if (meta?.importedCss?.delete(fromFileName)) { | ||
| meta.importedCss.add(toFileName); | ||
| } | ||
| if (meta?.importedAssets?.delete(fromFileName)) { | ||
| meta.importedAssets.add(toFileName); | ||
| } | ||
| } | ||
| } | ||
| function shouldDeleteCSSChunk(allModules, internals) { | ||
@@ -323,0 +367,0 @@ const componentPaths = /* @__PURE__ */ new Set(); |
@@ -19,69 +19,4 @@ import type { RehypePlugin as _RehypePlugin, RemarkPlugin as _RemarkPlugin, RemarkRehype as _RemarkRehype, Smartypants as _Smartypants, ShikiConfig } from '@astrojs/internal-helpers/markdown'; | ||
| export type Smartypants = ComplexifyWithOmit<_Smartypants>; | ||
| export declare const ASTRO_CONFIG_DEFAULTS: { | ||
| root: string; | ||
| srcDir: string; | ||
| publicDir: string; | ||
| outDir: string; | ||
| cacheDir: string; | ||
| base: string; | ||
| trailingSlash: "ignore"; | ||
| build: { | ||
| format: "directory"; | ||
| client: string; | ||
| server: string; | ||
| assets: string; | ||
| serverEntry: string; | ||
| redirects: true; | ||
| inlineStylesheets: "auto"; | ||
| concurrency: number; | ||
| }; | ||
| image: { | ||
| endpoint: { | ||
| entrypoint: undefined; | ||
| route: "/_image"; | ||
| }; | ||
| service: { | ||
| entrypoint: "astro/assets/services/sharp"; | ||
| config: {}; | ||
| }; | ||
| dangerouslyProcessSVG: false; | ||
| responsiveStyles: false; | ||
| }; | ||
| devToolbar: { | ||
| enabled: true; | ||
| }; | ||
| compressHTML: "jsx"; | ||
| server: { | ||
| host: false; | ||
| port: number; | ||
| open: false; | ||
| allowedHosts: never[]; | ||
| }; | ||
| integrations: never[]; | ||
| markdown: Required<Omit<import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, "image">>; | ||
| vite: {}; | ||
| legacy: { | ||
| collectionsBackwardsCompat: false; | ||
| }; | ||
| redirects: {}; | ||
| security: { | ||
| checkOrigin: true; | ||
| allowedDomains: never[]; | ||
| csp: false; | ||
| actionBodySizeLimit: number; | ||
| serverIslandBodySizeLimit: number; | ||
| }; | ||
| env: { | ||
| schema: {}; | ||
| validateSecrets: false; | ||
| }; | ||
| prerenderConflictBehavior: "warn"; | ||
| fetchFile: string; | ||
| experimental: { | ||
| clientPrerender: false; | ||
| contentIntellisense: false; | ||
| chromeDevtoolsWorkspace: false; | ||
| collectionStorage: "single-file"; | ||
| }; | ||
| }; | ||
| import { ASTRO_CONFIG_DEFAULTS } from './defaults.js'; | ||
| export { ASTRO_CONFIG_DEFAULTS }; | ||
| export declare const AstroConfigSchema: z.ZodObject<{ | ||
@@ -567,2 +502,1 @@ root: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>; | ||
| export type AstroConfigType = z.infer<typeof AstroConfigSchema>; | ||
| export {}; |
@@ -1,5 +0,2 @@ | ||
| import { | ||
| markdownConfigDefaults, | ||
| syntaxHighlightDefaults | ||
| } from "@astrojs/internal-helpers/markdown"; | ||
| import { syntaxHighlightDefaults } from "@astrojs/internal-helpers/markdown"; | ||
| import { satteri } from "@astrojs/markdown-satteri"; | ||
@@ -19,63 +16,3 @@ import { bundledThemes } from "shiki"; | ||
| import { SessionSchema } from "../../session/config.js"; | ||
| const ASTRO_CONFIG_DEFAULTS = { | ||
| root: ".", | ||
| srcDir: "./src", | ||
| publicDir: "./public", | ||
| outDir: "./dist", | ||
| cacheDir: "./node_modules/.astro", | ||
| base: "/", | ||
| trailingSlash: "ignore", | ||
| build: { | ||
| format: "directory", | ||
| client: "./client/", | ||
| server: "./server/", | ||
| assets: "_astro", | ||
| serverEntry: "entry.mjs", | ||
| redirects: true, | ||
| inlineStylesheets: "auto", | ||
| concurrency: 1 | ||
| }, | ||
| image: { | ||
| endpoint: { entrypoint: void 0, route: "/_image" }, | ||
| service: { entrypoint: "astro/assets/services/sharp", config: {} }, | ||
| dangerouslyProcessSVG: false, | ||
| responsiveStyles: false | ||
| }, | ||
| devToolbar: { | ||
| enabled: true | ||
| }, | ||
| compressHTML: "jsx", | ||
| server: { | ||
| host: false, | ||
| port: 4321, | ||
| open: false, | ||
| allowedHosts: [] | ||
| }, | ||
| integrations: [], | ||
| markdown: markdownConfigDefaults, | ||
| vite: {}, | ||
| legacy: { | ||
| collectionsBackwardsCompat: false | ||
| }, | ||
| redirects: {}, | ||
| security: { | ||
| checkOrigin: true, | ||
| allowedDomains: [], | ||
| csp: false, | ||
| actionBodySizeLimit: 1024 * 1024, | ||
| serverIslandBodySizeLimit: 1024 * 1024 | ||
| }, | ||
| env: { | ||
| schema: {}, | ||
| validateSecrets: false | ||
| }, | ||
| prerenderConflictBehavior: "warn", | ||
| fetchFile: "fetch", | ||
| experimental: { | ||
| clientPrerender: false, | ||
| contentIntellisense: false, | ||
| chromeDevtoolsWorkspace: false, | ||
| collectionStorage: "single-file" | ||
| } | ||
| }; | ||
| import { ASTRO_CONFIG_DEFAULTS } from "./defaults.js"; | ||
| const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type); | ||
@@ -82,0 +19,0 @@ const quoteCharacterMapSchema = z.object({ |
| import path from "node:path"; | ||
| import { fileURLToPath, pathToFileURL } from "node:url"; | ||
| import yaml from "js-yaml"; | ||
| import toml from "smol-toml"; | ||
| import * as toml from "smol-toml"; | ||
| import { getContentPaths } from "../../content/index.js"; | ||
@@ -6,0 +6,0 @@ import createPreferences from "../../preferences/index.js"; |
@@ -26,3 +26,3 @@ import { pathToFileURL } from "node:url"; | ||
| const plugins = loadFallbackPlugin({ fs, root: pathToFileURL(root) }); | ||
| server = await createMinimalViteDevServer(plugins); | ||
| server = await createMinimalViteDevServer(plugins, root); | ||
| if (isRunnableDevEnvironment(server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr])) { | ||
@@ -29,0 +29,0 @@ const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]; |
@@ -1,2 +0,2 @@ | ||
| const ASTRO_VERSION = "7.1.3"; | ||
| const ASTRO_VERSION = "7.1.4"; | ||
| const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`; | ||
@@ -3,0 +3,0 @@ const ASTRO_ERROR_HEADER = "X-Astro-Error"; |
@@ -52,3 +52,3 @@ import { parseCookie, stringifySetCookie } from "cookie"; | ||
| expires: DELETED_EXPIRATION, | ||
| // Unset `expires` to to ensure that `expires` takes precedence. | ||
| // Unset `maxAge` to ensure that `expires` takes precedence. | ||
| maxAge: void 0 | ||
@@ -55,0 +55,0 @@ }), |
@@ -8,2 +8,2 @@ import { type ViteDevServer, type Plugin } from 'vite'; | ||
| */ | ||
| export declare function createMinimalViteDevServer(plugins?: Plugin[]): Promise<ViteDevServer>; | ||
| export declare function createMinimalViteDevServer(plugins?: Plugin[], root?: string): Promise<ViteDevServer>; |
| import { createServer } from "vite"; | ||
| async function createMinimalViteDevServer(plugins = []) { | ||
| async function createMinimalViteDevServer(plugins = [], root) { | ||
| return await createServer({ | ||
| root, | ||
| configFile: false, | ||
@@ -10,2 +11,3 @@ server: { middlewareMode: true, hmr: false, watch: null, ws: false }, | ||
| ssr: { external: true }, | ||
| resolve: { tsconfigPaths: true }, | ||
| plugins | ||
@@ -12,0 +14,0 @@ }); |
@@ -29,3 +29,3 @@ import fs from "node:fs"; | ||
| const logger = restart.container.logger; | ||
| const currentVersion = "7.1.3"; | ||
| const currentVersion = "7.1.4"; | ||
| const isPrerelease = currentVersion.includes("-"); | ||
@@ -32,0 +32,0 @@ if (!isPrerelease) { |
@@ -273,3 +273,3 @@ import colors from "piccolore"; | ||
| ` ${bgGreen(black(` ${commandName} `))} ${green( | ||
| `v${"7.1.3"}` | ||
| `v${"7.1.4"}` | ||
| )} ${headline}` | ||
@@ -276,0 +276,0 @@ ); |
| import type { SessionDriverConfig } from './types.js'; | ||
| export declare const sessionDrivers: { | ||
| fs: (config?: import("unstorage/drivers/fs").FSStorageOptions | undefined) => SessionDriverConfig; | ||
| http: (config?: import("unstorage/drivers/http").HTTPOptions | undefined) => SessionDriverConfig; | ||
| fs: (config?: import("unstorage/drivers/fs").FSStorageOptions | undefined) => SessionDriverConfig; | ||
| azureAppConfiguration: (config?: import("unstorage/drivers/azure-app-configuration").AzureAppConfigurationOptions | undefined) => SessionDriverConfig; | ||
@@ -6,0 +6,0 @@ azureCosmos: (config?: import("unstorage/drivers/azure-cosmos").AzureCosmosOptions | undefined) => SessionDriverConfig; |
@@ -23,3 +23,4 @@ import { PipelineFeatures } from "../base-pipeline.js"; | ||
| driverFactory, | ||
| mockStorage: null | ||
| mockStorage: null, | ||
| logger: pipeline.logger | ||
| }); | ||
@@ -26,0 +27,0 @@ }, |
| import type { RuntimeMode } from '../../types/public/config.js'; | ||
| import type { AstroCookies } from '../cookies/cookies.js'; | ||
| import type { AstroLogger } from '../logger/core.js'; | ||
| import type { SessionDriverFactory } from './types.js'; | ||
@@ -7,11 +8,13 @@ import type { SSRManifestSession } from '../app/types.js'; | ||
| export declare const PERSIST_SYMBOL: unique symbol; | ||
| export interface AstroSessionOptions { | ||
| cookies: AstroCookies; | ||
| config: SSRManifestSession | undefined; | ||
| runtimeMode: RuntimeMode; | ||
| driverFactory: SessionDriverFactory | null; | ||
| mockStorage: Storage | null; | ||
| logger: AstroLogger; | ||
| } | ||
| export declare class AstroSession { | ||
| #private; | ||
| constructor({ cookies, config, runtimeMode, driverFactory, mockStorage, }: { | ||
| cookies: AstroCookies; | ||
| config: SSRManifestSession | undefined; | ||
| runtimeMode: RuntimeMode; | ||
| driverFactory: SessionDriverFactory | null; | ||
| mockStorage: Storage | null; | ||
| }); | ||
| constructor({ cookies, config, runtimeMode, driverFactory, mockStorage, logger, }: AstroSessionOptions); | ||
| /** | ||
@@ -18,0 +21,0 @@ * Gets a session value. Returns `undefined` if the session or value does not exist. |
@@ -49,3 +49,3 @@ import { stringify as rawStringify, unflatten as rawUnflatten } from "devalue"; | ||
| #partial = true; | ||
| // The driver factory function provided by the pipeline | ||
| #logger; | ||
| #driverFactory; | ||
@@ -58,4 +58,6 @@ static #sharedStorage = /* @__PURE__ */ new Map(); | ||
| driverFactory, | ||
| mockStorage | ||
| mockStorage, | ||
| logger | ||
| }) { | ||
| this.#logger = logger; | ||
| if (!config) { | ||
@@ -190,3 +192,4 @@ throw new AstroError({ | ||
| } catch (err) { | ||
| console.error("Failed to load session data during regeneration:", err); | ||
| this.#logger.error("session", `Failed to load session data during regeneration: ${err}`); | ||
| this.#partial = false; | ||
| } | ||
@@ -201,3 +204,3 @@ const oldSessionId = this.#sessionID; | ||
| this.#storage.removeItem(oldSessionId).catch((err) => { | ||
| console.error("Failed to remove old session data:", err); | ||
| this.#logger.error("session", `Failed to remove old session ${oldSessionId}: ${err}`); | ||
| }); | ||
@@ -239,3 +242,3 @@ } | ||
| (sessionId) => storage.removeItem(sessionId).catch((err) => { | ||
| console.error("Failed to clean up session %s:", sessionId, err); | ||
| this.#logger.error("session", `Failed to remove session ${sessionId}: ${err}`); | ||
| }) | ||
@@ -304,3 +307,3 @@ ); | ||
| if (!(storedMap instanceof Map)) { | ||
| await this.destroy(); | ||
| this.destroy(); | ||
| throw new AstroError({ | ||
@@ -324,3 +327,3 @@ ...SessionStorageInitError, | ||
| } catch (err) { | ||
| await this.destroy(); | ||
| this.destroy(); | ||
| if (err instanceof AstroError) { | ||
@@ -327,0 +330,0 @@ throw err; |
+6
-6
| { | ||
| "name": "astro", | ||
| "version": "7.1.3", | ||
| "version": "7.1.4", | ||
| "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", | ||
@@ -124,3 +124,3 @@ "type": "module", | ||
| "jsonc-parser": "^3.3.1", | ||
| "magic-string": "^0.30.21", | ||
| "magic-string": "^1.0.0", | ||
| "magicast": "^0.5.2", | ||
@@ -151,4 +151,4 @@ "mrmime": "^2.0.1", | ||
| "@astrojs/internal-helpers": "0.10.1", | ||
| "@astrojs/telemetry": "3.3.3", | ||
| "@astrojs/markdown-satteri": "0.3.4" | ||
| "@astrojs/markdown-satteri": "0.3.4", | ||
| "@astrojs/telemetry": "3.3.3" | ||
| }, | ||
@@ -191,3 +191,3 @@ "optionalDependencies": { | ||
| "vitest": "^4.1.0", | ||
| "@astrojs/check": "0.9.9", | ||
| "@astrojs/check": "0.9.10", | ||
| "@astrojs/markdown-remark": "7.2.1", | ||
@@ -210,3 +210,3 @@ "astro-scripts": "0.0.14" | ||
| "prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"", | ||
| "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc -b && astro-check -- -- --root ./components", | ||
| "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc -b && astro-check -- -- --tsconfig ./tsconfig.components.json", | ||
| "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm", | ||
@@ -213,0 +213,0 @@ "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"", |
| /// <reference path="../client.d.ts" /> | ||
| /// <reference path="../dev-only.d.ts" /> |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2877096
0.12%1296
0.08%75438
0.1%+ Added
- Removed
Updated