Fix Prompt Builder Nitro build by inlining sequence helpers in utils.

The relative re-export of shared/prompt-sequences.mjs left an unresolved import in the SSR bundle.
This commit is contained in:
Towsty
2026-10-02 08:11:09 -05:00
parent 1bf97568bf
commit 790c33fcf0
3 changed files with 100 additions and 84 deletions
+18 -2
View File
@@ -1,12 +1,28 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import {
import { readFileSync, writeFileSync, unlinkSync } from 'node:fs'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
import { pathToFileURL } from 'node:url'
import ts from 'typescript'
const src = readFileSync(new URL('../utils/promptSequences.ts', import.meta.url), 'utf8')
const js = ts.transpileModule(src, {
compilerOptions: {
target: ts.ScriptTarget.ES2022,
module: ts.ModuleKind.ESNext
}
}).outputText
const tmp = join(tmpdir(), `prompt-sequences-${process.pid}.mjs`)
writeFileSync(tmp, js)
const {
assembleSceneText,
assembleSequenceText,
formatCharacterLine,
emptyScene,
cloneSceneForNext
} from '../shared/prompt-sequences.mjs'
} = await import(pathToFileURL(tmp).href)
unlinkSync(tmp)
test('formatCharacterLine covers name/description cases', () => {
assert.equal(formatCharacterLine({ name: 'Ada', description: 'tall' }), 'Ada: tall')