-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(global): add basic astro installation
- Loading branch information
Showing
17 changed files
with
3,212 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,4 @@ dist | |
.turbo | ||
.swc | ||
.mock | ||
.astro/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extends: ../../.eslintrc.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable import/no-default-export */ | ||
import { defineConfig } from 'astro/config'; | ||
import react from '@astrojs/react'; | ||
import tailwind from '@astrojs/tailwind'; | ||
|
||
export default defineConfig({ | ||
integrations: [react(), tailwind()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@ts-c-compiler/x86-16-vm", | ||
"version": "1.1.0", | ||
"private": false, | ||
"license": "MIT", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "astro dev", | ||
"build": "astro build", | ||
"lint": "npx eslint --max-warnings=0 src/", | ||
"check:types": "npx tsc --noEmit", | ||
"preview": "astro preview" | ||
}, | ||
"dependencies": { | ||
"@ts-c-compiler/x86-cpu": "*" | ||
}, | ||
"devDependencies": { | ||
"@astrojs/check": "^0.3.1", | ||
"@astrojs/react": "^3.0.4", | ||
"astro": "^3.5.2", | ||
"sass": "^1.69.5", | ||
"@astrojs/tailwind": "^5.0.2", | ||
"tailwindcss": "^3.0.24" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './screen'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useRef, useEffect } from 'react'; | ||
import { Buffer } from 'buffer'; | ||
import { X86CPU, VGARenderLoopDriver } from '@ts-c-compiler/x86-cpu'; | ||
|
||
type ScreenProps = { | ||
binary: Buffer; | ||
}; | ||
|
||
export const Screen = ({ binary }: ScreenProps) => { | ||
const screenRef = useRef<HTMLCanvasElement>(); | ||
|
||
useEffect(() => { | ||
if (!screenRef.current) { | ||
return; | ||
} | ||
|
||
const cpu = new X86CPU(); | ||
cpu | ||
.attach(VGARenderLoopDriver, { | ||
screenElement: screenRef.current, | ||
upscaleWidth: Number.parseInt( | ||
getComputedStyle(document.body).getPropertyValue( | ||
'--repl-output-width', | ||
), | ||
10, | ||
), | ||
}) | ||
.boot(binary); | ||
|
||
return () => { | ||
cpu.release(); | ||
}; | ||
}, [screenRef.current]); | ||
|
||
return ( | ||
<canvas | ||
ref={screenRef} | ||
className='block mx-auto text-center' | ||
style={{ | ||
imageRendering: 'pixelated', | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="astro/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
interface Props { | ||
title: string; | ||
} | ||
const { title } = Astro.props; | ||
--- | ||
|
||
<!doctype html> | ||
<html lang='en'> | ||
<head> | ||
<meta charset='UTF-8' /> | ||
<meta name='description' content='Astro description' /> | ||
<meta name='viewport' content='width=device-width' /> | ||
<link rel='icon' type='image/svg+xml' href='/favicon.svg' /> | ||
<meta name='generator' content={Astro.generator} /> | ||
<title>{title}</title> | ||
</head> | ||
<body> | ||
<slot /> | ||
</body> | ||
</html> | ||
|
||
<style lang='scss' is:global> | ||
html { | ||
font-family: Arial, system-ui, sans-serif; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
import { buffer } from 'node:stream/consumers'; | ||
import Layout from '../layouts/Layout.astro'; | ||
import { Screen } from '../components'; | ||
const binary = await buffer(process.stdin); | ||
--- | ||
|
||
<Layout title='X86-16bit emulator'> | ||
<div class='fixed left-0 top-0 w-full h-full flex items-center justify-center'> | ||
<Screen binary={binary} client:load /> | ||
</div> | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable import/no-default-export */ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/"], | ||
"compilerOptions": { | ||
"baseUrl": "src", | ||
"module": "CommonJS", | ||
"declaration": false, | ||
"declarationMap": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ module.exports = { | |
singleQuote: true, | ||
trailingComma: 'all', | ||
arrowParens: 'avoid', | ||
jsxSingleQuote: true, | ||
}; |
Oops, something went wrong.