chore: update deps (#561)

Update std, esbuild, and preact.
This commit is contained in:
Luca Casonato
2022-07-30 17:29:29 +02:00
committed by GitHub
parent a6aac89663
commit ba20756c17
18 changed files with 75 additions and 71 deletions
+8 -8
View File
@@ -40,32 +40,32 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.cache/deno/deno_puppeteer path: ~/.cache/deno/deno_puppeteer
key: chrome-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} key: chrome-991974-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }}
restore-keys: chrome-${{ runner.os }}- restore-keys: chrome-991974-${{ runner.os }}-
- name: Cache Chrome (macOS) - name: Cache Chrome (macOS)
if: startsWith(matrix.os, 'mac') if: startsWith(matrix.os, 'mac')
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/Library/Caches/deno/deno_puppeteer path: ~/Library/Caches/deno/deno_puppeteer
key: chrome-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} key: chrome-991974-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }}
restore-keys: chrome-${{ runner.os }}- restore-keys: chrome-991974-${{ runner.os }}-
- name: Cache Chrome (Windows) - name: Cache Chrome (Windows)
if: startsWith(matrix.os, 'win') if: startsWith(matrix.os, 'win')
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: "C:\\Users\\RUNNER~1\\AppData\\Local\\deno\\deno_puppeteer" path: "C:\\Users\\RUNNER~1\\AppData\\Local\\deno\\deno_puppeteer"
key: chrome-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} key: chrome-991974-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }}
restore-keys: chrome-${{ runner.os }}- restore-keys: chrome-991974-${{ runner.os }}-
- name: Install Chromium (Unix) - name: Install Chromium (Unix)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'mac') if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'mac')
run: PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts run: PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
- name: Install Chromium (Windows) - name: Install Chromium (Windows)
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
run: set "PUPPETEER_PRODUCT=chrome" && deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts run: set "PUPPETEER_PRODUCT=chrome" && deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
- name: Run tests - name: Run tests
run: deno test -A run: deno test -A
+4 -4
View File
@@ -7,10 +7,10 @@
"twind": "https://esm.sh/twind@0.16.17", "twind": "https://esm.sh/twind@0.16.17",
"twind/": "https://esm.sh/twind@0.16.17/", "twind/": "https://esm.sh/twind@0.16.17/",
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?external=preact", "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
"$semver/": "https://deno.land/x/semver@v1.4.0/" "$std/": "https://deno.land/std@0.150.0/"
} }
} }
+2 -2
View File
@@ -10,7 +10,7 @@ do this you can just `deno task start`.
``` ```
$ deno task start $ deno task start
Watcher Process started. Watcher Process started.
Server listening on http://localhost:8000 Listening on http://localhost:8000
``` ```
If you want to start manually without Deno task, `deno run` the `main.ts` with If you want to start manually without Deno task, `deno run` the `main.ts` with
@@ -45,7 +45,7 @@ Combining all of this we get the following `deno run` command:
``` ```
$ deno run --allow-net --allow-read --allow-env --allow-run --watch=static/,routes/ main.ts $ deno run --allow-net --allow-read --allow-env --allow-run --watch=static/,routes/ main.ts
Watcher Process started. Watcher Process started.
Server listening on http://localhost:8000 Listening on http://localhost:8000
``` ```
If you now visit http://localhost:8000, you can see the running project. Try If you now visit http://localhost:8000, you can see the running project. Try
+3 -3
View File
@@ -1,8 +1,8 @@
{ {
"imports": { "imports": {
"$fresh/": "../../", "$fresh/": "../../",
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?external=preact" "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact"
} }
} }
+3 -3
View File
@@ -96,10 +96,10 @@ if (useTwind) {
const importMap = { const importMap = {
"imports": { "imports": {
"$fresh/": new URL("./", import.meta.url).href, "$fresh/": new URL("./", import.meta.url).href,
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "preact-render-to-string":
"https://esm.sh/preact-render-to-string@5.2.0?external=preact", "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
} as Record<string, string>, } as Record<string, string>,
}; };
if (useTwind) { if (useTwind) {
+4 -5
View File
@@ -6,8 +6,7 @@ export {
join, join,
resolve, resolve,
toFileUrl, toFileUrl,
} from "https://deno.land/std@0.128.0/path/mod.ts"; } from "https://deno.land/std@0.150.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.128.0/fs/walk.ts"; export { walk } from "https://deno.land/std@0.150.0/fs/walk.ts";
export { bold, red } from "https://deno.land/std@0.128.0/fmt/colors.ts"; export { parse } from "https://deno.land/std@0.150.0/flags/mod.ts";
export { parse } from "https://deno.land/std@0.128.0/flags/mod.ts"; export { gte } from "https://deno.land/std@0.150.0/semver/mod.ts";
export { gte } from "https://deno.land/x/semver@v1.4.0/mod.ts";
+1 -3
View File
@@ -1,7 +1,5 @@
import { bold, red } from "./deps.ts";
export function printError(message: string) { export function printError(message: string) {
console.error(red(`${bold("error")}: ${message}`)); console.error(`%cerror%c: ${message}`, "color: red; font-weight: bold", "");
} }
export function error(message: string): never { export function error(message: string): never {
+1 -1
View File
@@ -7,7 +7,7 @@ async function ensureEsbuildInitialized() {
if (esbuildInitialized === false) { if (esbuildInitialized === false) {
if (Deno.run === undefined) { if (Deno.run === undefined) {
esbuildInitialized = esbuild.initialize({ esbuildInitialized = esbuild.initialize({
wasmURL: "https://unpkg.com/esbuild-wasm@0.14.39/esbuild.wasm", wasmURL: "https://unpkg.com/esbuild-wasm@0.14.51/esbuild.wasm",
worker: false, worker: false,
}); });
} else { } else {
+3 -3
View File
@@ -2,10 +2,10 @@ import {
ConnInfo, ConnInfo,
extname, extname,
fromFileUrl, fromFileUrl,
mediaTypeLookup,
RequestHandler, RequestHandler,
router, router,
toFileUrl, toFileUrl,
typeByExtension,
walk, walk,
} from "./deps.ts"; } from "./deps.ts";
import { h } from "preact"; import { h } from "preact";
@@ -224,7 +224,7 @@ export class ServerContext {
const localUrl = toFileUrl(entry.path); const localUrl = toFileUrl(entry.path);
const path = localUrl.href.substring(staticFolder.href.length); const path = localUrl.href.substring(staticFolder.href.length);
const stat = await Deno.stat(localUrl); const stat = await Deno.stat(localUrl);
const contentType = mediaTypeLookup(extname(path)) ?? const contentType = typeByExtension(extname(path)) ??
"application/octet-stream"; "application/octet-stream";
const etag = await crypto.subtle.digest( const etag = await crypto.subtle.digest(
"SHA-1", "SHA-1",
@@ -559,7 +559,7 @@ export class ServerContext {
"Cache-Control": "public, max-age=604800, immutable", "Cache-Control": "public, max-age=604800, immutable",
}); });
const contentType = mediaTypeLookup(path); const contentType = typeByExtension(extname(path));
if (contentType) { if (contentType) {
headers.set("Content-Type", contentType); headers.set("Content-Type", contentType);
} }
+11 -11
View File
@@ -3,28 +3,28 @@ export {
extname, extname,
fromFileUrl, fromFileUrl,
toFileUrl, toFileUrl,
} from "https://deno.land/std@0.128.0/path/mod.ts"; } from "https://deno.land/std@0.150.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.128.0/fs/walk.ts"; export { walk } from "https://deno.land/std@0.150.0/fs/walk.ts";
export { serve } from "https://deno.land/std@0.128.0/http/server.ts"; export { serve } from "https://deno.land/std@0.150.0/http/server.ts";
export type { export type {
ConnInfo, ConnInfo,
Handler as RequestHandler, Handler as RequestHandler,
ServeInit, ServeInit,
} from "https://deno.land/std@0.128.0/http/server.ts"; } from "https://deno.land/std@0.150.0/http/server.ts";
export {
typeByExtension,
} from "https://deno.land/std@0.150.0/media_types/mod.ts";
// -- router -- // -- router --
export * as router from "https://crux.land/router@0.0.11"; export * as router from "https://crux.land/router@0.0.11";
// -- media types --
export { lookup as mediaTypeLookup } from "https://deno.land/x/media_types@v2.10.2/mod.ts";
// -- esbuild -- // -- esbuild --
// @deno-types="https://deno.land/x/esbuild@v0.14.39/mod.d.ts" // @deno-types="https://deno.land/x/esbuild@v0.14.51/mod.d.ts"
import * as esbuildWasm from "https://unpkg.com/esbuild-wasm@0.14.39/esm/browser.js"; import * as esbuildWasm from "https://deno.land/x/esbuild@v0.14.51/wasm.js";
import * as esbuildNative from "https://deno.land/x/esbuild@v0.14.39/mod.js"; import * as esbuildNative from "https://deno.land/x/esbuild@v0.14.51/mod.js";
// @ts-ignore trust me // @ts-ignore trust me
const esbuild: typeof esbuildWasm = Deno.run === undefined const esbuild: typeof esbuildWasm = Deno.run === undefined
? esbuildWasm ? esbuildWasm
: esbuildNative; : esbuildNative;
export { esbuild, esbuildWasm as esbuildTypes }; export { esbuild, esbuildWasm as esbuildTypes };
export { denoPlugin } from "https://deno.land/x/esbuild_deno_loader@0.5.0/mod.ts"; export { denoPlugin } from "https://deno.land/x/esbuild_deno_loader@0.5.2/mod.ts";
-5
View File
@@ -50,10 +50,5 @@ export async function start(
opts: StartOptions = {}, opts: StartOptions = {},
) { ) {
const ctx = await ServerContext.fromManifest(routes, opts); const ctx = await ServerContext.fromManifest(routes, opts);
console.log(
`Server listening on http://${opts?.hostname ?? "localhost"}:${
opts?.port ?? 8000
}`,
);
await serve(ctx.handler(), opts); await serve(ctx.handler(), opts);
} }
+17 -5
View File
@@ -47,9 +47,8 @@ Deno.test({
"-A", "-A",
"init.ts", "init.ts",
tmpDirName, tmpDirName,
"--no-twind",
"--no-vscode",
], ],
stdin: "null",
stdout: "null", stdout: "null",
}); });
const { code } = await cliProcess.status(); const { code } = await cliProcess.status();
@@ -107,6 +106,7 @@ Deno.test({
await t.step("start up the server and access the root page", async () => { await t.step("start up the server and access the root page", async () => {
const serverProcess = Deno.run({ const serverProcess = Deno.run({
cmd: ["deno", "run", "-A", "--check", "main.ts"], cmd: ["deno", "run", "-A", "--check", "main.ts"],
stdin: "null",
stdout: "piped", stdout: "piped",
stderr: "inherit", stderr: "inherit",
cwd: tmpDirName, cwd: tmpDirName,
@@ -119,7 +119,7 @@ Deno.test({
let started = false; let started = false;
for await (const line of lines) { for await (const line of lines) {
console.log(line); console.log(line);
if (line.includes("Server listening on http://")) { if (line.includes("Listening on http://")) {
started = true; started = true;
break; break;
} }
@@ -136,7 +136,9 @@ Deno.test({
assertEquals(res.status, 200); assertEquals(res.status, 200);
// verify the island is revived. // verify the island is revived.
const browser = await puppeteer.launch({ args: ["--no-sandbox"] }); const browser = await puppeteer.launch({
args: ["--no-sandbox"],
});
const page = await browser.newPage(); const page = await browser.newPage();
await page.goto("http://localhost:8000", { waitUntil: "networkidle2" }); await page.goto("http://localhost:8000", { waitUntil: "networkidle2" });
const counter = await page.$("body > div > div > p"); const counter = await page.$("body > div > div > p");
@@ -146,7 +148,10 @@ Deno.test({
const buttonPlus = await page.$("body > div > div > button:nth-child(3)"); const buttonPlus = await page.$("body > div > div > button:nth-child(3)");
await buttonPlus?.click(); await buttonPlus?.click();
await delay(100);
counterValue = await counter?.evaluate((el) => el.textContent); counterValue = await counter?.evaluate((el) => el.textContent);
console.log(counterValue);
assert(counterValue === "4"); assert(counterValue === "4");
await page.close(); await page.close();
await browser.close(); await browser.close();
@@ -177,6 +182,7 @@ Deno.test({
"--twind", "--twind",
"--vscode", "--vscode",
], ],
stdin: "null",
stdout: "null", stdout: "null",
}); });
const { code } = await cliProcess.status(); const { code } = await cliProcess.status();
@@ -249,6 +255,7 @@ Deno.test({
await t.step("start up the server and access the root page", async () => { await t.step("start up the server and access the root page", async () => {
const serverProcess = Deno.run({ const serverProcess = Deno.run({
cmd: ["deno", "run", "-A", "--check", "main.ts"], cmd: ["deno", "run", "-A", "--check", "main.ts"],
stdin: "null",
stdout: "piped", stdout: "piped",
stderr: "inherit", stderr: "inherit",
cwd: tmpDirName, cwd: tmpDirName,
@@ -261,7 +268,7 @@ Deno.test({
let started = false; let started = false;
for await (const line of lines) { for await (const line of lines) {
console.log(line); console.log(line);
if (line.includes("Server listening on http://")) { if (line.includes("Listening on http://")) {
started = true; started = true;
break; break;
} }
@@ -294,6 +301,8 @@ Deno.test({
const buttonPlus = await page.$("body > div > div > button:nth-child(3)"); const buttonPlus = await page.$("body > div > div > button:nth-child(3)");
await buttonPlus?.click(); await buttonPlus?.click();
await delay(100);
counterValue = await counter?.evaluate((el) => el.textContent); counterValue = await counter?.evaluate((el) => el.textContent);
assert(counterValue === "4"); assert(counterValue === "4");
await page.close(); await page.close();
@@ -316,6 +325,7 @@ Deno.test("fresh-init error(help)", async function (t) {
async () => { async () => {
const cliProcess = Deno.run({ const cliProcess = Deno.run({
cmd: ["deno", "run", "-A", "init.ts"], cmd: ["deno", "run", "-A", "init.ts"],
stdin: "null",
stderr: "piped", stderr: "piped",
}); });
const { code } = await cliProcess.status(); const { code } = await cliProcess.status();
@@ -334,6 +344,7 @@ Deno.test("fresh-init error(help)", async function (t) {
async () => { async () => {
const cliProcess = Deno.run({ const cliProcess = Deno.run({
cmd: ["deno", "run", "-A", "init.ts", "-f"], cmd: ["deno", "run", "-A", "init.ts", "-f"],
stdin: "null",
stderr: "piped", stderr: "piped",
}); });
const { code } = await cliProcess.status(); const { code } = await cliProcess.status();
@@ -352,6 +363,7 @@ Deno.test("fresh-init error(help)", async function (t) {
async () => { async () => {
const cliProcess = Deno.run({ const cliProcess = Deno.run({
cmd: ["deno", "run", "-A", "init.ts", "--foo"], cmd: ["deno", "run", "-A", "init.ts", "--foo"],
stdin: "null",
stderr: "piped", stderr: "piped",
}); });
const { code } = await cliProcess.status(); const { code } = await cliProcess.status();
+4 -4
View File
@@ -8,9 +8,9 @@ export {
assert, assert,
assertEquals, assertEquals,
assertStringIncludes, assertStringIncludes,
} from "https://deno.land/std@0.129.0/testing/asserts.ts"; } from "https://deno.land/std@0.150.0/testing/asserts.ts";
export { export {
TextLineStream, TextLineStream,
} from "https://deno.land/std@0.129.0/streams/delimiter.ts"; } from "https://deno.land/std@0.150.0/streams/delimiter.ts";
export { delay } from "https://deno.land/std@0.129.0/async/delay.ts"; export { delay } from "https://deno.land/std@0.150.0/async/delay.ts";
export { default as puppeteer } from "https://deno.land/x/puppeteer@9.0.2/mod.ts"; export { default as puppeteer } from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
+3 -3
View File
@@ -1,8 +1,8 @@
{ {
"imports": { "imports": {
"$fresh/": "../../", "$fresh/": "../../",
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?external=preact" "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact"
} }
} }
+3 -3
View File
@@ -1,8 +1,8 @@
{ {
"imports": { "imports": {
"$fresh/": "../../", "$fresh/": "../../",
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?external=preact" "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact"
} }
} }
+2 -2
View File
@@ -23,8 +23,7 @@ Deno.test({
let started = false; let started = false;
for await (const line of lines) { for await (const line of lines) {
console.log(line); if (line.includes("Listening on http://")) {
if (line.includes("Server listening on http://")) {
started = true; started = true;
break; break;
} }
@@ -45,6 +44,7 @@ Deno.test({
const buttonPlus = await page.$(`#b-${counterId}`); const buttonPlus = await page.$(`#b-${counterId}`);
await buttonPlus?.click(); await buttonPlus?.click();
await delay(100);
value = await pElem?.evaluate((el) => el.textContent); value = await pElem?.evaluate((el) => el.textContent);
assert(value === `${originalValue + 1}`, `${counterId} click`); assert(value === `${originalValue + 1}`, `${counterId} click`);
} }
+4 -4
View File
@@ -6,10 +6,10 @@
"twind": "https://esm.sh/twind@0.16.17", "twind": "https://esm.sh/twind@0.16.17",
"twind/": "https://esm.sh/twind@0.16.17/", "twind/": "https://esm.sh/twind@0.16.17/",
"preact": "https://esm.sh/preact@10.8.2", "preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.8.2/", "preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?external=preact", "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
"$semver/": "https://deno.land/x/semver@v1.4.0/" "$std/": "https://deno.land/std@0.150.0/"
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
import { RouteConfig } from "$fresh/server.ts"; import { RouteConfig } from "$fresh/server.ts";
import { Handlers } from "$fresh/server.ts"; import { Handlers } from "$fresh/server.ts";
import { parse } from "$semver/mod.ts"; import { parse } from "$std/semver/mod.ts";
import VERSIONS from "../../versions.json" assert { type: "json" }; import VERSIONS from "../../versions.json" assert { type: "json" };
const BASE_URL = "https://raw.githubusercontent.com/denoland/fresh/"; const BASE_URL = "https://raw.githubusercontent.com/denoland/fresh/";
@@ -11,7 +11,7 @@ export const handler: Handlers = {
const isHTML = accept?.includes("text/html"); const isHTML = accept?.includes("text/html");
const { version, path } = ctx.params; const { version, path } = ctx.params;
const semver = parse(version, { includePrerelease: true, loose: false }); const semver = parse(version, { includePrerelease: true });
if (!semver) { if (!semver) {
return new Response("Invalid version", { status: 400 }); return new Response("Invalid version", { status: 400 });
} }