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

Commit 578cd0e

Browse files
committed
chore(server): clean up
1 parent 72a0c84 commit 578cd0e

File tree

2 files changed

+20
-73
lines changed

2 files changed

+20
-73
lines changed

server/project.ts

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,16 @@
1-
import {
2-
initWasm,
3-
SWCOptions,
4-
TransformOptions,
5-
transpileSync
6-
} from '../compiler/mod.ts'
7-
import type {
8-
AcceptedPlugin,
9-
ServerRequest
10-
} from '../deps.ts'
11-
import {
12-
CleanCSS,
13-
colors,
14-
ensureDir,
15-
less,
16-
marked,
17-
minify,
18-
path,
19-
postcss,
20-
safeLoadFront,
21-
Sha1,
22-
Sha256,
23-
walk
24-
} from '../deps.ts'
1+
import { initWasm, SWCOptions, TransformOptions, transpileSync } from '../compiler/mod.ts'
2+
import type { AcceptedPlugin, ServerRequest } from '../deps.ts'
3+
import { CleanCSS, colors, ensureDir, less, marked, minify, path, postcss, safeLoadFront, Sha1, Sha256, walk } from '../deps.ts'
254
import { EventEmitter } from '../framework/core/events.ts'
26-
import {
27-
getPagePath,
28-
RouteModule,
29-
Routing
30-
} from '../framework/core/routing.ts'
31-
import {
32-
hashShort,
33-
reFullVersion,
34-
reHashJs,
35-
reHashResolve,
36-
reHttp,
37-
reLocaleID,
38-
reMDExt,
39-
reModuleExt,
40-
reStyleModuleExt
41-
} from '../shared/constants.ts'
5+
import { getPagePath, RouteModule, Routing } from '../framework/core/routing.ts'
6+
import { hashShort, reFullVersion, reHashJs, reHashResolve, reHttp, reLocaleID, reMDExt, reModuleExt, reStyleModuleExt } from '../shared/constants.ts'
427
import util from '../shared/util.ts'
43-
import type {
44-
APIHandler,
45-
Config,
46-
RouterURL
47-
} from '../types.ts'
8+
import type { APIHandler, Config, RouterURL } from '../types.ts'
489
import { VERSION } from '../version.ts'
4910
import { Request } from './api.ts'
5011
import log from './log.ts'
51-
import type {
52-
DependencyDescriptor,
53-
ImportMap,
54-
Module
55-
} from './types.ts'
56-
import {
57-
cleanupCompilation,
58-
colorfulBytesString,
59-
createHtml,
60-
ensureTextFile,
61-
existsDirSync,
62-
existsFileSync,
63-
fixImportMap,
64-
fixImportUrl,
65-
getAlephPkgUrl,
66-
getRelativePath,
67-
newModule
68-
} from './util.ts'
69-
70-
interface RenderResult {
71-
url: RouterURL
72-
status: number
73-
head: string[]
74-
scripts: Record<string, any>[]
75-
body: string
76-
data: Record<string, string> | null
77-
}
12+
import type { DependencyDescriptor, ImportMap, Module, RenderResult } from './types.ts'
13+
import { cleanupCompilation, colorfulBytesString, createHtml, ensureTextFile, existsDirSync, existsFileSync, fixImportMap, fixImportUrl, getAlephPkgUrl, getRelativePath, newModule } from './util.ts'
7814

7915
/**
8016
* A Project to manage the Aleph.js appliaction.
@@ -836,7 +772,7 @@ export class Project {
836772
const output = await less.render(sourceCode || '/* empty content */')
837773
css = output.css
838774
} catch (error) {
839-
throw new Error(`less: ${error}`);
775+
throw new Error(`less: ${error}`)
840776
}
841777
}
842778

server/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { RouterURL } from '../types.ts'
2+
13
export interface Module {
24
url: string
35
loader: string
@@ -18,3 +20,12 @@ export interface DependencyDescriptor {
1820
}
1921

2022
export type ImportMap = Record<string, ReadonlyArray<string>>
23+
24+
export interface RenderResult {
25+
url: RouterURL
26+
status: number
27+
head: string[]
28+
scripts: Record<string, any>[]
29+
body: string
30+
data: Record<string, string> | null
31+
}

0 commit comments

Comments
 (0)