@@ -25,45 +25,45 @@ async function buildJs(
2525}
2626
2727await Promise . all ( [
28- buildJs ( "src/index .ts" , { outdir : "dist/src" } ) ,
29- buildJs ( "src/react/useApp .tsx" , { outdir : "dist/src /react" } ) ,
30- buildJs ( "examples/example-ui-react.tsx" , { outdir : "dist/examples" } ) ,
31- buildJs ( "examples/example-ui.ts" , { outdir : "dist/examples" } ) ,
32- buildJs ( "examples/example-server.ts" , {
33- target : "node" ,
34- outdir : "dist/examples" ,
35- } ) ,
28+ buildJs ( "src/app .ts" ) ,
29+ buildJs ( "src/react/index .tsx" , { outdir : "dist/react" } ) ,
30+ // buildJs("examples/example-ui-react.tsx", { outdir: "dist/examples" }),
31+ // buildJs("examples/example-ui.ts", { outdir: "dist/examples" }),
32+ // buildJs("examples/example-server.ts", {
33+ // target: "node",
34+ // outdir: "dist/examples",
35+ // }),
3636] ) ;
3737
38- async function inlineHtml ( htmlFilePath : string , outputFilePath : string ) {
39- let html = await readFile ( htmlFilePath , "utf-8" ) ;
40- // Find all src sources, then fetch them, then replace them
41- const files = html . matchAll (
42- / < s c r i p t s r c = " ( (?: \. \/ ) ? d i s t \/ .* ?\. j s ) " > < \/ s c r i p t > / g,
43- ) ;
44- const fileContent = Object . fromEntries (
45- await Promise . all (
46- Array . from ( files , async ( [ , filename ] ) => {
47- const scriptContent = await readFile ( filename , "utf-8" ) ;
48- return [ filename , scriptContent ] ;
49- } ) ,
50- ) ,
51- ) ;
52- html = html . replace (
53- / < s c r i p t s r c = " ( (?: \. \/ ) ? d i s t \/ .* ?\. j s ) " > < \/ s c r i p t > / g,
54- ( _ , filename ) => {
55- let scriptContent = fileContent [ filename ] ;
56- // Escape </script> to prevent premature script tag closing
57- // This is the standard way to inline scripts safely
58- scriptContent = scriptContent . replace ( / < \/ s c r i p t > / gi, "<\\/script>" ) ;
59- return `<script>${ scriptContent } </script>` ;
60- } ,
61- ) ;
62- await writeFile ( outputFilePath , html ) ;
63- }
38+ // async function inlineHtml(htmlFilePath: string, outputFilePath: string) {
39+ // let html = await readFile(htmlFilePath, "utf-8");
40+ // // Find all src sources, then fetch them, then replace them
41+ // const files = html.matchAll(
42+ // /<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
43+ // );
44+ // const fileContent = Object.fromEntries(
45+ // await Promise.all(
46+ // Array.from(files, async ([, filename]) => {
47+ // const scriptContent = await readFile(filename, "utf-8");
48+ // return [filename, scriptContent];
49+ // }),
50+ // ),
51+ // );
52+ // html = html.replace(
53+ // /<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
54+ // (_, filename) => {
55+ // let scriptContent = fileContent[filename];
56+ // // Escape </script> to prevent premature script tag closing
57+ // // This is the standard way to inline scripts safely
58+ // scriptContent = scriptContent.replace(/<\/script>/gi, "<\\/script>");
59+ // return `<script>${scriptContent}</script>`;
60+ // },
61+ // );
62+ // await writeFile(outputFilePath, html);
63+ // }
6464
65- await inlineHtml ( "examples/example-ui.html" , "dist/examples/example-ui.html" ) ;
66- await inlineHtml (
67- "examples/example-ui-react.html" ,
68- "dist/examples/example-ui-react.html" ,
69- ) ;
65+ // await inlineHtml("examples/example-ui.html", "dist/examples/example-ui.html");
66+ // await inlineHtml(
67+ // "examples/example-ui-react.html",
68+ // "dist/examples/example-ui-react.html",
69+ // );
0 commit comments