From 63df19113f640cf938032ae5f93ddb3615623a1a Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Fri, 18 Oct 2024 10:44:56 +0800 Subject: [PATCH] feat: change the option for container API. no need to replace the doctype. --- package-lock.json | 112 +++++++++++++++++++-------------------- package.json | 6 +-- src/helpers/container.ts | 4 +- 3 files changed, 60 insertions(+), 62 deletions(-) diff --git a/package-lock.json b/package-lock.json index d2e5b11..d60b77b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@astrojs/mdx": "^3.1.8", "@astrojs/rss": "^4.0.9", "@zeabur/astro-adapter": "^1.0.6", - "astro": "^4.16.5", + "astro": "^4.16.6", "drizzle-orm": "^0.35.1", "fuse.js": "^7.0.0", "lodash": "^4.17.21", @@ -24,11 +24,11 @@ }, "devDependencies": { "@astrojs/check": "^0.9.4", - "@biomejs/biome": "^1.9.3", + "@biomejs/biome": "^1.9.4", "@napi-rs/canvas": "^0.1.58", "@types/lodash": "^4.17.10", "@types/luxon": "^3.4.2", - "@types/node": "^22.7.5", + "@types/node": "^22.7.6", "@types/pg": "^8.11.10", "@types/qrcode-svg": "^1.1.5", "@types/unist": "^3.0.3", @@ -97,9 +97,9 @@ "license": "MIT" }, "node_modules/@astrojs/language-server": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/@astrojs/language-server/-/language-server-2.15.0.tgz", - "integrity": "sha512-wJHSjGApm5X8Rg1GvkevoatZBfvaFizY4kCPvuSYgs3jGCobuY3KstJGKC1yNLsRJlDweHruP+J54iKn9vEKoA==", + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/@astrojs/language-server/-/language-server-2.15.3.tgz", + "integrity": "sha512-2qYkHkiqduB2F6OY+zAikd2hZP1xq5LqB0RqLCMoT7KLbfspnx6qtxOueF2n1P4+YUXRHUJVfLA4FoJCEfoMDg==", "dev": true, "license": "MIT", "dependencies": { @@ -559,9 +559,9 @@ } }, "node_modules/@biomejs/biome": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.3.tgz", - "integrity": "sha512-POjAPz0APAmX33WOQFGQrwLvlu7WLV4CFJMlB12b6ZSg+2q6fYu9kZwLCOA+x83zXfcPd1RpuWOKJW0GbBwLIQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", "dev": true, "hasInstallScript": true, "license": "MIT OR Apache-2.0", @@ -576,20 +576,20 @@ "url": "https://opencollective.com/biome" }, "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.9.3", - "@biomejs/cli-darwin-x64": "1.9.3", - "@biomejs/cli-linux-arm64": "1.9.3", - "@biomejs/cli-linux-arm64-musl": "1.9.3", - "@biomejs/cli-linux-x64": "1.9.3", - "@biomejs/cli-linux-x64-musl": "1.9.3", - "@biomejs/cli-win32-arm64": "1.9.3", - "@biomejs/cli-win32-x64": "1.9.3" + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" } }, "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.3.tgz", - "integrity": "sha512-QZzD2XrjJDUyIZK+aR2i5DDxCJfdwiYbUKu9GzkCUJpL78uSelAHAPy7m0GuPMVtF/Uo+OKv97W3P9nuWZangQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", "cpu": [ "arm64" ], @@ -604,9 +604,9 @@ } }, "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.3.tgz", - "integrity": "sha512-vSCoIBJE0BN3SWDFuAY/tRavpUtNoqiceJ5PrU3xDfsLcm/U6N93JSM0M9OAiC/X7mPPfejtr6Yc9vSgWlEgVw==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", "cpu": [ "x64" ], @@ -621,9 +621,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.3.tgz", - "integrity": "sha512-vJkAimD2+sVviNTbaWOGqEBy31cW0ZB52KtpVIbkuma7PlfII3tsLhFa+cwbRAcRBkobBBhqZ06hXoZAN8NODQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", "cpu": [ "arm64" ], @@ -638,9 +638,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64-musl": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.3.tgz", - "integrity": "sha512-VBzyhaqqqwP3bAkkBrhVq50i3Uj9+RWuj+pYmXrMDgjS5+SKYGE56BwNw4l8hR3SmYbLSbEo15GcV043CDSk+Q==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", "cpu": [ "arm64" ], @@ -655,9 +655,9 @@ } }, "node_modules/@biomejs/cli-linux-x64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.3.tgz", - "integrity": "sha512-x220V4c+romd26Mu1ptU+EudMXVS4xmzKxPVb9mgnfYlN4Yx9vD5NZraSx/onJnd3Gh/y8iPUdU5CDZJKg9COA==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", "cpu": [ "x64" ], @@ -672,9 +672,9 @@ } }, "node_modules/@biomejs/cli-linux-x64-musl": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.3.tgz", - "integrity": "sha512-TJmnOG2+NOGM72mlczEsNki9UT+XAsMFAOo8J0me/N47EJ/vkLXxf481evfHLlxMejTY6IN8SdRSiPVLv6AHlA==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", "cpu": [ "x64" ], @@ -689,9 +689,9 @@ } }, "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.3.tgz", - "integrity": "sha512-lg/yZis2HdQGsycUvHWSzo9kOvnGgvtrYRgoCEwPBwwAL8/6crOp3+f47tPwI/LI1dZrhSji7PNsGKGHbwyAhw==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", "cpu": [ "arm64" ], @@ -706,9 +706,9 @@ } }, "node_modules/@biomejs/cli-win32-x64": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.3.tgz", - "integrity": "sha512-cQMy2zanBkVLpmmxXdK6YePzmZx0s5Z7KEnwmrW54rcXK3myCNbQa09SwGZ8i/8sLw0H9F3X7K4rxVNGU8/D4Q==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", "cpu": [ "x64" ], @@ -2534,9 +2534,9 @@ } }, "node_modules/@types/node": { - "version": "22.7.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", - "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "version": "22.7.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.6.tgz", + "integrity": "sha512-/d7Rnj0/ExXDMcioS78/kf1lMzYk4BZV8MZGTBKzTGZ6/406ukkbYlIsZmMPhcR5KlkunDHQLrtAVmSq7r+mSw==", "devOptional": true, "license": "MIT", "dependencies": { @@ -2910,9 +2910,9 @@ } }, "node_modules/astro": { - "version": "4.16.5", - "resolved": "https://registry.npmjs.org/astro/-/astro-4.16.5.tgz", - "integrity": "sha512-v8mKWcEPN7hkfyVsMFWV0F8UgL4GUJKT172KTB7dePO3yJb64HBwCckC0QnA60QQh3jK6+2xwyWEc5QvCeqjtg==", + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/astro/-/astro-4.16.6.tgz", + "integrity": "sha512-LMMbjr+4aN26MOyJzTdjM+Y+srpAIkx7IX9IcdF3eHQLGr8PgkioZp+VQExRfioDIyA2HY6ottVg3QccTzJqYA==", "license": "MIT", "dependencies": { "@astrojs/compiler": "^2.10.3", @@ -3950,9 +3950,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.39", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.39.tgz", - "integrity": "sha512-4xkpSR6CjuiaNyvwiWDI85N9AxsvbPawB8xc7yzLPonYTuP19BVgYweKyUMFtHEZgIcHWMt1ks5Cqx2m+6/Grg==", + "version": "1.5.41", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.41.tgz", + "integrity": "sha512-dfdv/2xNjX0P8Vzme4cfzHqnPm5xsZXwsolTYr0eyW18IUmNyG08vL+fttvinTfhKfIKdRoqkDIC9e9iWQCNYQ==", "license": "ISC" }, "node_modules/emmet": { @@ -6880,9 +6880,9 @@ } }, "node_modules/p-timeout": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", - "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.3.tgz", + "integrity": "sha512-UJUyfKbwvr/uZSV6btANfb+0t/mOhKV/KXcCUTp8FcQI+v/0d+wXqH4htrW0E4rR6WiEO/EPvUFiV9D5OI4vlw==", "license": "MIT", "engines": { "node": ">=14.16" @@ -7191,9 +7191,9 @@ } }, "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "license": "ISC" }, "node_modules/picomatch": { diff --git a/package.json b/package.json index 2961c9b..96604f7 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@astrojs/mdx": "^3.1.8", "@astrojs/rss": "^4.0.9", "@zeabur/astro-adapter": "^1.0.6", - "astro": "^4.16.5", + "astro": "^4.16.6", "drizzle-orm": "^0.35.1", "fuse.js": "^7.0.0", "lodash": "^4.17.21", @@ -57,11 +57,11 @@ }, "devDependencies": { "@astrojs/check": "^0.9.4", - "@biomejs/biome": "^1.9.3", + "@biomejs/biome": "^1.9.4", "@napi-rs/canvas": "^0.1.58", "@types/lodash": "^4.17.10", "@types/luxon": "^3.4.2", - "@types/node": "^22.7.5", + "@types/node": "^22.7.6", "@types/pg": "^8.11.10", "@types/qrcode-svg": "^1.1.5", "@types/unist": "^3.0.3", diff --git a/src/helpers/container.ts b/src/helpers/container.ts index 61666d3..4be1d57 100644 --- a/src/helpers/container.ts +++ b/src/helpers/container.ts @@ -10,7 +10,5 @@ export const partialRender = async ( component: AstroComponentFactory, options?: ContainerRenderOptions, ): Promise => { - const html = await container.renderToString(component, options); - // Remove this doctype by default. - return html.startsWith('') ? html.slice(15) : html; + return await container.renderToString(component, { ...options, partial: true }); };