Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 6 additions & 40 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
# Development Setup

Node.js 22+ and depot_tools are required for development
Node.js 22+ and PNPM required for development

```bash
update_depot_tools
ensure_bootstrap
git clone https://github.com/HeyPuter/browser.js --recursive
cd browser.js
git submodule update --init
pnpm i
rustup update
rustup install nightly
rustup default nightly
cargo install --git https://github.com/r58playz/wasm-snip
cargo install wasm-bindgen-cli --version 0.2.100
pnpm rewriter:build
pnpm build
cd dreamlandjs
pnpm build
cd ..
cd chii
pnpm init:front_end
pnpm build
cd ..
cd playwright
npm i
npm run build
cd web_builder
npx rollup -c
cd ../..
cd chobitsu
pnpm build
cd ..
cd page_inject
npx rollup -c
cd ..
cd frontend
pnpm vite build
pnpm build:dreamland
pnpm build (x2)
pnpm dev
```

# Incremental Build

```bash
(cd playwright && npm run watch) &
(cd playwright/web_builder && npx rollup -cw) &
(pnpm dev) &
(cd dreamlandjs && pnpm watch) &
(cd chobitsu && pnpm webpack --watch --mode=development) &
(cd page_inject && npx rollup -cw) &
(cd frontend && pnpm dev) &
pnpm dev
```
1 change: 1 addition & 0 deletions devserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const PAD_TOP = 1;
const PAD_BOTTOM = 1;

function blackSpaces(count: number) {
count = Math.abs(count);
return black()(" ".repeat(count));
}

Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
"name": "browser.js",
"version": "1.0.0",
"description": "",
"type": "module",
"keywords": [],
"author": "",
"license": "AGPL-3.0-only",
"packageManager": "pnpm@10.12.1",
"scripts": {
"build": "rspack build",
"build:dreamland": "cd external/dreamlandjs && pnpm build",
"build:chrome": "cd packages/chrome && pnpm build",
"dev": "node --no-warnings=ExperimentalWarning devserver.ts",
"build": "rspack build",
"watch": "rspack build --watch",
"format": "prettier --write ."
},
"type": "module",
"keywords": [],
"author": "",
"license": "AGPL-3.0-only",
"packageManager": "pnpm@10.12.1",
"devDependencies": {
"@mercuryworkshop/wisp-js": "^0.3.3",
"@rsdoctor/rspack-plugin": "^1.2.3",
"@rslib/core": "^0.13.3",
"@rspack/cli": "^1.5.6",
"@rspack/core": "^1.5.6",
"@mercuryworkshop/wisp-js": "^0.4.0",
"@rsdoctor/rspack-plugin": "^1.3.6",
"@rslib/core": "^0.16.1",
"@rspack/cli": "^1.5.8",
"@rspack/core": "^1.5.8",
"bufferutil": "^4.0.9",
"chafa-wasm": "^0.3.1",
"chalk": "^5.6.2",
"server": "link:@mercuryworkshop/wisp-js/server",
"ts-checker-rspack-plugin": "^1.1.5",
"vite": "^7.1.11"
"ts-checker-rspack-plugin": "^1.1.6",
"vite": "^7.1.12"
},
"dependencies": {
"prettier": "^3.6.2"
Expand Down
7 changes: 4 additions & 3 deletions packages/chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"preview": "vite preview"
},
"devDependencies": {
"typescript": "~5.8.3",
"vite": "^6.3.5"
"typescript": "~5.9.3",
"vite": "^7.1.12"
},
"dependencies": {
"@iconify/types": "^2.0.0",
"@ktibow/iconset-ion": "^8.0.13",
"@heyputer/puter.js": "^2.1.2",
"@mercuryworkshop/bare-mux-custom": "workspace:*",
"@mercuryworkshop/epoxy-transport": "workspace:*",
"@mercuryworkshop/libcurl-transport": "workspace:*",
Expand All @@ -25,7 +26,7 @@
"html-to-image": "^1.11.13",
"html2canvas": "^1.4.1",
"htmlparser2": "^10.0.0",
"monaco-editor": "^0.52.2",
"monaco-editor": "^0.54.0",
"tldts": "^7.0.11",
"vite-plugin-singlefile": "^2.3.0",
"vite-plugin-static-copy": "^3.1.0"
Expand Down
9 changes: 2 additions & 7 deletions packages/chrome/src/Browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { createDelegate } from "dreamland/core";
import type { SerializedHistoryState } from "./History";
import { HistoryState } from "./History";
import { focusOmnibox } from "./components/Omnibar/Omnibox";
import { type AVAILABLE_SEARCH_ENGINES } from "./components/Omnibar/suggestions";

import * as tldts from "tldts";
import { isPuter } from "./main";
Expand Down Expand Up @@ -62,13 +63,7 @@ export type Settings = {
startupPage: "new-tab" | "continue";
defaultZoom: number;
showBookmarksBar: boolean;
defaultSearchEngine:
| "google"
| "bing"
| "duckduckgo"
| "yahoo"
| "ecosia"
| "startpage";
defaultSearchEngine: keyof typeof AVAILABLE_SEARCH_ENGINES;
searchSuggestionsEnabled: boolean;
blockTrackers: boolean;
clearHistoryOnExit: boolean;
Expand Down
7 changes: 4 additions & 3 deletions packages/chrome/src/components/BookmarksStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ export function BookmarksStrip(props: {}, cx: ComponentContext) {
<button
on:click={(e: MouseEvent) => {
let b = createState<BookmarkEntry>({
url: "",
title: "New Bookmark",
url: browser.activetab.url.toString(),
title: browser.activetab.title || "Unknown",
favicon: browser.activetab.icon,
});
createMenuCustom(
{
left: e.clientX,
top: e.clientY,
},
<BookmarkPopup bookmark={b} new={false} />
<BookmarkPopup bookmark={b} new={true} />
);
}}
>
Expand Down
44 changes: 41 additions & 3 deletions packages/chrome/src/components/Omnibar/suggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface SearchEngine {
}

/** Available search engines */
export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
export const AVAILABLE_SEARCH_ENGINES = {
google: {
name: "Google",
searchUrlBuilder: (query) =>
Expand All @@ -37,6 +37,45 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
return [];
},
},
bing: {
name: "Microsoft Bing",
searchUrlBuilder: (query) =>
`https://www.bing.com/search?q=${encodeURIComponent(query)}`,
suggestUrlBuilder: (query) =>
`https://www.bing.com/osjson.aspx?query=${encodeURIComponent(query)}`,
suggestionParser: (data) => {
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
return data[1].map((item: any) => String(item)).filter(Boolean);
}
return [];
},
},
yahoo: {
name: "Yahoo!",
searchUrlBuilder: (query) =>
`https://search.yahoo.com/search?q=${encodeURIComponent(query)}`,
suggestUrlBuilder: (query) =>
`https://search.yahoo.com/sugg/chrome?output=fxjson&appid=crmas_sfp&command=${encodeURIComponent(query)}`,
suggestionParser: (data) => {
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
return data[1].map((item: any) => String(item)).filter(Boolean);
}
return [];
},
},
duckduckgo: {
name: "DuckDuckGo",
searchUrlBuilder: (query) =>
`https://duckduckgo.com/?q=${encodeURIComponent(query)}`,
suggestUrlBuilder: (query) =>
`https://duckduckgo.com/ac/?q=${encodeURIComponent(query)}&type=list`,
suggestionParser: (data) => {
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
return data[1].map((item: any) => String(item)).filter(Boolean);
}
return [];
},
},
brave: {
name: "Brave",
searchUrlBuilder: (query) =>
Expand All @@ -46,7 +85,6 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
suggestionParser: (data) => {
// Google format
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
return data[1].map((item: any) => String(item)).filter(Boolean);
}
// Brave Format
Expand All @@ -60,7 +98,7 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
return [];
},
},
};
} as const satisfies Record<string, SearchEngine>;

function calculateRelevanceScore(result: OmniboxResult, query: string): number {
if (!query) return 0;
Expand Down
9 changes: 5 additions & 4 deletions packages/scramjet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"author": "Mercury Workshop",
"license": "AGPL-3.0-only",
"packageManager": "pnpm@10.12.1",
"scripts": {},
"devDependencies": {
"@rsdoctor/rspack-plugin": "^1.2.3",
"@rslib/core": "^0.13.2",
"@rspack/cli": "^1.5.3",
"@rspack/core": "^1.5.3"
"@rsdoctor/rspack-plugin": "^1.3.6",
"@rslib/core": "^0.16.1",
"@rspack/cli": "^1.5.8",
"@rspack/core": "^1.5.8"
},
"dependencies": {
"prettier": "^3.6.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/scramjet/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@mercuryworkshop/bare-as-module3": "^2.2.5",
"@mercuryworkshop/epoxy-transport": "^2.1.28",
"@mercuryworkshop/libcurl-transport": "^1.5.0",
"@mercuryworkshop/wisp-js": "^0.3.3",
"@mercuryworkshop/wisp-js": "^0.4.0",
"@nebula-services/bare-server-node": "^2.0.4",
"@playwright/test": "^1.55.0",
"@reside-ic/typedoc-plugin-copy-doc": "^1.1.2",
Expand All @@ -79,7 +79,7 @@
"@types/eslint": "^9.6.1",
"@types/estree": "^1.0.8",
"@types/node": "^24.3.1",
"@types/serviceworker": "^0.0.152",
"@types/serviceworker": "^0.0.160",
"@typescript-eslint/eslint-plugin": "^8.43.0",
"@typescript-eslint/parser": "^8.43.0",
"actionlint": "^2.0.6",
Expand All @@ -102,7 +102,7 @@
"typedoc": "^0.28.12",
"typedoc-material-theme": "^1.4.0",
"typedoc-plugin-frontmatter": "^1.3.0",
"typedoc-plugin-include-example": "^2.1.2",
"typedoc-plugin-include-example": "^3.0.2",
"typedoc-plugin-markdown": "^4.8.1",
"typedoc-plugin-mdn-links": "^5.0.9",
"typescript": "^5.9.2"
Expand All @@ -111,7 +111,7 @@
"dom-serializer": "^2.0.0",
"domhandler": "^5.0.3",
"domutils": "^3.2.2",
"htmlparser2": "10.0.0",
"htmlparser2": "^10.0.0",
"idb": "^8.0.3",
"parse-domain": "^8.2.2",
"set-cookie-parser": "^2.7.1"
Expand Down
16 changes: 8 additions & 8 deletions packages/scramjet/packages/epoxy-transport/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@mercuryworkshop/epoxy-transport",
"version": "2.0.0",
"description": "a bare transport that implements end-to-end encryption with libcurl.js and wisp",
"author": "ading2210",
"license": "AGPL-3.0-only",
"version": "2.1.28",
"description": "a bare transport that implements end-to-end encryption with epoxy-tls and wisp",
"type": "module",
"main": "index.ts",
"keywords": [],
"author": "r58playz",
"license": "AGPL-3.0-only",
"scripts": {
"build": "node esbuild.bundle.mjs; cp dist/index.cjs dist/index.js",
"prepack": "npm run build"
},
"dependencies": {
"@mercuryworkshop/bare-mux-custom": "workspace:*",
"@mercuryworkshop/epoxy-tls": "2.1.18-1",
"libcurl.js": "^0.7.1"
},
"main": "index.ts"
"@mercuryworkshop/epoxy-tls": "2.1.18-1"
}
}
9 changes: 5 additions & 4 deletions packages/scramjet/packages/libcurl-transport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "@mercuryworkshop/libcurl-transport",
"version": "2.0.0",
"description": "a bare transport that implements end-to-end encryption with libcurl.js and wisp",
"type": "module",
"main": "index.ts",
"keywords": [],
"author": "ading2210",
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
"build": "node esbuild.bundle.mjs; cp dist/index.cjs dist/index.js",
"prepack": "npm run build"
},
"dependencies": {
"@mercuryworkshop/bare-mux-custom": "workspace:*",
"libcurl.js": "^0.7.1"
},
"main": "index.ts"
"libcurl.js": "^0.7.2"
}
}
2 changes: 1 addition & 1 deletion packages/scramjet/packages/rewriter_demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@mercuryworkshop/scramjet": "workspace:*",
"dreamland": "^0.1.1",
"monaco-editor": "^0.52.2",
"monaco-editor": "^0.54.0",
"vite-plugin-static-copy": "^3.1.1"
}
}
Loading
Loading