-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f33fd3
commit a0d7dd2
Showing
34 changed files
with
129 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Lino Le Van | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { existsSync } from "https://deno.land/[email protected]/fs/exists.ts"; | ||
import { existsSync } from "@std/fs/exists"; | ||
import { getBinary } from "../../../src/cache.ts"; | ||
|
||
export interface JSDocable { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,23 @@ | |
"jsx": "react-jsx", | ||
"jsxImportSource": "https://esm.sh/[email protected]" | ||
}, | ||
"lock": false | ||
"lock": false, | ||
"imports": { | ||
"@deno-library/progress": "jsr:@deno-library/[email protected]", | ||
"@std/assert": "jsr:@std/[email protected]", | ||
"@std/async": "jsr:@std/[email protected]", | ||
"@std/fs": "jsr:@std/[email protected]", | ||
"@std/path": "jsr:@std/[email protected]", | ||
"@std/testing": "jsr:@std/testing@^0.223.0", | ||
"@zip-js/zip-js": "jsr:@zip-js/[email protected]" | ||
}, | ||
"publish": { | ||
"include": [ | ||
"LICENSE", | ||
"README.md", | ||
"mod.ts", | ||
"src/**/*.ts", | ||
"bindings/celestial.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { ensureDirSync } from "https://deno.land/[email protected]/fs/ensure_dir.ts"; | ||
import { launch } from "../../mod.ts"; | ||
import { type PageProps } from "https://deno.land/x/[email protected]/page.ts"; | ||
import { ensureFileSync } from "https://deno.land/[email protected]/fs/ensure_file.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { retry } from "https://deno.land/[email protected]/async/retry.ts"; | ||
import { deadline } from "https://deno.land/[email protected]/async/deadline.ts"; | ||
import { retry } from "@std/async/retry"; | ||
import { deadline } from "@std/async/deadline"; | ||
|
||
import { Celestial, PROTOCOL_VERSION } from "../bindings/celestial.ts"; | ||
import { getBinary } from "./cache.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { ensureDirSync } from "https://deno.land/[email protected]/fs/ensure_dir.ts"; | ||
import { resolve } from "https://deno.land/[email protected]/path/mod.ts"; | ||
import { ensureDir } from "https://deno.land/[email protected]/fs/ensure_dir.ts"; | ||
import { dirname } from "https://deno.land/[email protected]/path/dirname.ts"; | ||
import { join } from "https://deno.land/[email protected]/path/join.ts"; | ||
import { ZipReader } from "https://deno.land/x/[email protected]/index.js"; | ||
import ProgressBar from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { exists, existsSync } from "https://deno.land/[email protected]/fs/exists.ts"; | ||
import { retry } from "https://deno.land/[email protected]/async/retry.ts"; | ||
import cacheDir from "https://deno.land/x/[email protected]/cache_dir/mod.ts"; | ||
import { ensureDir, ensureDirSync } from "@std/fs/ensure-dir"; | ||
import { exists, existsSync } from "@std/fs/exists"; | ||
import { resolve } from "@std/path/resolve"; | ||
import { dirname } from "@std/path/dirname"; | ||
import { retry } from "@std/async/retry"; | ||
import { join } from "@std/path/join"; | ||
import { ZipReader } from "@zip-js/zip-js"; | ||
import ProgressBar from "@deno-library/progress"; | ||
|
||
export const SUPPORTED_VERSIONS = { | ||
chrome: "121.0.6130.0", | ||
|
@@ -39,6 +37,42 @@ async function knownGoodVersions(): Promise<KnownGoodVersions> { | |
return await req.json(); | ||
} | ||
|
||
/** Stolen from https://github.com/justjavac/deno_dirs/blob/main/cache_dir/mod.ts | ||
* | ||
* Returns the path to the user's cache directory. | ||
* | ||
* The returned value depends on the operating system and is either a string, | ||
* containing a value from the following table, or `null`. | ||
* | ||
* |Platform | Value | Example | | ||
* | ------- | ----------------------------------- | -------------------------------- | | ||
* | Linux | `$XDG_CACHE_HOME` or `$HOME`/.cache | /home/justjavac/.cache | | ||
* | macOS | `$HOME`/Library/Caches | /Users/justjavac/Library/Caches | | ||
* | Windows | `$LOCALAPPDATA` | C:\Users\justjavac\AppData\Local | | ||
*/ | ||
function cacheDir(): string | null { | ||
switch (Deno.build.os) { | ||
case "linux": { | ||
const xdg = Deno.env.get("XDG_CACHE_HOME"); | ||
if (xdg) return xdg; | ||
|
||
const home = Deno.env.get("HOME"); | ||
if (home) return `${home}/.cache`; | ||
break; | ||
} | ||
|
||
case "darwin": { | ||
const home = Deno.env.get("HOME"); | ||
if (home) return `${home}/Library/Caches`; | ||
break; | ||
} | ||
|
||
case "windows": | ||
return Deno.env.get("LOCALAPPDATA") ?? null; | ||
} | ||
|
||
return null; | ||
} | ||
export function getDefaultCachePath(): string { | ||
const path = cacheDir(); | ||
if (!path) throw new Error("couldn't determine default cache directory"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { deadline } from "https://deno.land/[email protected]/async/deadline.ts"; | ||
import { deadline } from "@std/async/deadline"; | ||
|
||
import { Celestial, type Runtime_CallArgument } from "../bindings/celestial.ts"; | ||
import { KeyboardTypeOptions } from "./keyboard.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { resolve } from "https://deno.land/[email protected]/path/resolve.ts"; | ||
import { resolve } from "@std/path/resolve"; | ||
|
||
import type { | ||
Celestial, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { deadline } from "https://deno.land/[email protected]/async/deadline.ts"; | ||
import { deadline } from "@std/async/deadline"; | ||
import { fromFileUrl } from "@std/path/from-file-url"; | ||
|
||
import { Celestial } from "../bindings/celestial.ts"; | ||
import type { | ||
|
@@ -14,7 +15,6 @@ import { Keyboard } from "./keyboard.ts"; | |
import { Touchscreen } from "./touchscreen.ts"; | ||
import { Dialog } from "./dialog.ts"; | ||
import { FileChooser } from "./file_chooser.ts"; | ||
import { fromFileUrl } from "https://deno.land/[email protected]/path/from_file_url.ts"; | ||
|
||
export type DeleteCookieOptions = Omit< | ||
Parameters<Celestial["Network"]["deleteCookies"]>[0], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { deadline } from "https://deno.land/[email protected]/async/deadline.ts"; | ||
import { retry } from "https://deno.land/[email protected]/async/retry.ts"; | ||
import { deadline } from "@std/async/deadline"; | ||
import { retry } from "@std/async/retry"; | ||
|
||
export const WEBSOCKET_ENDPOINT_REGEX = /ws:\/\/(.*:.*?)\//; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { cleanCache, getBinary } from "../../mod.ts"; | ||
import { assert } from "https://deno.land/[email protected]/assert/assert.ts"; | ||
import { assert } from "@std/assert/assert"; | ||
|
||
Deno.bench({ | ||
name: "Download progress", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertEquals } from "@std/assert/assert-equals"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/// <reference lib="dom" /> | ||
|
||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertRejects } from "https://deno.land/[email protected]/assert/assert_rejects.ts"; | ||
import { assertEquals } from "@std/assert/assert-equals"; | ||
import { assertRejects } from "@std/assert/assert-rejects"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/// <reference lib="dom" /> | ||
|
||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertSnapshot } from "https://deno.land/[email protected]/testing/snapshot.ts"; | ||
import { assertEquals } from "@std/assert/assert-equals"; | ||
import { assertSnapshot } from "@std/testing/snapshot"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertEquals } from "@std/assert/assert-equals"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { launch } from "../mod.ts"; | ||
import { assertThrows } from "https://deno.land/[email protected]/assert/assert_throws.ts"; | ||
import { assert } from "https://deno.land/[email protected]/assert/assert.ts"; | ||
import { assertThrows } from "@std/assert/assert-throws"; | ||
import { assert } from "@std/assert/assert"; | ||
|
||
Deno.test("Test existing ws endpoint", async () => { | ||
// Spawn one browser instance and spawn another one connecting to the first one | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertSnapshot } from "https://deno.land/[email protected]/testing/snapshot.ts"; | ||
import { assertSnapshot } from "@std/testing/snapshot"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/// <reference lib="dom" /> | ||
|
||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertExists } from "https://deno.land/[email protected]/assert/assert_exists.ts"; | ||
import { assertEquals } from "@std/assert/assert-equals"; | ||
import { assertExists } from "@std/assert/assert-exists"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { assertMatch } from "https://deno.land/[email protected]/assert/assert_match.ts"; | ||
import { assertStringIncludes } from "@std/assert/assert-string-includes"; | ||
import { assertRejects } from "@std/assert/assert-rejects"; | ||
import { assertMatch } from "@std/assert/assert-match"; | ||
import { assert } from "@std/assert/assert"; | ||
import { resolve } from "@std/path/resolve"; | ||
import { cleanCache, getBinary, launch } from "../mod.ts"; | ||
import { assert } from "https://deno.land/[email protected]/assert/assert.ts"; | ||
import { assertRejects } from "https://deno.land/[email protected]/assert/assert_rejects.ts"; | ||
import { resolve } from "https://deno.land/[email protected]/path/resolve.ts"; | ||
import { assertStringIncludes } from "https://deno.land/[email protected]/assert/assert_string_includes.ts"; | ||
|
||
const tempDir = Deno.env.get("TMPDIR") || Deno.env.get("TMP") || | ||
Deno.env.get("TEMP") || "/tmp"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { deadline } from "@std/async/deadline"; | ||
import { cleanCache, getBinary, launch } from "../mod.ts"; | ||
import { deadline } from "https://deno.land/[email protected]/async/deadline.ts"; | ||
|
||
// Tests should be performed in directory different from others tests as cache is cleaned during this one | ||
//Deno.env.set("ASTRAL_QUIET_INSTALL", "true"); | ||
const cache = await Deno.makeTempDir({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertExists } from "https://deno.land/[email protected]/assert/assert_exists.ts"; | ||
import { assertExists } from "@std/assert/assert-exists"; | ||
import { launch } from "../mod.ts"; | ||
|
||
Deno.test("Set content", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { getDefaultCachePath, launch } from "../mod.ts"; | ||
import { assertStrictEquals } from "https://deno.land/[email protected]/assert/assert_strict_equals.ts"; | ||
import { assert } from "https://deno.land/[email protected]/assert/assert.ts"; | ||
import { fromFileUrl } from "https://deno.land/[email protected]/path/from_file_url.ts"; | ||
import { assertStrictEquals } from "@std/assert/assert-strict-equals"; | ||
import { fromFileUrl } from "@std/path/from-file-url"; | ||
import { assert } from "@std/assert/assert"; | ||
|
||
const cache = getDefaultCachePath(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertStrictEquals } from "https://deno.land/[email protected]/assert/assert_strict_equals.ts"; | ||
import { assertStrictEquals } from "@std/assert/assert-strict-equals"; | ||
import { launch } from "../mod.ts"; | ||
|
||
Deno.test("Set content", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/// <reference lib="dom" /> | ||
|
||
import { assert } from "https://deno.land/[email protected]/assert/assert.ts"; | ||
import { assert } from "@std/assert/assert"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { assertSnapshot } from "https://deno.land/[email protected]/testing/snapshot.ts"; | ||
import { assertRejects } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertSnapshot } from "@std/testing/snapshot"; | ||
import { assertRejects } from "@std/assert/assert-rejects"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
|