From 66111f8b711b040404417e0aa8057ddbc1ed040d Mon Sep 17 00:00:00 2001 From: Michael Seele Date: Tue, 30 Jan 2024 03:38:40 +0100 Subject: [PATCH] fix: use flatted to stringify circular JSON (#122) closes #121 --- packages/adapter/package.json | 1 + packages/adapter/src/index.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/adapter/package.json b/packages/adapter/package.json index 1a06a3a..d9642cd 100644 --- a/packages/adapter/package.json +++ b/packages/adapter/package.json @@ -74,6 +74,7 @@ "@astrojs/webapi": "^2.2.0", "@middy/core": "^5.0.1", "esbuild": "^0.19.5", + "flatted": "^3.2.9", "http-status-codes": "^2.3.0", "merge-anything": "^5.1.7", "pino": "^8.16.2" diff --git a/packages/adapter/src/index.ts b/packages/adapter/src/index.ts index 7c03cd0..67b5989 100644 --- a/packages/adapter/src/index.ts +++ b/packages/adapter/src/index.ts @@ -1,6 +1,8 @@ import { fileURLToPath } from "node:url" import { writeFile } from "node:fs/promises" +import { stringify } from "flatted" + import type { AstroAdapter, AstroConfig, AstroIntegration } from "astro" import type { Args } from "./args.js" @@ -77,7 +79,7 @@ const astroAWSFunctions = (args: Partial = {}): AstroIntegration => { "astro:build:done": async (options) => { await writeFile( fileURLToPath(new URL("metadata.json", astroConfig.outDir)), - JSON.stringify({ + stringify({ args: argsWithDefault, options, config: astroConfig,