@mizchi | Workers Tech Talk
- SSR 前提 で最適化を行うUIライブラリ
- クライアントの処理が最小限
/** | |
* This is patched esm.sh/run | |
* - Add text/typescript-jsx | |
* - Add auto reload with ?poll={millisecond} | |
* | |
* Usage: | |
* <script type="module" src="https://gistcdn.githack.com/mizchi/897e4a83e33fdcec35fd7d17f84f79d3/raw/df31217503cad48cc9dece94269fe9779b60eba7/patched-esmsh-run.js"></script> | |
*/ | |
/*! esm.sh/run |
// subhosting | |
const API = "https://api.deno.com/v1"; | |
type CreateDeploymentResponse = { | |
id: string; | |
projectId: string; | |
description: string; | |
status: string; | |
domains: string[]; | |
databases: Record<string, any>; |
Original(japanese) https://zenn.dev/mizchi/articles/standalone-html-frontend
Mostly translated by deepl
Note: Do not use in production, tailwind is running in CDN mode and esm.sh builds scripts dynamically, so performance is not good.
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<style type="text/tailwindcss"> | |
@tailwind base; |
import { test, expect } from 'vitest'; | |
import { build, splitVendorChunkPlugin } from 'vite'; | |
import path from 'path'; | |
import { OutputAsset, OutputBundle, OutputChunk, RollupOutput } from 'rollup'; | |
import ts from 'typescript'; | |
const root = path.join(__dirname, "__fixtures") | |
test("nested", async () => { | |
const a = 'export default Math.random()'; |
import {test, expect} from 'vitest'; | |
test("nested", async () => { | |
const a = 'export default Math.random()'; | |
const b = `export default () => import('data:text/javascript;base64,${btoa(a)}')`; | |
const bmod = await import(`data:text/javascript;base64,${btoa(b)}`); | |
const amod = await import(`data:text/javascript;base64,${btoa(a)}`); | |
expect(await bmod.default()).not.toBe(await amod.default); | |
}); |
/* | |
Grid css layout utilities for [x, y, w, h] grid areas. | |
Example: | |
export default function App() { | |
return ( | |
<> | |
<Grid | |
rows={["32px", "1fr", "1fr", "1fr", "1fr"]} |
fn main() { | |
let x: Option<Result<(&str, &str), ()>> = Some(Ok(("x", "y"))); | |
// if let | |
if let Some(Ok((a, _))) = x { | |
if a == "x" { | |
println!("a=x"); | |
} | |
} | |
// match | |
match x { |