Repository: withastro/astro
File: packages/astro/src/core/render-context.ts (TypeScript)

Code before:
			get session() {
				if (this.isPrerendered) {
					pipeline.logger.warn(
						'session',
						`context.session was used when rendering the route ${green(this.routePattern)}, but it is not available on prerendered routes. If you need access to sessions, make sure that the route is server-rendered using \`export const prerender = false;\` or by setting \`output\` to \`"server"\` in your Astro config to make all your routes server-rendered by default. For more information, see https://docs.astro.build/en/guides/sessions/`,
					);
					return undefined;
				}
				if (!renderContext.session) {
					pipeline.logger.warn(
						'session',
						`context.session was used when rendering the route ${green(this.routePattern)}, but no storage configuration was provided. Either configure the storage manually or use an adapter that provides session storage. For more information, see https://docs.astro.build/en/guides/sessions/`,
					);
					return undefined;
				}
				return renderContext.session;
			},
			insertDirective(payload) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.directives.push(payload);
			},

			insertScriptResource(resource) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.scriptResources.push(resource);
			},
			insertStyleResource(resource) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}

				renderContext.result?.styleResources.push(resource);
			},
			insertStyleHash(hash) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.styleHashes.push(hash);
			},
			insertScriptHash(hash) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.scriptHashes.push(hash);
			},
		};
	}

Review comment (suggestion):
```suggestion
				if (!pipeline.manifest.csp) {
```

Code after:
			get session() {
				if (this.isPrerendered) {
					pipeline.logger.warn(
						'session',
						`context.session was used when rendering the route ${green(this.routePattern)}, but it is not available on prerendered routes. If you need access to sessions, make sure that the route is server-rendered using \`export const prerender = false;\` or by setting \`output\` to \`"server"\` in your Astro config to make all your routes server-rendered by default. For more information, see https://docs.astro.build/en/guides/sessions/`,
					);
					return undefined;
				}
				if (!renderContext.session) {
					pipeline.logger.warn(
						'session',
						`context.session was used when rendering the route ${green(this.routePattern)}, but no storage configuration was provided. Either configure the storage manually or use an adapter that provides session storage. For more information, see https://docs.astro.build/en/guides/sessions/`,
					);
					return undefined;
				}
				return renderContext.session;
			},
			insertDirective(payload) {
				if (!pipeline.manifest.csp) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.directives.push(payload);
			},

			insertScriptResource(resource) {
				if (!pipeline.manifest.csp) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.scriptResources.push(resource);
			},
			insertStyleResource(resource) {
				if (!pipeline.manifest.csp) {
					throw new AstroError(CspNotEnabled);
				}

				renderContext.result?.styleResources.push(resource);
			},
			insertStyleHash(hash) {
				if (!pipeline.manifest.csp) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.styleHashes.push(hash);
			},
			insertScriptHash(hash) {
				if (!!pipeline.manifest.csp === false) {
					throw new AstroError(CspNotEnabled);
				}
				renderContext.result?.scriptHashes.push(hash);
			},
		};
	}