oda-engine 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -2
- package/bin/nowhere.mjs +352 -0
- package/lib/account.mjs +57 -0
- package/lib/agentModules.mjs +57 -0
- package/lib/devServer.mjs +351 -0
- package/lib/headless.mjs +231 -0
- package/lib/headlessPreview.mjs +212 -0
- package/lib/keys.mjs +517 -0
- package/lib/make.mjs +855 -0
- package/lib/mcp.mjs +537 -0
- package/lib/open.mjs +22 -0
- package/lib/preview.mjs +87 -0
- package/lib/previewRpc.mjs +134 -0
- package/lib/project.mjs +359 -0
- package/lib/publishFlow.mjs +131 -0
- package/lib/resources.mjs +50 -0
- package/lib/rules.mjs +60 -0
- package/lib/scaffold.mjs +42 -0
- package/lib/setup.mjs +59 -0
- package/lib/tools.mjs +668 -0
- package/package.json +51 -4
- package/template/game.config.json +9 -0
- package/template/scene.json +4 -0
- package/template/src/main.ts +11 -0
- package/vendor/DOCS.md +447 -0
- package/vendor/agent/appRun.mjs +520 -0
- package/vendor/agent/assets/brief.mjs +242 -0
- package/vendor/agent/assets/collider.mjs +531 -0
- package/vendor/agent/assets/environments/index.mjs +12 -0
- package/vendor/agent/assets/environments/worldlabs.mjs +161 -0
- package/vendor/agent/assets/fetch.mjs +168 -0
- package/vendor/agent/assets/footprint.mjs +13 -0
- package/vendor/agent/assets/gltf.mjs +547 -0
- package/vendor/agent/assets/hdr.mjs +269 -0
- package/vendor/agent/assets/imageOps.mjs +171 -0
- package/vendor/agent/assets/images/codex.mjs +307 -0
- package/vendor/agent/assets/images/fal.mjs +75 -0
- package/vendor/agent/assets/images/gemini.mjs +84 -0
- package/vendor/agent/assets/images/index.mjs +25 -0
- package/vendor/agent/assets/images/openai.mjs +75 -0
- package/vendor/agent/assets/images/stability.mjs +71 -0
- package/vendor/agent/assets/images/views.mjs +31 -0
- package/vendor/agent/assets/import.mjs +1352 -0
- package/vendor/agent/assets/inspect.mjs +465 -0
- package/vendor/agent/assets/jobs.mjs +196 -0
- package/vendor/agent/assets/ktx2.mjs +290 -0
- package/vendor/agent/assets/ledger.mjs +466 -0
- package/vendor/agent/assets/net.mjs +254 -0
- package/vendor/agent/assets/prices.json +39 -0
- package/vendor/agent/assets/providers/fal.mjs +115 -0
- package/vendor/agent/assets/providers/index.mjs +22 -0
- package/vendor/agent/assets/providers/meshy.mjs +119 -0
- package/vendor/agent/assets/providers/tripo.mjs +188 -0
- package/vendor/agent/assets/sources/ambientcg.mjs +129 -0
- package/vendor/agent/assets/sources/index.mjs +23 -0
- package/vendor/agent/assets/sources/polyhaven.mjs +237 -0
- package/vendor/agent/assets/sources/polypizza.mjs +121 -0
- package/vendor/agent/assets/splat.mjs +631 -0
- package/vendor/agent/assets/targets.mjs +122 -0
- package/vendor/agent/assets/tile.mjs +261 -0
- package/vendor/agent/assets/unzip.mjs +180 -0
- package/vendor/agent/blender/cleanup.py +360 -0
- package/vendor/agent/blender/convert.py +167 -0
- package/vendor/agent/blender/find.mjs +192 -0
- package/vendor/agent/blender/nw_export.py +104 -0
- package/vendor/agent/blender/nw_rubric.py +426 -0
- package/vendor/agent/blender/run.mjs +193 -0
- package/vendor/agent/blender/runner.py +252 -0
- package/vendor/agent/blender/sheet.py +743 -0
- package/vendor/agent/depth.mjs +134 -0
- package/vendor/agent/director/board.mjs +451 -0
- package/vendor/agent/director/contracts.mjs +663 -0
- package/vendor/agent/director/director.mjs +2365 -0
- package/vendor/agent/director/estimate.mjs +200 -0
- package/vendor/agent/director/gate.mjs +802 -0
- package/vendor/agent/director/limits.json +16 -0
- package/vendor/agent/director/methods.mjs +457 -0
- package/vendor/agent/director/policy.json +33 -0
- package/vendor/agent/director/prompts.mjs +244 -0
- package/vendor/agent/director/reading.mjs +341 -0
- package/vendor/agent/director/router.mjs +184 -0
- package/vendor/agent/director/seams.mjs +243 -0
- package/vendor/agent/director/session.mjs +643 -0
- package/vendor/agent/director/store.mjs +119 -0
- package/vendor/agent/director/taskGate.mjs +110 -0
- package/vendor/agent/director/teamLedger.mjs +118 -0
- package/vendor/agent/director/triage.mjs +63 -0
- package/vendor/agent/downloads.cjs +363 -0
- package/vendor/agent/flow.mjs +78 -0
- package/vendor/agent/guard.mjs +613 -0
- package/vendor/agent/host.mjs +1736 -0
- package/vendor/agent/language.mjs +58 -0
- package/vendor/agent/ledger.mjs +360 -0
- package/vendor/agent/locale.cjs +186 -0
- package/vendor/agent/loop/capacity.mjs +74 -0
- package/vendor/agent/loop/compose.mjs +127 -0
- package/vendor/agent/loop/gate.mjs +205 -0
- package/vendor/agent/loop/judge.mjs +189 -0
- package/vendor/agent/loop/levels.mjs +273 -0
- package/vendor/agent/loop/state.mjs +358 -0
- package/vendor/agent/notes.cjs +278 -0
- package/vendor/agent/pace.mjs +258 -0
- package/vendor/agent/panels.mjs +431 -0
- package/vendor/agent/prompt.mjs +342 -0
- package/vendor/agent/reference/board.mjs +410 -0
- package/vendor/agent/reference/compose.mjs +364 -0
- package/vendor/agent/reference/decode.mjs +56 -0
- package/vendor/agent/reference/facts.mjs +1874 -0
- package/vendor/agent/reference/png.mjs +107 -0
- package/vendor/agent/reference/records.mjs +63 -0
- package/vendor/agent/reference/web.mjs +252 -0
- package/vendor/agent/roles/artist.mjs +69 -0
- package/vendor/agent/roles/builder.mjs +79 -0
- package/vendor/agent/roles/checks.mjs +223 -0
- package/vendor/agent/roles/common.mjs +188 -0
- package/vendor/agent/roles/critic.mjs +171 -0
- package/vendor/agent/roles/index.mjs +39 -0
- package/vendor/agent/roles/modeller.mjs +142 -0
- package/vendor/agent/roles/qa.mjs +58 -0
- package/vendor/agent/roles/rubrics.mjs +79 -0
- package/vendor/agent/roles/sound.mjs +69 -0
- package/vendor/agent/rounds.cjs +333 -0
- package/vendor/agent/shared.mjs +284 -0
- package/vendor/agent/stopGate.mjs +574 -0
- package/vendor/agent/subagents.mjs +129 -0
- package/vendor/agent/tools/assets.mjs +499 -0
- package/vendor/agent/tools/blender.mjs +754 -0
- package/vendor/agent/tools/cards.mjs +479 -0
- package/vendor/agent/tools/choices.mjs +479 -0
- package/vendor/agent/tools/compose.mjs +74 -0
- package/vendor/agent/tools/environment.mjs +488 -0
- package/vendor/agent/tools/eyes.mjs +733 -0
- package/vendor/agent/tools/generate.mjs +338 -0
- package/vendor/agent/tools/guide.mjs +46 -0
- package/vendor/agent/tools/harness.mjs +193 -0
- package/vendor/agent/tools/image.mjs +643 -0
- package/vendor/agent/tools/index.mjs +162 -0
- package/vendor/agent/tools/look.mjs +578 -0
- package/vendor/agent/tools/loop.mjs +858 -0
- package/vendor/agent/tools/others.mjs +123 -0
- package/vendor/agent/tools/pictures.mjs +535 -0
- package/vendor/agent/tools/reference.mjs +366 -0
- package/vendor/agent/transcripts.mjs +118 -0
- package/vendor/agent-loop.mjs +602 -0
- package/vendor/agent-plugin/.claude-plugin/plugin.json +5 -0
- package/vendor/agent-plugin/skills/art-direction/SKILL.md +82 -0
- package/vendor/agent-plugin/skills/asset-legality/SKILL.md +101 -0
- package/vendor/agent-plugin/skills/asset-sources/SKILL.md +111 -0
- package/vendor/agent-plugin/skills/blender-modeling/SKILL.md +97 -0
- package/vendor/agent-plugin/skills/look-dev/SKILL.md +104 -0
- package/vendor/agent-plugin/skills/playtesting/SKILL.md +74 -0
- package/vendor/agent-plugin/skills/reference-loop/SKILL.md +102 -0
- package/vendor/agent-plugin/skills/sound-design/SKILL.md +60 -0
- package/vendor/agent-plugin/skills/style/SKILL.md +35 -0
- package/vendor/agent-plugin/skills/tsl-r185/SKILL.md +107 -0
- package/vendor/auth.cjs +570 -0
- package/vendor/build.cjs +953 -0
- package/vendor/catalog.json +455 -0
- package/vendor/connectors.cjs +688 -0
- package/vendor/eyes.mjs +733 -0
- package/vendor/gameExports.json +1390 -0
- package/vendor/git.cjs +222 -0
- package/vendor/models.json +57 -0
- package/vendor/publish.cjs +1018 -0
- package/vendor/refBoard.cjs +301 -0
- package/vendor/schema/dist/assets.d.ts +335 -0
- package/vendor/schema/dist/assets.js +439 -0
- package/vendor/schema/dist/brief.d.ts +357 -0
- package/vendor/schema/dist/brief.js +302 -0
- package/vendor/schema/dist/common.d.ts +9 -0
- package/vendor/schema/dist/common.js +13 -0
- package/vendor/schema/dist/config.d.ts +406 -0
- package/vendor/schema/dist/config.js +355 -0
- package/vendor/schema/dist/contract.d.ts +599 -0
- package/vendor/schema/dist/contract.js +1146 -0
- package/vendor/schema/dist/index.d.ts +14 -0
- package/vendor/schema/dist/index.js +21 -0
- package/vendor/schema/dist/look.d.ts +463 -0
- package/vendor/schema/dist/look.js +681 -0
- package/vendor/schema/dist/lookStats.d.ts +230 -0
- package/vendor/schema/dist/lookStats.js +768 -0
- package/vendor/schema/dist/pilot.d.ts +32 -0
- package/vendor/schema/dist/pilot.js +44 -0
- package/vendor/schema/dist/publish.d.ts +214 -0
- package/vendor/schema/dist/publish.js +291 -0
- package/vendor/schema/dist/scene.d.ts +75 -0
- package/vendor/schema/dist/scene.js +120 -0
- package/vendor/schema/dist/skyLight.d.ts +141 -0
- package/vendor/schema/dist/skyLight.js +436 -0
- package/vendor/schema/dist/style.d.ts +131 -0
- package/vendor/schema/dist/style.js +155 -0
- package/vendor/schema/package.json +1 -0
- package/vendor/selectionPrompt.mjs +51 -0
- package/vendor/useTools.mjs +195 -0
- package/vendor/userMessage.mjs +26 -0
- package/web-dist/assets/GaussianSplatUtils-CptQkDVX.js +1 -0
- package/web-dist/assets/KTX2Loader-C53LJqss.js +2 -0
- package/web-dist/assets/SPZLoader-BQ3tjaTv.js +1 -0
- package/web-dist/assets/gaussianSplat-_9tcWegB.js +1 -0
- package/web-dist/assets/index-Baka-ZO7.js +693 -0
- package/web-dist/assets/index-CcjyyQco.css +1 -0
- package/web-dist/assets/meshopt_decoder.module-BvwdjiD3.js +1 -0
- package/web-dist/assets/zstddec.module-CfFeQW7d.js +1 -0
- package/web-dist/index.html +34 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// The preview as the terminal tools reach it (tools.mjs, `nowhere mcp
|
|
2
|
+
// --headless`, `nowhere dev --headless`): connectPreview's shape, with the
|
|
3
|
+
// page in headless Chrome rather than the creator's browser. A `nowhere dev`
|
|
4
|
+
// already running for the project is used, and its page too when one is
|
|
5
|
+
// connected; otherwise the dev server is started here (opening nothing) and,
|
|
6
|
+
// when no page comes quickly, headless Chrome is started on its address
|
|
7
|
+
// through headless.mjs, with an environment stripped of every key. close()
|
|
8
|
+
// stops only what this started: its Chrome, and the dev server when it was
|
|
9
|
+
// this that began it.
|
|
10
|
+
//
|
|
11
|
+
// Each Chrome started here is recorded in <project>/.nowhere/headless/<pid>.json
|
|
12
|
+
// until close() stops it. A command that could not stop its own (its terminal
|
|
13
|
+
// was closed, or it was killed) leaves the record behind, and the next
|
|
14
|
+
// command for the project stops that Chrome: still headless, on the profile
|
|
15
|
+
// it recorded, and no longer the child of the process that started it.
|
|
16
|
+
|
|
17
|
+
import { execFileSync } from 'node:child_process'
|
|
18
|
+
import fs from 'node:fs'
|
|
19
|
+
import path from 'node:path'
|
|
20
|
+
import { connectPreview } from './preview.mjs'
|
|
21
|
+
import { HEADLESS, chromeEnv, findChrome as findChromeFile, launch as launchChrome } from './headless.mjs'
|
|
22
|
+
|
|
23
|
+
export const NO_CHROME_TOOLS = 'The oda tools need Google Chrome or Chromium to run the space (headless, with no window), and found neither. Install Chrome, or set NOWHERE_CHROME to its executable.'
|
|
24
|
+
|
|
25
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
26
|
+
|
|
27
|
+
const recordsOf = (root) => path.join(root, '.nowhere', 'headless')
|
|
28
|
+
|
|
29
|
+
/** A process's parent and command line, or null when it is not running. */
|
|
30
|
+
function processOf(pid) {
|
|
31
|
+
try {
|
|
32
|
+
const line = execFileSync('ps', ['-ww', '-o', 'ppid=,command=', '-p', String(pid)], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 5000 }).trim()
|
|
33
|
+
const m = /^(\d+)\s+(.*)$/s.exec(line)
|
|
34
|
+
return m ? { ppid: Number(m[1]), command: m[2] } : null
|
|
35
|
+
} catch {
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Stops every headless Chrome an earlier command started for this project
|
|
42
|
+
* and left behind: its record names it, it still runs headless on that
|
|
43
|
+
* profile, and its parent is no longer the process that started it. Its
|
|
44
|
+
* group goes with it, and its profile. A record whose Chrome is gone is
|
|
45
|
+
* removed; one whose Chrome is still another command's is left alone.
|
|
46
|
+
* Answers the pids it stopped. Not on Windows, where Chrome has no group of
|
|
47
|
+
* its own here.
|
|
48
|
+
*/
|
|
49
|
+
export function reapHeadless(root, { ps = processOf, kill = (pid, signal) => process.kill(pid, signal) } = {}) {
|
|
50
|
+
if (process.platform === 'win32') return []
|
|
51
|
+
const dir = recordsOf(root)
|
|
52
|
+
let names = []
|
|
53
|
+
try {
|
|
54
|
+
names = fs.readdirSync(dir).filter((n) => /^\d+\.json$/.test(n))
|
|
55
|
+
} catch {
|
|
56
|
+
return []
|
|
57
|
+
}
|
|
58
|
+
const stopped = []
|
|
59
|
+
for (const name of names) {
|
|
60
|
+
const file = path.join(dir, name)
|
|
61
|
+
let record = null
|
|
62
|
+
try {
|
|
63
|
+
record = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
64
|
+
} catch {
|
|
65
|
+
// unreadable: removed below
|
|
66
|
+
}
|
|
67
|
+
const { pid, owner, profileDir } = record ?? {}
|
|
68
|
+
const ours = Number.isInteger(pid) && pid > 1 && typeof profileDir === 'string' && path.basename(profileDir).startsWith('nowhere-chrome-')
|
|
69
|
+
const now = ours ? ps(pid) : null
|
|
70
|
+
const same = !!now && now.command.includes(HEADLESS) && now.command.includes(`--user-data-dir=${profileDir}`)
|
|
71
|
+
if (same && now.ppid === owner) continue
|
|
72
|
+
if (same) {
|
|
73
|
+
try {
|
|
74
|
+
kill(-pid, 'SIGKILL')
|
|
75
|
+
} catch {
|
|
76
|
+
try {
|
|
77
|
+
kill(pid, 'SIGKILL')
|
|
78
|
+
} catch {
|
|
79
|
+
// already gone
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
stopped.push(pid)
|
|
83
|
+
}
|
|
84
|
+
if (ours) fs.rmSync(profileDir, { recursive: true, force: true })
|
|
85
|
+
fs.rmSync(file, { force: true })
|
|
86
|
+
}
|
|
87
|
+
return stopped
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} root the project
|
|
92
|
+
* @param {{ log?: (line: string) => void, say?: (line: string) => void, env?: object, port?: number,
|
|
93
|
+
* connect?: typeof connectPreview, launch?: typeof launchChrome, findChrome?: typeof findChromeFile,
|
|
94
|
+
* reap?: typeof reapHeadless, quickMs?: number, backendWaitMs?: number }} options
|
|
95
|
+
* log: the dev server's lines; say: the one line for the terminal when
|
|
96
|
+
* Chrome starts (stderr); reap: what stops a Chrome an earlier command
|
|
97
|
+
* left (a check passes its own); quickMs: how long a running dev server is
|
|
98
|
+
* given to show a page of its own before Chrome is started on it.
|
|
99
|
+
* @returns {Promise<{ url: string, own: boolean, request: Function, rebuild: Function, runtime: Function,
|
|
100
|
+
* ensurePage: (ms: number) => Promise<boolean>, close: () => Promise<void>, chrome: () => object | null }>}
|
|
101
|
+
*/
|
|
102
|
+
export async function connectHeadless(root, { log = () => {}, say = (line) => process.stderr.write(`${line}\n`), env = process.env, port = 0, connect = connectPreview, launch = launchChrome, findChrome = findChromeFile, reap = reapHeadless, quickMs = 1500, backendWaitMs = 20_000 } = {}) {
|
|
103
|
+
// What an earlier command left running for this project goes first.
|
|
104
|
+
const reaped = reap(root)
|
|
105
|
+
if (reaped.length) say(`nowhere: stopped the headless Chrome an earlier command left running (pid ${reaped.join(', ')}).`)
|
|
106
|
+
const preview = await connect(root, { start: true, open: false, port, log })
|
|
107
|
+
let chrome = null
|
|
108
|
+
let starting = null
|
|
109
|
+
let record = null
|
|
110
|
+
let closing = null
|
|
111
|
+
|
|
112
|
+
// However this process ends, the browser it started goes with it. Its
|
|
113
|
+
// profile and record go too when they can; otherwise the next command
|
|
114
|
+
// removes them.
|
|
115
|
+
const killSync = () => {
|
|
116
|
+
try {
|
|
117
|
+
if (chrome?.pid) process.kill(process.platform === 'win32' ? chrome.pid : -chrome.pid, 'SIGKILL')
|
|
118
|
+
} catch {
|
|
119
|
+
// already gone
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
if (record && chrome?.profileDir) {
|
|
123
|
+
fs.rmSync(chrome.profileDir, { recursive: true, force: true })
|
|
124
|
+
fs.rmSync(record, { force: true })
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
// a helper still held the profile
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function startChrome() {
|
|
132
|
+
const file = findChrome({ env })
|
|
133
|
+
if (!file) throw new Error(NO_CHROME_TOOLS)
|
|
134
|
+
chrome = await launch({ url: preview.url, chrome: file, env: chromeEnv(env) })
|
|
135
|
+
process.once('exit', killSync)
|
|
136
|
+
if (Number.isInteger(chrome.pid) && chrome.pid > 1 && typeof chrome.profileDir === 'string') {
|
|
137
|
+
try {
|
|
138
|
+
fs.mkdirSync(recordsOf(root), { recursive: true })
|
|
139
|
+
const file = path.join(recordsOf(root), `${chrome.pid}.json`)
|
|
140
|
+
fs.writeFileSync(file, `${JSON.stringify({ pid: chrome.pid, owner: process.pid, profileDir: chrome.profileDir, at: new Date().toISOString() })}\n`)
|
|
141
|
+
record = file
|
|
142
|
+
} catch {
|
|
143
|
+
// no record: this command still stops it, only a lost one is not found later
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
say(`nowhere: the preview runs in headless ${chrome.version ?? 'Chrome'} for this command (pid ${chrome.pid}).`)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The GPU backend the page draws with, once the probe answers: a warning
|
|
150
|
+
* when it is not WebGPU, since the planet draws with WebGPU. */
|
|
151
|
+
async function checkBackend() {
|
|
152
|
+
const until = Date.now() + backendWaitMs
|
|
153
|
+
let status = null
|
|
154
|
+
while (Date.now() < until) {
|
|
155
|
+
status = await preview.request('probe:status', {}, 4000).catch(() => null)
|
|
156
|
+
if (status?.frame?.backend) break
|
|
157
|
+
await sleep(500)
|
|
158
|
+
}
|
|
159
|
+
const backend = status?.frame?.backend ?? null
|
|
160
|
+
if (backend !== 'WebGPU') say(`nowhere: the headless preview draws with ${backend ?? 'no GPU backend yet'}, not WebGPU, so what you see here may differ from the planet.`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function ensurePage(ms) {
|
|
164
|
+
// A page already there: a browser on a running `nowhere dev`, or the
|
|
165
|
+
// Chrome this started earlier.
|
|
166
|
+
if (await preview.ensurePage((chrome || preview.own) ? 0 : quickMs)) return true
|
|
167
|
+
if (chrome) return preview.ensurePage(ms)
|
|
168
|
+
starting ??= startChrome()
|
|
169
|
+
await starting
|
|
170
|
+
const ok = await preview.ensurePage(ms)
|
|
171
|
+
if (!ok) {
|
|
172
|
+
const tail = (chrome?.tail?.(8) ?? []).map((l) => ` ${l}`).join('\n')
|
|
173
|
+
log(`headless Chrome did not open the preview page within ${Math.round(ms / 1000)} s.${tail ? ` Its last words:\n${tail}` : ''}`)
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
await checkBackend()
|
|
177
|
+
return true
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
url: preview.url,
|
|
182
|
+
own: preview.own,
|
|
183
|
+
request: preview.request,
|
|
184
|
+
rebuild: preview.rebuild,
|
|
185
|
+
runtime: preview.runtime,
|
|
186
|
+
ensurePage,
|
|
187
|
+
chrome: () => chrome,
|
|
188
|
+
// Once, however many times it is asked (a signal and the command's own end).
|
|
189
|
+
close() {
|
|
190
|
+
closing ??= (async () => {
|
|
191
|
+
// A Chrome still starting is waited for, so a stop mid-start kills it too.
|
|
192
|
+
await starting?.catch(() => {})
|
|
193
|
+
if (chrome) {
|
|
194
|
+
await chrome.kill().catch(() => {})
|
|
195
|
+
process.off('exit', killSync)
|
|
196
|
+
chrome = null
|
|
197
|
+
}
|
|
198
|
+
if (record) {
|
|
199
|
+
fs.rmSync(record, { force: true })
|
|
200
|
+
try {
|
|
201
|
+
fs.rmdirSync(recordsOf(root))
|
|
202
|
+
} catch {
|
|
203
|
+
// another command's record is still there
|
|
204
|
+
}
|
|
205
|
+
record = null
|
|
206
|
+
}
|
|
207
|
+
await preview.close()
|
|
208
|
+
})()
|
|
209
|
+
return closing
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
}
|