@@ -2,16 +2,21 @@ import { readFileSync, writeFileSync } from "fs";
22
33// Read the Python code and write it as a separate module
44const pythonCode = readFileSync ( "src/python/console.py" , "utf-8" ) ;
5- writeFileSync ( "src/console-code.ts" , `export const CONSOLE_PY = ${ JSON . stringify ( pythonCode ) } ;` ) ;
5+ writeFileSync (
6+ "src/console-code.ts" ,
7+ `export const CONSOLE_PY = ${ JSON . stringify ( pythonCode ) } ;` ,
8+ ) ;
69
710// Read the TypeScript source
811const tsSource = readFileSync ( "src/embed.ts" , "utf-8" ) ;
912
1013// Create a version that imports the Python code
11- const inlinedSource = `import { CONSOLE_PY } from './console-code';\n` + tsSource . replace (
12- / c o n s t r e s p o n s e = a w a i t f e t c h \( ' \/ p y t h o n \/ c o n s o l e \. p y ' \) ; \s * c o n s t c o n s o l e C o d e = a w a i t r e s p o n s e \. t e x t \( \) ; / ,
13- `const consoleCode = CONSOLE_PY;`
14- ) ;
14+ const inlinedSource =
15+ `import { CONSOLE_PY } from './console-code';\n` +
16+ tsSource . replace (
17+ / c o n s t c o n s o l e C o d e = a w a i t f e t c h \( ' \/ p y t h o n \/ c o n s o l e \. p y ' \) \. t h e n \( r = > r \. t e x t \( \) \) ; / ,
18+ `const consoleCode = CONSOLE_PY;` ,
19+ ) ;
1520
1621// Write temporary file
1722writeFileSync ( "src/embed.build.ts" , inlinedSource ) ;
@@ -32,5 +37,6 @@ if (result.success) {
3237
3338// Clean up temp files
3439import { unlinkSync } from "fs" ;
40+
3541unlinkSync ( "src/embed.build.ts" ) ;
36- unlinkSync ( "src/console-code.ts" ) ;
42+ unlinkSync ( "src/console-code.ts" ) ;
0 commit comments