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

Code before:
					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);
			},
		};
	}

	async createResult(mod: ComponentInstance, ctx: ActionAPIContext): Promise<SSRResult> {
		const { cookies, pathname, pipeline, routeData, status } = this;
		const { clientDirectives, inlinedScripts, compressHTML, manifest, renderers, resolve } =
			pipeline;
		const { links, scripts, styles } = await pipeline.headElements(routeData);

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

Code after:
					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);
			},
		};
	}

	async createResult(mod: ComponentInstance, ctx: ActionAPIContext): Promise<SSRResult> {
		const { cookies, pathname, pipeline, routeData, status } = this;
		const { clientDirectives, inlinedScripts, compressHTML, manifest, renderers, resolve } =
			pipeline;
		const { links, scripts, styles } = await pipeline.headElements(routeData);