+
Examples
@@ -262,14 +317,28 @@ function copyCode() {
line-height: 1.6;
}
+.terminal-prompt {
+ color: var(--vp-c-brand-1);
+}
+
.terminal-cmd {
- color: var(--vp-c-text-2);
+ color: var(--vp-c-text-1);
}
.terminal-out {
color: var(--vp-c-text-3);
}
+.cursor {
+ color: var(--vp-c-brand-1);
+ animation: blink 0.6s step-end infinite;
+ font-weight: 300;
+}
+
+@keyframes blink {
+ 50% { opacity: 0; }
+}
+
@media (max-width: 768px) {
.tab-bar {
overflow-x: auto;
diff --git a/docs/.vitepress/theme/HeroBenchmarks.vue b/docs/.vitepress/theme/HeroBenchmarks.vue
index 1dadb628..d626a3a0 100644
--- a/docs/.vitepress/theme/HeroBenchmarks.vue
+++ b/docs/.vitepress/theme/HeroBenchmarks.vue
@@ -46,6 +46,7 @@ onMounted(() => {
diff --git a/docs/.vitepress/theme/index.mts b/docs/.vitepress/theme/index.mts
index dc114ead..c631f39e 100644
--- a/docs/.vitepress/theme/index.mts
+++ b/docs/.vitepress/theme/index.mts
@@ -16,7 +16,6 @@ export default {
Layout() {
return h(DefaultTheme.Layout, null, {
'doc-before': () => h(CopyMarkdown),
- 'home-hero-image': () => h(HeroBenchmarks),
})
},
enhanceApp({ app }) {
diff --git a/docs/index.md b/docs/index.md
index eb1bd572..501eb469 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -19,14 +19,18 @@ features:
details: Write the TypeScript you already know. Classes, interfaces, async/await, generics - it all works.
- title: Batteries Included
details: HTTP servers, file I/O, JSON, crypto, SQLite, regex, async - all compiled to native code. No npm required.
+ - title: Zero-Cost C Interop
+ details: C libraries like SQLite and OpenSSL are called directly through LLVM IR — no FFI boundary, no marshaling, no overhead. Same cost as a native function call.
---
-
+
+
+
## Ready to try it?
@@ -37,7 +41,6 @@ curl -fsSL https://raw.githubusercontent.com/cs01/ChadScript/main/install.sh | s
@@ -74,8 +77,14 @@ curl -fsSL https://raw.githubusercontent.com/cs01/ChadScript/main/install.sh | s
opacity: 0.85;
}
.cta-button.primary {
- background: var(--vp-c-brand-1);
- color: var(--vp-c-white);
+ background: rgba(255, 255, 255, 0.08);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ color: var(--vp-c-text-1);
+}
+.cta-button.primary:hover {
+ background: rgba(255, 255, 255, 0.12);
+ border-color: rgba(255, 255, 255, 0.2);
+ opacity: 1;
}
.cta-button.secondary {
border: 1px solid var(--vp-c-divider);
diff --git a/install.sh b/install.sh
index c8221591..a687efac 100755
--- a/install.sh
+++ b/install.sh
@@ -6,21 +6,22 @@ INSTALL_DIR="$HOME/.chadscript"
VERSION="0.1.0"
if [ -t 1 ]; then
- BOLD='\033[1m'
- DIM='\033[2m'
- GREEN='\033[32m'
- CYAN='\033[36m'
- YELLOW='\033[33m'
- RED='\033[31m'
- RESET='\033[0m'
+ ESC=$(printf '\033')
+ BOLD="${ESC}[1m"
+ DIM="${ESC}[2m"
+ GREEN="${ESC}[32m"
+ CYAN="${ESC}[36m"
+ YELLOW="${ESC}[33m"
+ RED="${ESC}[31m"
+ RESET="${ESC}[0m"
else
BOLD='' DIM='' GREEN='' CYAN='' YELLOW='' RED='' RESET=''
fi
-info() { printf "${CYAN}info${RESET} %s\n" "$1"; }
-success() { printf "${GREEN} ✓${RESET} %s\n" "$1"; }
-warn() { printf "${YELLOW}warn${RESET} %s\n" "$1"; }
-err() { printf "${RED}error${RESET} %s\n" "$1" >&2; exit 1; }
+info() { printf "%s\n" "${CYAN}info${RESET} $1"; }
+success() { printf "%s\n" "${GREEN} ✓${RESET} $1"; }
+warn() { printf "%s\n" "${YELLOW}warn${RESET} $1"; }
+err() { printf "%s\n" "${RED}error${RESET} $1" >&2; exit 1; }
detect_libc() {
if [ "$(uname -s)" != "Linux" ]; then
@@ -135,7 +136,9 @@ WRAPPER
printf "\n"
printf " Then try:\n"
printf "\n"
- printf " ${CYAN}chad run examples/hello.ts${RESET}\n"
+ printf " ${CYAN}mkdir myproject && cd myproject${RESET}\n"
+ printf " ${CYAN}chad init${RESET}\n"
+ printf " ${CYAN}chad run hello.ts${RESET}\n"
printf "\n"
}
diff --git a/src/compiler.ts b/src/compiler.ts
index 51e37b89..967417b9 100644
--- a/src/compiler.ts
+++ b/src/compiler.ts
@@ -244,7 +244,7 @@ export function compile(inputFile: string, outputFile: string, logLevel: LogLeve
if (generator.usesSqlite) { linkLibs = `-L${brewPrefix}/sqlite/lib ` + linkLibs; }
if (generator.usesMongoose) { linkLibs = `-L${brewPrefix}/zstd/lib ` + linkLibs; }
const sdkPath = execSync('xcrun --show-sdk-path', { stdio: 'pipe', encoding: 'utf8' }).trim();
- linkLibs = `-isysroot ${sdkPath} -L/usr/local/lib ` + linkLibs;
+ linkLibs = `-Wl,-syslibroot,${sdkPath} -L/usr/local/lib ` + linkLibs;
}
const lwsBridgeObj = generator.usesMongoose ? `${LWS_BRIDGE_PATH}/lws-bridge.o` : '';
const regexBridgeObj = generator.usesRegex ? `${LWS_BRIDGE_PATH}/regex-bridge.o` : '';
diff --git a/src/native-compiler-lib.ts b/src/native-compiler-lib.ts
index 9e93c58f..f1717b04 100644
--- a/src/native-compiler-lib.ts
+++ b/src/native-compiler-lib.ts
@@ -188,7 +188,7 @@ export function compileNative(inputFile: string, outputFile: string): void {
if (generator.getUsesCrypto()) { linkLibs = '-L/opt/homebrew/opt/openssl/lib -L/usr/local/opt/openssl/lib ' + linkLibs; }
if (generator.getUsesSqlite()) { linkLibs = '-L/opt/homebrew/opt/sqlite/lib -L/usr/local/opt/sqlite/lib ' + linkLibs; }
if (generator.getUsesMongoose()) { linkLibs = '-L/opt/homebrew/opt/zstd/lib -L/usr/local/opt/zstd/lib ' + linkLibs; }
- linkLibs = '-isysroot $(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs;
+ linkLibs = '-Wl,-syslibroot,$(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs;
}
const linkCmd = clangTool + ' ' + objFile + ' ' + lwsBridgeObj + ' ' + regexBridgeObj + ' ' + treeSitterObjs + ' -o ' + outputFile + noPie + ' ' + linkLibs;
if (verbose) { console.log('Running: ' + linkCmd); }