Skip to content

Commit 194328f

Browse files
Merge pull request #238 from lightpanda-io/update_readme
Update README
2 parents 7ec5a8d + 0636240 commit 194328f

File tree

3 files changed

+110
-57
lines changed

3 files changed

+110
-57
lines changed

Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ help:
2323

2424
# $(ZIG) commands
2525
# ------------
26-
.PHONY: build build-release run run-release shell test bench download-zig wpt
26+
.PHONY: build build-dev run run-release shell test bench download-zig wpt
2727

2828
zig_version = $(shell grep 'recommended_zig_version = "' "vendor/zig-js-runtime/build.zig" | cut -d'"' -f2)
2929
kernel = $(shell uname -ms)
@@ -54,23 +54,24 @@ endif
5454
@curl -o "$(dest)" -L "$(url)" || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
5555
@printf "\e[33mDownloaded $(dest)\e[0m\n"
5656

57-
## Build in debug mode
57+
## Build in release-safe mode
5858
build:
59-
@printf "\e[36mBuilding (debug)...\e[0m\n"
60-
@$(ZIG) build -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
61-
@printf "\e[33mBuild OK\e[0m\n"
62-
63-
build-release:
6459
@printf "\e[36mBuilding (release safe)...\e[0m\n"
6560
@$(ZIG) build -Doptimize=ReleaseSafe -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
6661
@printf "\e[33mBuild OK\e[0m\n"
6762

68-
## Run the server
63+
## Build in debug mode
64+
build-dev:
65+
@printf "\e[36mBuilding (debug)...\e[0m\n"
66+
@$(ZIG) build -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
67+
@printf "\e[33mBuild OK\e[0m\n"
68+
69+
## Run the server in debug mode
6970
run: build
7071
@printf "\e[36mRunning...\e[0m\n"
7172
@./zig-out/bin/browsercore || (printf "\e[33mRun ERROR\e[0m\n"; exit 1;)
7273

73-
## Run a JS shell in release-safe mode
74+
## Run a JS shell in debug mode
7475
shell:
7576
@printf "\e[36mBuilding shell...\e[0m\n"
7677
@$(ZIG) build shell -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)

README.md

Lines changed: 99 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,69 @@
1-
# Browsercore
1+
<p align="center">
2+
<a href="https://lightpanda.io"><img src="https://lpd-cdn.s3.eu-west-3.amazonaws.com/assets/images/logo/lpd-logo.png" alt="Logo" height=170></a>
3+
</p>
24

3-
## Build
5+
<h1 align="center">Lightpanda</h1>
6+
7+
<div align="center">
8+
<br />
9+
</div>
10+
11+
Lightpanda is the open-source browser made for headless usage:
12+
13+
- Javascript execution
14+
- Support of the Web APIs (partial, WIP)
15+
- Compatible with Playwright, Puppeteer through CDP (WIP)
16+
17+
Fast scraping and web automation with minimal memory footprint:
18+
19+
- Ultra-low memory footprint (12x less than Chrome)
20+
- Blazingly fast & instant startup (64x faster than Chrome)
21+
22+
See [benchmark details](https://github.com/lightpanda-io/demo).
23+
24+
## Why?
25+
26+
### Javascript execution is mandatory for the modern web
27+
28+
Back in the good old times, grabbing a webpage was as easy as making an HTTP request, cURL-like. It’s not possible anymore, because Javascript is everywhere, like it or not:
29+
30+
- Ajax, Single Page App, Infinite loading, “click to display”, instant search, etc.
31+
- JS web frameworks: React, Vue, Angular & others
32+
33+
### Chrome is not the right tool
34+
35+
So if we need Javascript, why not use a real web browser. Let’s take a huge desktop application, hack it, and run it on the server, right? Hundreds of instance of Chrome if you use it at scale. Are you sure it’s such a good idea?
36+
37+
- Heavy on RAM and CPU, expensive to run
38+
- Hard to package, deploy and maintain at scale
39+
- Bloated, lots of features are not useful in headless usage
40+
41+
### Lightpanda is built for performance
42+
43+
If we want both Javascript and performance, for a real headless browser, we need to start from scratch. Not yet another iteration of Chromium, really from a blank page. Crazy right? But that’s we did:
44+
45+
- Not based on Chromium, Blink or WebKit
46+
- Low-level system programming language (Zig) with optimisations in mind
47+
- Opinionated, no rendering
48+
49+
## Build from sources
50+
51+
We do not provide yet binary versions of Lightpanda, you have to compile it from source.
452

553
### Prerequisites
654

7-
Browsercore is written with [Zig](https://ziglang.org/) `0.12`. You have to
55+
Lightpanda is written with [Zig](https://ziglang.org/) `0.12`. You have to
856
install it with the right version in order to build the project.
957

10-
Browsercore also depends on
11-
[js-runtimelib](https://github.com/francisbouvier/zig-js-runtime/),
58+
Lightpanda also depends on
59+
[zig-js-runtime](https://github.com/lightpanda-io/zig-js-runtime/) (with v8),
1260
[Netsurf libs](https://www.netsurf-browser.org/) and
13-
[Mimalloc](https://microsoft.github.io/mimalloc) libs.
61+
[Mimalloc](https://microsoft.github.io/mimalloc).
1462

15-
To be able to build the v8 engine for js-runtimelib, you have to install some libs:
63+
To be able to build the v8 engine for zig-js-runtime, you have to install some libs:
1664

1765
For Debian/Ubuntu based Linux:
66+
1867
```
1968
sudo apt install xz-utils \
2069
python3 ca-certificates git \
@@ -23,100 +72,103 @@ sudo apt install xz-utils \
2372
cmake clang
2473
```
2574

26-
For MacOS, you only need Python 3 and cmake.
75+
For MacOS, you only need cmake:
76+
77+
```
78+
brew install cmake
79+
```
2780

2881
### Install and build dependencies
2982

30-
The project uses git submodule for dependencies.
31-
The `make install-submodule` will init and update the submodules in the `vendor/`
32-
directory.
83+
#### All in one build
84+
85+
You can run `make install` to install deps all in one (or `make install-dev` if you need the development versions).
86+
87+
Be aware that the build task is very long and cpu consuming, as you will build from sources all dependancies, including the v8 Javascript engine.
88+
89+
#### Step by step build dependancy
90+
91+
The project uses git submodules for dependencies.
92+
93+
To init or update the submodules in the `vendor/` directory:
3394

3495
```
3596
make install-submodule
3697
```
3798

38-
### Build Netsurf
99+
**Netsurf libs**
100+
101+
Netsurf libs are used for HTML parsing and DOM tree generation.
39102

40-
The command `make install-netsurf` will build Netsurf libs used by browsercore.
41103
```
42104
make install-netsurf
43105
```
44106

45107
For dev env, use `make install-netsurf-dev`.
46108

47-
### Build Mimalloc
109+
**Mimalloc**
110+
111+
Mimalloc is used as a C memory allocator.
48112

49-
The command `make install-mimalloc` will build Mimalloc lib used by browsercore.
50113
```
51114
make install-mimalloc
52115
```
53116

54117
For dev env, use `make install-mimalloc-dev`.
55118

56-
Note, when Mimalloc is built in dev mode, you can dump memory stats with the
119+
Note: when Mimalloc is built in dev mode, you can dump memory stats with the
57120
env var `MIMALLOC_SHOW_STATS=1`. See
58-
https://microsoft.github.io/mimalloc/environment.html
59-
60-
### Build zig-js-runtime
61-
62-
The command `make install-zig-js-runtime-dev` uses zig-js-runtime's `zig-v8` dependency to build v8 engine lib.
63-
Be aware the build task is very long and cpu consuming.
121+
[https://microsoft.github.io/mimalloc/environment.html](https://microsoft.github.io/mimalloc/environment.html).
64122

65-
Build v8 engine for debug/dev version, it creates
66-
`vendor/zig-js-runtime/vendor/v8/$ARCH/debug/libc_v8.a` file.
123+
**zig-js-runtime**
67124

68-
```
69-
make install-zig-js-runtime-dev
70-
```
125+
Our own Zig/Javascript runtime, which includes the v8 Javascript engine.
71126

72-
You should also build a release vesion of v8 with:
127+
This build task is very long and cpu consuming, as you will build v8 from sources.
73128

74129
```
75130
make install-zig-js-runtime
76131
```
77132

78-
### All in one build
79-
80-
You can run `make intall` and `make install-dev` to install deps all in one.
133+
For dev env, use `make iinstall-zig-js-runtime-dev`.
81134

82135
## Test
83136

84137
### Unit Tests
85138

86-
You can test browsercore by running `make test`.
139+
You can test Lightpanda by running `make test`.
87140

88141
### Web Platform Tests
89142

90-
Browsercore is tested against the standardized [Web Platform
143+
Lightpanda is tested against the standardized [Web Platform
91144
Tests](https://web-platform-tests.org/).
92145

93-
The relevant tests cases for Browsercore are commit with the project.
94-
All the tests cases executed are located in `tests/wpt` dir and come from an
95-
external repository: https://github.com/lightpanda-io/wpt
146+
The relevant tests cases are committed in a [dedicated repository](https://github.com/lightpanda-io/wpt) which is fetched by the `make install-submodule` command.
147+
148+
All the tests cases executed are located in the `tests/wpt` sub-directory.
96149

97150
For reference, you can easily execute a WPT test case with your browser via
98151
[wpt.live](https://wpt.live).
99152

100-
*Run WPT test suite*
153+
#### Run WPT test suite
154+
155+
To run all the tests:
101156

102-
You can run all the test.
103-
The runner execute all the tests ending with `.html`.
104157
```
105158
make wpt
106159
```
107160

108-
Or one specific test by using a suffix.
161+
Or one specific test:
162+
109163
```
110164
make wpt Node-childNodes.html
111165
```
112166

113-
*Add a new WPT test case*
167+
#### Add a new WPT test case
114168

115-
We add new tests cases files with implemented changes in Browsercore.
169+
We add new relevant tests cases files when we implemented changes in Lightpanda.
116170

117-
Copy the test case you want to add from the [WPT
118-
repo](https://github.com/web-platform-tests/wpt) into `tests/wpt` dir, commit
119-
the files in the https://github.com/lightpanda-io/wpt repository and update the
120-
git submodule in browsercore.
171+
To add a new test, copy the file you want from the [WPT
172+
repo](https://github.com/web-platform-tests/wpt) into the `tests/wpt` directory.
121173

122-
:warning: Please keep the original directory tree structure into `tests/wpt`.
174+
:warning: Please keep the original directory tree structure of `tests/wpt`.

0 commit comments

Comments
 (0)