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

Commit f022fe9

Browse files
author
Je
committed
refactor: cleanup
1 parent cdaafca commit f022fe9

File tree

10 files changed

+15
-212
lines changed

10 files changed

+15
-212
lines changed

app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export function ALEPH({ initial }: {
143143
}
144144
}, [manifest])
145145

146-
const Page = page.Component || e404.Component
147146
return React.createElement(
148147
AppManifestContext.Provider,
149148
{ value: manifest },
@@ -153,7 +152,9 @@ export function ALEPH({ initial }: {
153152
React.createElement(
154153
RouterContext.Provider,
155154
{ value: page.url },
156-
app.Component ? React.createElement(app.Component, { Page }) : React.createElement(Page)
155+
(page.Component && app.Component) && React.createElement(app.Component, { Page: page.Component }),
156+
(page.Component && !app.Component) && React.createElement(page.Component),
157+
!page.Component && React.createElement(e404.Component),
157158
)
158159
)
159160
)

error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function ErrorPage({ status, text = getStatusText(status), refreshButton
6666
React.createElement(
6767
'title',
6868
null,
69-
status + ' Error - Aleph.js'
69+
status + ' - ' + text
7070
),
7171
),
7272
React.createElement(

project.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ import { colors, ensureDir, path, Sha1, walk } from './std.ts'
77
import { compile } from './tsc/compile.ts'
88
import type { APIHandle, Config, Location, RouterURL } from './types.ts'
99
import util, { hashShort, reHashJs, reHttp, reModuleExt, reStyleModuleExt } from './util.ts'
10-
import './vendor/clean-css-builds/v4.2.2.js'
11-
import { Document } from './vendor/deno-dom/document.ts'
12-
import less from './vendor/less/less.js'
10+
import { cleanCSS, Document, less } from './vendor/mod.ts'
1311
import { version } from './version.ts'
1412

15-
const { CleanCSS } = window as any
16-
const cleanCSS = new CleanCSS({ compatibility: '*' /* Internet Explorer 10+ */ })
17-
1813
interface Module {
1914
id: string
2015
url: string
@@ -454,7 +449,7 @@ export default class Project {
454449
const precompileUrls = [
455450
'https://deno.land/x/aleph/bootstrap.ts',
456451
'https://deno.land/x/aleph/renderer.ts',
457-
'https://deno.land/x/aleph/vendor/tslib/tslib.js',
452+
'https://deno.land/x/aleph/tsc/tslib.js',
458453
]
459454
if (this.isDev) {
460455
precompileUrls.push('https://deno.land/x/aleph/hmr.ts')
@@ -633,7 +628,7 @@ export default class Project {
633628
}
634629
const module = this._newModule('/main.js')
635630
const deps = [
636-
'https://deno.land/x/aleph/vendor/tslib/tslib.js',
631+
'https://deno.land/x/aleph/tsc/tslib.js',
637632
'https://deno.land/x/aleph/app.ts',
638633
this.isDev && 'https://deno.land/x/aleph/hmr.ts'
639634
].filter(Boolean).map(url => ({
@@ -673,7 +668,7 @@ export default class Project {
673668

674669
module.jsContent = [
675670
this.isDev && 'import "./-/deno.land/x/aleph/hmr.js";',
676-
'import "./-/deno.land/x/aleph/vendor/tslib/tslib.js";',
671+
'import "./-/deno.land/x/aleph/tsc/tslib.js";',
677672
'import bootstrap from "./-/deno.land/x/aleph/bootstrap.js";',
678673
`bootstrap(${JSON.stringify(config, undefined, this.isDev ? 4 : undefined)});`
679674
].filter(Boolean).join(this.isDev ? '\n' : '')
@@ -877,7 +872,7 @@ export default class Project {
877872
}
878873
const jsContent = outputText.replace(/import([^'"]*)("|')tslib("|')(\)|;)?/g, 'import$1' + JSON.stringify(relativePath(
879874
path.dirname(mod.sourceFilePath),
880-
'/-/deno.land/x/aleph/vendor/tslib/tslib.js'
875+
'/-/deno.land/x/aleph/tsc/tslib.js'
881876
)) + '$4')
882877
if (this.isDev) {
883878
mod.jsContent = jsContent
File renamed without changes.

util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export const hashShort = 7
22
export const reHttp = /^https?:\/\//i
33
export const reModuleExt = /\.(js|jsx|mjs|ts|tsx)$/i
44
export const reStyleModuleExt = /\.(css|less|sass|scss)$/i
5-
export const reSVGExt = /\.(svg|svgz)$/i
65
export const reMDExt = /\.(md|mdx)$/i
76
export const reHashJs = new RegExp(`\\.[0-9a-fx]{${hashShort}}\\.js$`, 'i')
87

vendor/mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export { Document } from './deno-dom/document.ts'
2+
export { default as less } from './less/less.js'
3+
import './clean-css-builds/v4.2.2.js'
4+
5+
const { CleanCSS } = window as any
6+
export const cleanCSS = new CleanCSS({ compatibility: '*' /* Internet Explorer 10+ */ })

vendor/tslib/CopyrightNotice.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

vendor/tslib/LICENSE.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

vendor/tslib/README.md

Lines changed: 0 additions & 142 deletions
This file was deleted.

vendor/tslib/package.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)