Skip to content

Instantly share code, notes, and snippets.

@mizchi
mizchi / firebase.json
Last active Feb 23, 2021
Cloud Function built by webpack
View firebase.json
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "/api/hello",
View svelte-ssr-css.ts
import { GENERATED_CSS_PREFIX } from "./constants";
import * as uniroll from "uniroll";
import ts from "typescript";
import { svelte } from "./index";
import fetch from "isomorphic-unfetch";
import vm from "vm";
import fs from "fs";
global.fetch = fetch;
View deno_code_reading.md

deno のコードを読んだメモ。

そこまで大きなプロジェクトでもないので、rust と cpp そこまで習熟してなくても読めるだろうという気持ち。

ブートプロセス

https://denolib.gitbook.io/guide/installing-deno

起動プロセスっぽいところ。

View svelte-ssr-test.ts
import * as uniroll from "uniroll";
import ts from "typescript";
import { svelte } from "rollup-plugin-uniroll-svelte";
import fetch from "isomorphic-unfetch";
import vm from "vm";
global.fetch = fetch;
const App = `
<script lang="ts">
export let foo: string;
@mizchi
mizchi / predict-frontend.md
Last active Feb 18, 2021
React のユーザーから見た今後のフロントエンドの予想
View predict-frontend.md

この記事は議論のたたき台で、ポジショントークや、偏見にまみれています。

今のフロントエンドの分類

  • 古典的なサーバーサイド WAF への +α の味付け
  • 大規模なクライアントアプリケーション管理のための SPA
  • SEO / SSR を考慮した Node ヘヴィーな環境

他、提唱されてるパターン

View printTemplate.ts
import { ExtendedTemplateNode } from "../../types";
import * as compiler from "svelte/compiler";
// import ts from "typescript";
import prettier from "prettier/standalone";
// @ts-ignore
import * as sveltePlugin from "prettier-plugin-svelte";
import * as astring from "astring";
// @ts-ignore
@mizchi
mizchi / printTemplate.ts
Created Feb 9, 2021
Generate code from svelte ast
View printTemplate.ts
import prettier from "prettier/standalone";
import produce from "immer";
import { parse } from "svelte/compiler";
import type { Ast } from "svelte/types/compiler/interfaces";
// @ts-ignore
import * as sveltePlugin from "prettier-plugin-svelte";
function printTemplate(ast: Ast) {
const overridePlugin = produce(sveltePlugin, (d: any) => {
d.parsers.svelte.parse = () => {
View loadExternalLibTypes.ts
// esm.sh の x-typescript-types を返すだけのエンドポイントのラッパー
import { getTypes } from "../pages/api/types";
import type * as Monaco from "monaco-editor";
import path from "path";
import { kvsIndexedDB } from "@kvs/indexeddb";
import ts from "typescript";
type Ctx = {
monaco: typeof Monaco;
extractImportSpecifiers: (code: string) => Promise<string[]>;
View Nondestructive_TypeScript.md

非破壊 TypeSctript

mizchi / TypeScript Meetup 2


About

  • mizchi / 竹馬光太郎
  • フロントエンドと Node.js
View getComponentProps.ts
import ts from "typescript";
import { preprocess } from "svelte/compiler";
import { PreprocessorGroup } from "svelte/types/compiler/preprocess/types";
export async function getComponentProps(code: string) {
let interfaces: Array<{
identifier: string;
type: "number" | "string" | "boolean";
comment?: string;
}> = [];