import { mkdtemp, writeFile, mkdir } from 'node:fs/promises'; import http, { type IncomingMessage, type ServerResponse } from 'node:http'; import type { AddressInfo } from 'node:net'; import os from 'node:os'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; import { analyzeDeployPlan, buildDeployFilePlan, buildDeployFileSet, checkDeploymentUrl, DEPLOY_PREFLIGHT_LARGE_ASSET_BYTES, DEPLOY_PREFLIGHT_LARGE_HTML_BYTES, deploymentUrlCandidates, extractCssReferences, extractHtmlReferences, extractInlineCssReferences, injectDeployHookScript, isVercelProtectedResponse, normalizeDeployHookScriptUrl, prepareDeployPreflight, resolveReferencedPath, rewriteCssReferences, rewriteEntryHtmlReferences, waitForReachableDeploymentUrl, } from '../src/deploy.js'; import { ensureProject } from '../src/projects.js'; async function setupProject() { const root = await mkdtemp(path.join(os.tmpdir(), 'od-deploy-test-')); const projectId = 'p1'; const dir = await ensureProject(path.join(root, 'projects'), projectId); return { projectsRoot: path.join(root, 'projects'), projectId, dir }; } describe('deploy file set', () => { it('deploys a single html file as index.html', async () => { const { projectsRoot, projectId, dir } = await setupProject(); await writeFile(path.join(dir, 'page.html'), '