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

Commit 4640074

Browse files
committed
refactor: clean up
1 parent c4a92e8 commit 4640074

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

compiler/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
[package]
22
name = "aleph-compiler"
33
version = "0.0.0"
4+
description = "The compiler of Aleph.js written in Rust, powered by swc."
5+
repository = "https://github.com/alephjs/aleph.js"
46
authors = ["The Aleph.js authors"]
7+
license = "MIT"
58
edition = "2018"
69

710
[lib]

compiler/src/swc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ impl SWC {
188188
}),
189189
!transpile_only
190190
),
191-
Optional::new(es2020(), options.target < JscTarget::Es2020),
192191
Optional::new(strip(), is_ts),
192+
Optional::new(es2020(), options.target < JscTarget::Es2020),
193193
Optional::new(es2018(), options.target < JscTarget::Es2018),
194194
Optional::new(es2017(), options.target < JscTarget::Es2017),
195195
Optional::new(es2016(), options.target < JscTarget::Es2016),

framework/core/hmr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ socket.addEventListener('message', ({ data }: { data?: string }) => {
9595
}
9696
break
9797
}
98-
console.log(`[HMR]${type} module '${url}'`)
98+
console.log(`[HMR] ${type} module '${url}'`)
9999
} catch (err) {
100100
console.warn(err)
101101
}

framework/react/anchor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import {
77
useCallback,
88
useEffect,
99
useMemo,
10-
lazy
1110
} from 'https://esm.sh/react'
1211
import util from '../../shared/util.ts'
1312
import events from '../core/events.ts'
14-
import { redirect } from '../core/routing.ts'
13+
import { redirect } from '../core/redirect.ts'
1514
import { useRouter } from './hooks.ts'
1615

1716
const prefetchedPages = new Set<string>()

framework/react/init.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export async function init(app: ServerApplication) {
77
if (app.mode === 'development') {
88
const alephPkgUri = getAlephPkgUri()
99
app.injectCode('hmr', (url: string, code: string) => {
10-
const reactRefresh = code.includes('$RefreshSig$(') || code.includes('$RefreshReg$(')
11-
if (reactRefresh) {
10+
if (code.includes('$RefreshReg$(')) {
1211
const refreshModuleUrl = getRelativePath(
1312
dirname(toLocalUrl(url)),
1413
toLocalUrl(`${alephPkgUri}/framework/react/refresh.js`)

framework/react/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useState,
77
} from 'https://esm.sh/react'
88
import events from '../core/events.ts'
9-
import { importModule, toPagePath } from '../core/module.ts'
9+
import { importModule } from '../core/module.ts'
1010
import { RouteModule, Routing } from '../core/routing.ts'
1111
import { RouterContext } from './context.ts'
1212
import { E400MissingComponent, E404Page, ErrorBoundary } from './error.ts'

server/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class Application implements ServerApplication {
127127

128128
const alephPkgUri = getAlephPkgUri()
129129
const buildManifestFile = join(this.buildDir, 'build.manifest.json')
130-
const configHash = computeHash(JSON.stringify({
130+
const configChecksum = computeHash(JSON.stringify({
131131
...this.defaultCompileOptions,
132132
plugins: this.config.plugins.filter(isLoaderPlugin).map(({ name }) => name)
133133
}))
@@ -139,7 +139,7 @@ export class Application implements ServerApplication {
139139
typeof v !== 'object' ||
140140
v === null ||
141141
v.compiler !== buildChecksum ||
142-
v.configHash !== configHash
142+
v.configChecksum !== configChecksum
143143
)
144144
} catch (e) { }
145145
}
@@ -156,9 +156,9 @@ export class Application implements ServerApplication {
156156
log.debug('rebuild...')
157157
ensureTextFile(buildManifestFile, JSON.stringify({
158158
aleph: VERSION,
159-
compiler: buildChecksum,
160-
configHash,
161159
deno: Deno.version.deno,
160+
compiler: buildChecksum,
161+
configChecksum,
162162
}, undefined, 2))
163163
}
164164

0 commit comments

Comments
 (0)