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

Code before:
					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);
		const componentMetadata =
			(await pipeline.componentMetadata(routeData)) ?? manifest.componentMetadata;
		const headers = new Headers({ 'Content-Type': 'text/html' });
		const partial = typeof this.partial === 'boolean' ? this.partial : Boolean(mod.partial);
		const actionResult = hasActionPayload(this.locals)
			? deserializeActionResult(this.locals._actionPayload.actionResult)
			: undefined;

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

Code after:
					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);
		const componentMetadata =
			(await pipeline.componentMetadata(routeData)) ?? manifest.componentMetadata;
		const headers = new Headers({ 'Content-Type': 'text/html' });
		const partial = typeof this.partial === 'boolean' ? this.partial : Boolean(mod.partial);
		const actionResult = hasActionPayload(this.locals)
			? deserializeActionResult(this.locals._actionPayload.actionResult)
			: undefined;