Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 037ff3f

Browse files
committed
Clean up
1 parent fa87fc1 commit 037ff3f

File tree

25 files changed

+90
-126
lines changed

25 files changed

+90
-126
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"./types.d.ts"
1111
],
1212
"jsx": "react-jsx",
13-
"jsxImportSource": "https://esm.sh/v110/react@18.2.0"
13+
"jsxImportSource": "https://esm.sh/react@18.2.0"
1414
},
1515
"importMap": "./import_map.json",
1616
"fmt": {

examples/monaco-editor/editor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { editor, Uri } from "https://esm.sh/v110/monaco-editor@0.36.1";
2-
import "https://esm.sh/v110/monaco-editor@0.36.1?css";
1+
import { editor, Uri } from "https://esm.sh/monaco-editor@0.36.1";
2+
import "https://esm.sh/monaco-editor@0.36.1?css";
33

44
// deno-lint-ignore ban-ts-comment
55
// @ts-ignore
66
self.MonacoEnvironment = {
77
async getWorker(_: unknown, label: string) {
88
if (label === "typescript" || label === "javascript") {
99
const { default: tsWorker } = await import(
10-
"https://esm.sh/v110/monaco-editor@0.36.1/esm/vs/language/typescript/ts.worker?worker"
10+
"https://esm.sh/monaco-editor@0.36.1/esm/vs/language/typescript/ts.worker?worker"
1111
);
1212
return tsWorker();
1313
}
1414
const { default: editorWorker } = await import(
15-
"https://esm.sh/v110/monaco-editor@0.36.1/esm/vs/editor/editor.worker?worker"
15+
"https://esm.sh/monaco-editor@0.36.1/esm/vs/editor/editor.worker?worker"
1616
);
1717
return editorWorker();
1818
},

examples/react-mdx-app/routes/_export.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// deno-fmt-ignore-file
44
// deno-lint-ignore-file
55
// @ts-nocheck
6-
var u=Object.defineProperty;var c=(s,e)=>{for(var o in e)u(s,o,{get:e[o],enumerable:!0})};import*as y from"./_404.tsx";import*as k from"./_app.tsx";import*as v from"./index.tsx";import*as A from"./docs.tsx";var t={};c(t,{default:()=>b});import{Fragment as g,jsx as r,jsxs as i}from"https://esm.sh/v110/react@18.2.0/jsx-runtime";import{useMDXComponents as h}from"https://esm.sh/v110/@mdx-js/react@2.3.0";import{Head as j}from"aleph/react";function d(s){let e=Object.assign({h1:"h1",p:"p",code:"code",pre:"pre"},h(),s.components);return i(g,{children:[r(j,{children:r("title",{children:"Get Started - Docs"})}),`
6+
var u=Object.defineProperty;var c=(s,e)=>{for(var o in e)u(s,o,{get:e[o],enumerable:!0})};import*as y from"./_404.tsx";import*as k from"./_app.tsx";import*as v from"./index.tsx";import*as A from"./docs.tsx";var t={};c(t,{default:()=>b});import{Fragment as g,jsx as r,jsxs as i}from"https://esm.sh/react@18.2.0/jsx-runtime";import{useMDXComponents as h}from"https://esm.sh/v112/@mdx-js/react@2.3.0";import{Head as j}from"aleph/react";function d(s){let e=Object.assign({h1:"h1",p:"p",code:"code",pre:"pre"},h(),s.components);return i(g,{children:[r(j,{children:r("title",{children:"Get Started - Docs"})}),`
77
`,r(e.h1,{id:"get-started",children:"Get Started"}),`
88
`,i(e.p,{children:["Initialize a new project, you can pick a start template with ",r(e.code,{children:"--template"}),` flag, available templates:
99
`,r(e.code,{children:"[react, vue, api, yew]"})]}),`
1010
`,r(e.pre,{children:r(e.code,{className:"hljs language-bash",children:`deno run -A https://deno.land/x/aleph@1.0.0-beta.18/init.ts
11-
`})})]})}function f(s={}){let{wrapper:e}=Object.assign({},h(),s.components);return e?r(e,Object.assign({},s,{children:r(d,s)})):d(s)}var b=f;var l={};c(l,{default:()=>x});import{Fragment as N,jsx as n,jsxs as a}from"https://esm.sh/v110/react@18.2.0/jsx-runtime";import{useMDXComponents as p}from"https://esm.sh/v110/@mdx-js/react@2.3.0";import{Head as w}from"aleph/react";function m(s){let e=Object.assign({h1:"h1",p:"p",strong:"strong",a:"a",blockquote:"blockquote",em:"em",code:"code",pre:"pre",span:"span"},p(),s.components);return a(N,{children:[n(w,{children:n("title",{children:"About - Docs"})}),`
11+
`})})]})}function f(s={}){let{wrapper:e}=Object.assign({},h(),s.components);return e?r(e,Object.assign({},s,{children:r(d,s)})):d(s)}var b=f;var l={};c(l,{default:()=>x});import{Fragment as N,jsx as n,jsxs as a}from"https://esm.sh/react@18.2.0/jsx-runtime";import{useMDXComponents as p}from"https://esm.sh/v112/@mdx-js/react@2.3.0";import{Head as w}from"aleph/react";function m(s){let e=Object.assign({h1:"h1",p:"p",strong:"strong",a:"a",blockquote:"blockquote",em:"em",code:"code",pre:"pre",span:"span"},p(),s.components);return a(N,{children:[n(w,{children:n("title",{children:"About - Docs"})}),`
1212
`,n(e.h1,{id:"about",children:"About"}),`
1313
`,a(e.p,{children:[n(e.strong,{children:"Aleph.js"})," (or ",n(e.strong,{children:"Aleph"})," or ",n(e.strong,{children:"\u05D0"})," or ",n(e.strong,{children:"\u963F\u83B1\u592B"}),", ",n("samp",{children:"\u02C8\u0251\u02D0l\u025Bf"}),`) is a
1414
fullstack framework in `,n(e.a,{href:"https://deno.land",children:"Deno"}),". Inspired by ",n(e.a,{href:"https://nextjs.org",children:"Next.js"}),", ",n(e.a,{href:"https://remix.run",children:"Remix"})," and ",n(e.a,{href:"https://vitejs.dev",children:"Vite"}),"."]}),`

examples/react-mdx-app/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import mdx from "aleph/plugins/mdx";
55
import modules from "./routes/_export.ts";
66

77
// check https://mdxjs.com/docs/extending-mdx
8-
import remarkFrontmatter from "https://esm.sh/v110/remark-frontmatter@4.0.1";
9-
import remarkGFM from "https://esm.sh/v110/remark-gfm@3.0.1";
10-
import rehypeHighlight from "https://esm.sh/v110/rehype-highlight@5.0.2";
11-
import rehypeSlug from "https://esm.sh/v110/rehype-slug@5.0.1";
8+
import remarkFrontmatter from "https://esm.sh/v112/remark-frontmatter@4.0.1";
9+
import remarkGFM from "https://esm.sh/v112/remark-gfm@3.0.1";
10+
import rehypeHighlight from "https://esm.sh/v112/rehype-highlight@5.0.2";
11+
import rehypeSlug from "https://esm.sh/v112/rehype-slug@5.0.1";
1212

1313
serve({
1414
plugins: [

examples/react-mdx-app/style/hljs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* copied from https://esm.sh/v110/highlightjs@9.16.2/styles/github.css */
1+
/* copied from https://esm.sh/highlightjs@9.16.2/styles/github.css */
22

33
.hljs {
44
display: block;

examples/solid-app/routes/_export.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

examples/vue-app/routes/_export.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

framework/core/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mitt from "https://esm.sh/v110/mitt@3.0.0";
1+
import mitt from "https://esm.sh/v112/mitt@3.0.0";
22

33
// shared event emitter for client(browser)
44
export default mitt<Record<string, Record<string, unknown>>>();

framework/core/router.ts

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import { createStaticURLPatternResult, URLPatternCompat } from "./url_pattern.ts
44
import { FetchError } from "./error.ts";
55
import events from "./events.ts";
66

7+
export type Router = {
8+
prefix: string;
9+
routes: RoutePattern[];
10+
appDir?: string; // for ssr
11+
_404?: RoutePattern;
12+
_app?: RoutePattern;
13+
};
14+
715
export type RouteModule = {
816
url: URL;
917
params: Record<string, string>;
@@ -14,44 +22,33 @@ export type RouteModule = {
1422
dataCacheTtl?: number;
1523
};
1624

17-
export type RouteMeta = {
18-
filename: string;
19-
pattern: URLPatternInput;
20-
nesting?: boolean;
21-
};
22-
2325
export type RouteData = {
2426
data?: unknown;
2527
dataCacheTtl?: number;
2628
dataExpires?: number;
2729
};
2830

29-
export type Route = readonly [
31+
export type RouteMeta = {
32+
filename: string;
33+
pattern: URLPatternInput;
34+
nesting?: boolean;
35+
};
36+
37+
export type RoutePattern = readonly [
3038
pattern: URLPatternCompat,
3139
meta: RouteMeta,
3240
];
3341

34-
export type Router = {
35-
appDir?: string;
36-
prefix: string;
37-
routes: Route[];
38-
_404?: Route;
39-
_app?: Route;
40-
};
42+
export type RouteMatch = readonly [
43+
ret: URLPatternResult,
44+
route: RouteMeta,
45+
];
4146

4247
export type CSRContext = {
4348
readonly router: Router;
4449
readonly modules: RouteModule[];
4550
};
4651

47-
export type RouteRegExp = {
48-
prefix: string;
49-
test(filename: string): boolean;
50-
exec(filename: string): URLPatternInput | null;
51-
};
52-
53-
export type RouteMatch = [ret: URLPatternResult, route: RouteMeta];
54-
5552
/** match routes against the given url */
5653
// todo: support basePath
5754
export function matchRoutes(url: URL, router: Router): RouteMatch[] {
@@ -132,11 +129,11 @@ export function loadRouterFromTag(): Router {
132129
try {
133130
const manifest = JSON.parse(el.innerText);
134131
if (Array.isArray(manifest.routes)) {
135-
let _app: Route | undefined = undefined;
136-
let _404: Route | undefined = undefined;
132+
let _app: RoutePattern | undefined = undefined;
133+
let _404: RoutePattern | undefined = undefined;
137134
const routes = manifest.routes.map((meta: RouteMeta) => {
138135
const { pattern } = meta;
139-
const route: Route = [new URLPatternCompat(pattern), meta];
136+
const route: RoutePattern = [new URLPatternCompat(pattern), meta];
140137
if (pattern.pathname === "/_app") {
141138
_app = route;
142139
} else if (pattern.pathname === "/_404") {
@@ -283,7 +280,7 @@ export function listenRouter(
283280
const onhmrcreate = (e: Record<string, unknown>) => {
284281
const pattern = e.routePattern as URLPatternInput | undefined;
285282
if (pattern) {
286-
const route: Route = [
283+
const route: RoutePattern = [
287284
new URLPatternCompat(pattern),
288285
{
289286
filename: e.specifier as string,

framework/react/data.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import type { FC, PropsWithChildren } from "react";
22
import { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
33
import { FetchError } from "../core/error.ts";
4+
import type { RouteData } from "../core/router.ts";
45
import type { DataContextProps, HttpMethod, UpdateStrategy } from "./context.ts";
56
import { DataContext } from "./context.ts";
67

7-
export type RouteData = {
8-
data?: unknown;
9-
dataCacheTtl?: number;
10-
dataExpires?: number;
11-
};
12-
138
export type DataProviderProps = PropsWithChildren<{
149
dataUrl: string;
1510
dataCache: Map<string, RouteData>;

0 commit comments

Comments
 (0)