diff --git a/bun.lockb b/bun.lockb
index 4bfaca0..7e04572 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/global.d.ts b/global.d.ts
index 08bb702..f7088f6 100644
--- a/global.d.ts
+++ b/global.d.ts
@@ -8,5 +8,8 @@ export as namespace p5;
declare global {
interface Window {
p5: typeof P5,
+ setup: () => void,
+ preload: () => void,
+ draw: () => void
}
}
\ No newline at end of file
diff --git a/package.json b/package.json
index 13ad976..cfe6a40 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"esbuild": "^0.23.0",
"marked": "^13.0.2",
"mime-types": "^2.1.35",
+ "nano-jsx": "^0.1.0",
"p5": "^1.9.4"
}
}
\ No newline at end of file
diff --git a/src/plugins/ts-compiler.ts b/src/plugins/ts-compiler.ts
index c16539a..8499f76 100644
--- a/src/plugins/ts-compiler.ts
+++ b/src/plugins/ts-compiler.ts
@@ -20,12 +20,18 @@ export default class TSCompiler extends Plugin {
const result = await esbuild.build({
stdin: {
contents: file,
+ resolveDir: filePath.split("/")?.slice(0,-1).join("/"),
sourcefile: filePath.split("/").at(-1),
- loader: "ts"
+ loader: filePath.split("/").at(-1)?.split(".").at(-1) as "ts"|"tsx"|"jsx"
},
+ jsxFragment: "Fragment",
+ jsxFactory: "Nano.h",
+ jsxImportSource: "nano-jsx",
+ jsx: "transform",
write: false,
+ bundle: true,
outdir: 'out',
- minify: this.minify
+ minify: this.minify,
});
if(result.errors.length != 0) {
diff --git a/tsconfig.json b/tsconfig.json
index 238655f..52fca22 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,6 +6,7 @@
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
+ "jsxImportSource": "nano-jsx/esm",
"allowJs": true,
// Bundler mode
diff --git a/website/key.txt b/website/assets/key.txt
similarity index 100%
rename from website/key.txt
rename to website/assets/key.txt
diff --git a/website/sticker.webp b/website/assets/sticker.webp
similarity index 100%
rename from website/sticker.webp
rename to website/assets/sticker.webp
diff --git a/website/style.css b/website/assets/style.css
similarity index 100%
rename from website/style.css
rename to website/assets/style.css
diff --git a/website/blog.html b/website/blog.html
index 93cc179..2f9dbad 100644
--- a/website/blog.html
+++ b/website/blog.html
@@ -18,7 +18,7 @@ __TEMPLATE_HEAD__
data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="noborder_dark"
data-lang="en" data-loading="lazy" crossorigin="anonymous" async>
-
+