AI: address review on PR #490

このコミットが含まれているのは:
Codex Night Worker
2026-11-22 01:44:36 +09:00
コミット 8b0433e344
5個のファイルの変更、17行の追加、8行の削除
+2 -2
ファイルの表示
@@ -6,8 +6,8 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && npm run build:client && npm run build:server", "build": "tsc -b && npm run build:client && npm run build:server",
"build:client": "NODE_ENV=production vite build --outDir dist/client", "build:client": "vite build --outDir dist/client",
"build:server": "NODE_ENV=production vite build --ssr src/entry-server.tsx --outDir dist/server", "build:server": "vite build --ssr src/entry-server.tsx --outDir dist/server",
"start": "node server.mjs", "start": "node server.mjs",
"lint": "eslint .", "lint": "eslint .",
"test": "vitest", "test": "vitest",
+7
ファイルの表示
@@ -1,4 +1,5 @@
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { spawn } from 'node:child_process' import { spawn } from 'node:child_process'
import { after, before, test } from 'node:test' import { after, before, test } from 'node:test'
@@ -332,6 +333,12 @@ after (async () => {
if (errors.length) throw new AggregateError (errors, 'SSR teardown failed') if (errors.length) throw new AggregateError (errors, 'SSR teardown failed')
}) })
test ('SSR bundle uses JSX compatible with production React', async () => {
const bundle = await readFile (
new URL ('./dist/server/entry-server.js', import.meta.url), 'utf8')
assert.doesNotMatch (bundle, /react\/jsx-dev-runtime|\bjsxDEV\b/)
})
test ('counts SSR renders the shell without result requests or embedded results', async () => { test ('counts SSR renders the shell without result requests or embedded results', async () => {
for (const locale of ['ja', 'ain-Kana']) { for (const locale of ['ja', 'ain-Kana']) {
for (const [resource, mode] of ['posts', 'tags'].flatMap (resource => for (const [resource, mode] of ['posts', 'tags'].flatMap (resource =>
+2 -1
ファイルの表示
@@ -10,7 +10,8 @@ type Transform = (source: string, id: string) => Promise<{ code: string } | null
export const transformMdx = async (source: string, suffix = '.mdx') => { export const transformMdx = async (source: string, suffix = '.mdx') => {
const plugins = viteConfig.plugins?.flat () as { name: string; transform: Transform }[] const config = viteConfig ({ command: 'serve', mode: 'test' })
const plugins = config.plugins?.flat () as { name: string; transform: Transform }[]
const plugin = plugins.find (entry => entry.name === '@mdx-js/rollup') const plugin = plugins.find (entry => entry.name === '@mdx-js/rollup')
if (plugin == null) if (plugin == null)
throw new Error ('The application MDX compiler is not registered') throw new Error ('The application MDX compiler is not registered')
+3 -2
ファイルの表示
@@ -21,7 +21,8 @@ if (typeof originalTransform === 'function')
} }
} }
export default defineConfig ({ export default defineConfig (({ command }) => ({
esbuild: { jsxDev: command === 'build' ? false : undefined },
plugins: [{ name: 'request-render-context', enforce: 'pre', plugins: [{ name: 'request-render-context', enforce: 'pre',
resolveId (id, _importer, options) { resolveId (id, _importer, options) {
const contextPath = path.resolve (__dirname, './src/lib/renderContext') const contextPath = path.resolve (__dirname, './src/lib/renderContext')
@@ -40,4 +41,4 @@ export default defineConfig ({
rewrite: requestPath => requestPath.replace (/^\/api/, ''), rewrite: requestPath => requestPath.replace (/^\/api/, ''),
secure: false } }, secure: false } },
watch: { usePolling: true, watch: { usePolling: true,
interval: 100 } } }) interval: 100 } } }))
+3 -3
ファイルの表示
@@ -3,11 +3,11 @@ import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config' import viteConfig from './vite.config'
export default mergeConfig ( export default defineConfig (environment => mergeConfig (
viteConfig, viteConfig (environment),
defineConfig ({ defineConfig ({
test: { environment: 'jsdom', test: { environment: 'jsdom',
testTimeout: 30_000, testTimeout: 30_000,
exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'], exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'],
setupFiles: './src/test/setup.ts', setupFiles: './src/test/setup.ts',
globals: false } })) globals: false } })))