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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user