chore: update for deno 1.33.x (#1139)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Marvin Hagemeister
2023-04-30 10:30:30 +02:00
committed by GitHub
co-authored by Luca Casonato
parent ab73242933
commit c224db7cb7
6 changed files with 14 additions and 7 deletions
+2 -1
View File
@@ -15,7 +15,8 @@ jobs:
strategy: strategy:
matrix: matrix:
deno: ["v1.x", "canary"] # FIXME: temporarially disabled 1.x until https://github.com/denoland/deno/commit/64e072e499d36ca824db297a493667415ed67cdf is released
deno: ["canary"]
os: [macOS-latest, windows-latest, ubuntu-latest] os: [macOS-latest, windows-latest, ubuntu-latest]
steps: steps:
+1 -3
View File
@@ -12,8 +12,6 @@
"jsxImportSource": "preact" "jsxImportSource": "preact"
}, },
"test": { "test": {
"files": { "exclude": ["www/"]
"exclude": ["www/"]
}
} }
} }
+1
View File
@@ -11,6 +11,7 @@ export interface JSXConfig {
let esbuildInitialized: boolean | Promise<void> = false; let esbuildInitialized: boolean | Promise<void> = false;
async function ensureEsbuildInitialized() { async function ensureEsbuildInitialized() {
if (esbuildInitialized === false) { if (esbuildInitialized === false) {
// deno-lint-ignore no-deprecated-deno-api
if (Deno.run === undefined) { if (Deno.run === undefined) {
const wasmURL = new URL("./esbuild_v0.17.11.wasm", import.meta.url).href; const wasmURL = new URL("./esbuild_v0.17.11.wasm", import.meta.url).href;
esbuildInitialized = fetch(wasmURL).then(async (r) => { esbuildInitialized = fetch(wasmURL).then(async (r) => {
+1
View File
@@ -21,6 +21,7 @@ export {
import * as esbuildWasm from "https://deno.land/x/esbuild@v0.17.11/wasm.js"; import * as esbuildWasm from "https://deno.land/x/esbuild@v0.17.11/wasm.js";
import * as esbuildNative from "https://deno.land/x/esbuild@v0.17.11/mod.js"; import * as esbuildNative from "https://deno.land/x/esbuild@v0.17.11/mod.js";
// @ts-ignore trust me // @ts-ignore trust me
// deno-lint-ignore no-deprecated-deno-api
const esbuild: typeof esbuildWasm = Deno.run === undefined const esbuild: typeof esbuildWasm = Deno.run === undefined
? esbuildWasm ? esbuildWasm
: esbuildNative; : esbuildNative;
+8 -3
View File
@@ -146,10 +146,15 @@ export function router<T = unknown>(
const res = route.pattern.exec(req.url); const res = route.pattern.exec(req.url);
if (res !== null) { if (res !== null) {
const groups = res?.pathname.groups ?? {}; const groups: Record<string, string> = {};
const matched = res?.pathname.groups;
for (const key in groups) { for (const key in matched) {
groups[key] = decodeURIComponent(groups[key]); const value = matched[key];
if (value !== undefined) {
groups[key] = decodeURIComponent(value);
}
} }
for (const [method, handler] of Object.entries(route.methods)) { for (const [method, handler] of Object.entries(route.methods)) {
+1
View File
@@ -1,4 +1,5 @@
// Simulate Deno Deploy environment // Simulate Deno Deploy environment
//@ts-ignore: Remove Deno.run for simulating deno deploy env //@ts-ignore: Remove Deno.run for simulating deno deploy env
// deno-lint-ignore no-deprecated-deno-api
delete Deno.run; delete Deno.run;