Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d2c3809
refactor: improve useDeno signature
ije Jan 22, 2021
4691ed1
refactor: improve `formatBytesWithColor` fn
ije Jan 22, 2021
612410a
refactor: improve `useDeno` hook
ije Jan 22, 2021
5c85592
refactor: clean up
ije Jan 22, 2021
939eb41
chore: update deps
ije Jan 22, 2021
8b9b297
breaking: remove less loader
ije Jan 22, 2021
d713bec
chore(design): update poster drawing
ije Jan 22, 2021
3961be6
chore(compiler): rebuild wasm
ije Jan 22, 2021
b995b89
chore(github): combine github ci configs
ije Jan 22, 2021
7d48d01
chore(design): update poster drawing
ije Jan 22, 2021
9653207
refactor: clean up
ije Jan 22, 2021
9d264ec
refactor(compiler): bundled_paths -> bundled_modules
ije Jan 22, 2021
a4b4806
chore(compiler): rebuild wasm
ije Jan 22, 2021
8531c9f
feat(server): bundle imported css
ije Jan 22, 2021
447b9e3
feat(compiler): add `JSXLinkFixer` fold
ije Jan 22, 2021
996946d
refactor: update types.ts
ije Jan 22, 2021
07ae4f3
feat: bundle css as well
ije Jan 22, 2021
5386bc9
fix: fix StatusError styling
ije Jan 22, 2021
fe373e0
chore: update sass dep
ije Jan 22, 2021
a5bc4c4
doc: update contributing
ije Jan 22, 2021
07a4c90
chore: update `with-plugins` example
ije Jan 22, 2021
a6aad7b
chore: update `hello-world` example
ije Jan 22, 2021
56119e1
chore(compiler): rebuild wasm
ije Jan 22, 2021
cb180f9
refactor: remove console log
ije Jan 22, 2021
cb67706
refactor: rename methods of Project class
ije Jan 22, 2021
524f06e
chore(design): redraw poster
ije Jan 22, 2021
46012be
doc(readme): add banner link
ije Jan 22, 2021
5b5369d
Merge branch 'master' into bundler-improvement
Jan 23, 2021
80023d7
chore(vscode): update workspace settings
ije Jan 24, 2021
2f90808
refactor: combine build output
ije Jan 24, 2021
4918ab5
doc: update jsDoc of types.ts
ije Jan 24, 2021
afcb3b8
revert: refactor: combine build output
ije Jan 24, 2021
d2bf94b
breaking: remove fallback field of ssr options
ije Jan 24, 2021
8162d2f
breaking: remove markdown pages
Jan 26, 2021
a8e8b94
refactor: update types.ts
Jan 26, 2021
3bdb867
chore: remove markdown-blog example
Jan 26, 2021
a46c0a1
chore(deps): remove unused deps
Jan 26, 2021
8c41578
refactor: update plugin typing
Jan 26, 2021
603b2bb
fix: fix testing
Jan 26, 2021
fe94c82
doc: update contributing.md
Jan 26, 2021
66abfb6
fix: fix ssg preload scripts
Jan 27, 2021
0029e70
refactor: clean up
Jan 27, 2021
ed6369a
fix: fix createHtml
Jan 27, 2021
42a4f45
fix: fix source map
Jan 27, 2021
87c97d9
refactor(cli): update help messages
Jan 27, 2021
c039ac1
refactor: improve `useDeno` hook signature
Jan 28, 2021
adc4662
chore: update git ignore rules
Jan 28, 2021
52b9aec
refactor: move compiler build
Jan 28, 2021
351b4dc
chore(compiler): update build and benchmark script
Jan 28, 2021
3175ae4
refactor: upate typings
Jan 28, 2021
55808b3
feat: support custom server
Jan 28, 2021
02e6d9d
refactor: clean up
Jan 28, 2021
250cdaa
refactor: clean up
Jan 28, 2021
acec179
refactor: clean up
Jan 28, 2021
2341f96
refactor: improve plugin typings
Jan 28, 2021
43403a0
chore(compiler): update benchmark script
Jan 28, 2021
393cb5c
refactor: clean up
Jan 28, 2021
789493a
refactor: simplify server mod export
Jan 29, 2021
a515e0a
chore(react): update react-refresh runtime to 0.9.0
Jan 29, 2021
b086df6
feat: rewrite plugin system
Jan 29, 2021
28d8a6b
fix: fix #102
Jan 29, 2021
a5d0664
refactor(compiler): improve id generating
Jan 30, 2021
e79dc70
chore(compiler): update packages
Jan 30, 2021
c5386a1
refactor(compiler): clean up
Jan 30, 2021
51ce472
chore(compiler): update the build script
Jan 30, 2021
2aebbd5
refactor(compiler): update trim_end_matches argument
Jan 30, 2021
9073538
refactor(server): update mime types
Jan 30, 2021
9a209f2
refactor(plugin): update LoaderPlugin interface
Jan 30, 2021
ffe5545
refactor(framework): improve react framework
Jan 30, 2021
63caa9d
refactor(server): clean up
Jan 30, 2021
b275e48
chore(compiler): rebuild wasm
Jan 30, 2021
79829bd
refactor: simplify import map
Jan 31, 2021
1c3f008
refactor: clean up
Jan 31, 2021
7ba39af
fix(compiler): fix importMap typing
Jan 31, 2021
369cf05
refactor: format
Jan 31, 2021
9e6a22c
refactor: improve server plugin
Jan 31, 2021
10c9615
fix: fix sass loader plugin
Jan 31, 2021
ad881a6
refactor: improve framework loading
Jan 31, 2021
2facb19
fix: fix `fixImportUrl` method
Jan 31, 2021
811166c
refactor: don't panic when loader is undefined
Jan 31, 2021
2b7d8fa
chore(compiler): rebuild wasm
Jan 31, 2021
6a004f7
chore: update examples
Jan 31, 2021
8216224
Merge branch 'master' into bundler-improvement
Jan 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .github/workflows/aleph_in_deno.yml

This file was deleted.

24 changes: 15 additions & 9 deletions .github/workflows/swc.yml → .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: compiler
name: Aleph.js Testing

on:
push:
Expand All @@ -13,16 +8,21 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }} # runs a test on macOS, Windows and Ubuntu
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macOS-latest, windows-latest, ubuntu-latest]

steps:
- name: Setup repo
- name: Checkout
uses: actions/checkout@v2

- name: Setup deno
uses: denolib/setup-deno@v2
with:
deno-version: v1.x

- name: Setup rust
uses: hecrj/setup-rust-action@v1
with:
Expand All @@ -33,5 +33,11 @@ jobs:
with:
version: latest

- name: Run tests
- name: Cache deps
run: deno cache deps.ts

- name: Deno test
run: deno test -A --unstable --location "http://localhost/"

- name: Cargo test
run: cd compiler && cargo test --all
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Thumbs.db
compiler/target/
compiler/pkg/
.aleph/
dist/
examples/**/.aleph/
examples/**/dist/
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"typescript.format.semicolons": "remove",
"typescript.preferences.quoteStyle": "single",
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
Expand Down
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,32 @@ You will need [Deno](https://deno.land/) 1.7+.

```bash
# ssr
deno run -A --unstable --import-map=import_map.json cli.ts dev ./examples/hello-world -L debug
deno run -A --unstable --import-map=import_map.json --location=http://localhost cli.ts dev ./examples/hello-world -L debug
# ssg
deno run -A --unstable --import-map=import_map.json cli.ts build ./examples/hello-world -L debug
deno run -A --unstable --import-map=import_map.json --location=http://localhost cli.ts build ./examples/hello-world -L debug
```

## Testing

Run all tests:

```bash
deno test -A
deno test -A --location=http://localhost
```

## Project Structure

- **/cli** command code
- **/compiler** compiler in rust with swc
- **/framework** framework code
- **/cli** commands code
- **/compiler** compiler in rust powered by swc
- **/framework**
- **core** framework core
- **react** react framework code
- **/design** design drawings and assets
- **/examples** examples
- **/plugins** official plugins
- **/server** server code
- **/shared** shared code
- **/test** testings
- **/vendor** packages from npm

## Code of Conduct

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Aleph.js: The Full-stack Framework in Deno.](./design/poster.svg)
[![Aleph.js: The Full-stack Framework in Deno.](./design/poster.svg)](https://alephjs.org)

<p>
<span>&nbsp;&nbsp;&nbsp;<span>
Expand Down
45 changes: 23 additions & 22 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { listenAndServe, path, ServerRequest, walk } from './deps.ts'
import { listenAndServe, path, walk } from './deps.ts'
import { Request } from './server/api.ts'
import log from './server/log.ts'
import { getContentType } from './server/mime.ts'
import { createHtml, existsDirSync, existsFileSync } from './server/util.ts'
import { createHtml } from './server/util.ts'
import { existsDirSync, existsFileSync } from './shared/fs.ts'
import log from './shared/log.ts'
import util from './shared/util.ts'
import { ServerRequest } from './types.ts'
import { VERSION } from './version.ts'

const commands = {
Expand All @@ -15,7 +17,7 @@ const commands = {
}

const helpMessage = `Aleph.js v${VERSION}
The React Framework in deno.
The Full-stack Framework in Deno.

Docs: https://alephjs.org/docs
Bugs: https://github.com/alephjs/aleph.js/issues
Expand All @@ -27,47 +29,46 @@ Commands:
${Object.entries(commands).map(([name, desc]) => `${name.padEnd(15)}${desc}`).join('\n ')}

Options:
-h, --help Prints help message
-v, --version Prints version number
-h, --help Prints help message
`

async function main() {
// parse deno args
const args: Array<string> = []
const argOptions: Record<string, string | boolean> = {}
const flags: Record<string, string | boolean> = {}
for (let i = 0; i < Deno.args.length; i++) {
const arg = Deno.args[i]
if (arg.startsWith('-')) {
if (arg.includes('=')) {
const [key, value] = arg.replace(/^-+/, '').split('=', 2)
argOptions[key] = value
flags[key] = value
} else {
const key = arg.replace(/^-+/, '')
const nextArg = Deno.args[i + 1]
if (nextArg && !nextArg.startsWith('-')) {
argOptions[key] = nextArg
flags[key] = nextArg
i++
} else {
argOptions[key] = true
flags[key] = true
}
}
} else {
args.push(arg)
}
}

// get command, default is 'dev'
const hasCommand = args.length > 0 && args[0] in commands
const command = (hasCommand ? String(args.shift()) : 'dev') as keyof typeof commands

// prints aleph.js version
if (argOptions.v && command != 'upgrade') {
if (flags.v && command != 'upgrade') {
console.log(`aleph.js v${VERSION}`)
Deno.exit(0)
}

// prints aleph.js and deno version
if (argOptions.version && command != 'upgrade') {
if (flags.version && command != 'upgrade') {
const { deno, v8, typescript } = Deno.version
console.log(`aleph.js ${VERSION}`)
console.log(`deno ${deno}`)
Expand All @@ -77,7 +78,7 @@ async function main() {
}

// prints help message
if (argOptions.h || argOptions.help) {
if (flags.h || flags.help) {
if (hasCommand) {
import(`./cli/${command}.ts`).then(({ helpMessage }) => {
console.log(commands[command])
Expand All @@ -94,7 +95,7 @@ async function main() {
}

// sets log level
const l = argOptions.L || argOptions['log-level']
const l = flags.L || flags['log-level']
if (util.isNEString(l)) {
log.setLevel(l)
}
Expand All @@ -116,7 +117,7 @@ async function main() {
}
}

// proxy https://deno.land/x/aleph for framework dev
// proxy https://deno.land/x/aleph for aleph.js dev
if (['dev', 'start', 'build'].includes(command) && existsFileSync('./import_map.json')) {
const { imports } = JSON.parse(Deno.readTextFileSync('./import_map.json'))
if (imports['https://deno.land/x/aleph/']) {
Expand Down Expand Up @@ -161,14 +162,14 @@ async function main() {

const { default: cmd } = await import(`./cli/${command}.ts`)
if (command === 'upgrade') {
await cmd(argOptions.v || argOptions.version || 'latest')
} else {
const appDir = path.resolve(args[0] || '.')
if (command !== 'init' && !existsDirSync(appDir)) {
log.fatal('No such directory:', appDir)
}
await cmd(appDir, argOptions)
await cmd(flags.v || flags.version || args[0] || 'latest')
return
}
const appDir = path.resolve(args[0] || '.')
if (command !== 'init' && !existsDirSync(appDir)) {
log.fatal('No such directory:', appDir)
}
await cmd(appDir, flags)
}

if (import.meta.main) {
Expand Down
14 changes: 7 additions & 7 deletions cli/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Project } from '../server/project.ts'
import { Appliaction } from '../server/mod.ts'

export const helpMessage = `
Usage:
Expand All @@ -8,13 +8,13 @@ Usage:
if the <dir> is empty, the current directory will be used.

Options:
-L, --log-level Set log level [possible values: debug, info]
-r, --reload Reload source code cache
-h, --help Prints help message
-L, --log-level <log-level> Set log level [possible values: debug, info]
-r, --reload Reload source code cache
-h, --help Prints help message
`

export default async function (appDir: string, options: Record<string, string | boolean>) {
const project = new Project(appDir, 'production', Boolean(options.r || options.reload))
await project.build()
export default async function (workingDir: string, options: Record<string, string | boolean>) {
const app = new Appliaction(workingDir, 'production', Boolean(options.r || options.reload))
await app.build()
Deno.exit(0)
}
24 changes: 9 additions & 15 deletions cli/dev.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import log from '../server/log.ts'
import { start } from '../server/server.ts'
import { Appliaction, parsePortNumber, serve } from '../server/mod.ts'

export const helpMessage = `
Usage:
Expand All @@ -9,19 +8,14 @@ Usage:
if the <dir> is empty, the current directory will be used.

Options:
-hn, --host A host to start the Aleph.js app, default is localhost
-p, --port A port number to start the Aleph.js app, default is 8080
-L, --log-level Set log level [possible values: debug, info]
-r, --reload Reload source code cache
-h, --help Prints help message
-p, --port <port> A port number to start the Aleph.js app, default is 8080
-L, --log-level <log-level> Set log level [possible values: debug, info]
-r, --reload Reload source code cache
-h, --help Prints help message
`

export default async function (appDir: string, options: Record<string, string | boolean>) {
const host = String(options.hn || options.host || 'localhost')
const port = parseInt(String(options.p || options.port || '8080'))
if (isNaN(port) || port <= 0 || !Number.isInteger(port)) {
log.error(`invalid port '${options.port || options.p}'`)
Deno.exit(1)
}
start(appDir, host, port, true, Boolean(options.r || options.reload))
export default async function (workingDir: string, options: Record<string, string | boolean>) {
const port = parsePortNumber(String(options.p || options.port || '8080'))
const app = new Appliaction(workingDir, 'development', Boolean(options.r || options.reload))
serve('localhost', port, app)
}
Loading