@@ -1,4 +1,4 @@
|
||||
import { BuildOptions } from "https://deno.land/x/esbuild@v0.17.2/mod.js";
|
||||
import { BuildOptions } from "https://deno.land/x/esbuild@v0.14.51/mod.js";
|
||||
import { BUILD_ID } from "./constants.ts";
|
||||
import { denoPlugin, esbuild, toFileUrl } from "./deps.ts";
|
||||
import { Island, Plugin } from "./types.ts";
|
||||
@@ -12,7 +12,7 @@ let esbuildInitialized: boolean | Promise<void> = false;
|
||||
async function ensureEsbuildInitialized() {
|
||||
if (esbuildInitialized === false) {
|
||||
if (Deno.run === undefined) {
|
||||
const wasmURL = new URL("./esbuild_v0.17.2.wasm", import.meta.url).href;
|
||||
const wasmURL = new URL("./esbuild_v0.14.51.wasm", import.meta.url).href;
|
||||
esbuildInitialized = fetch(wasmURL).then(async (r) => {
|
||||
const resp = new Response(r.body, {
|
||||
headers: { "Content-Type": "application/wasm" },
|
||||
|
||||
@@ -374,10 +374,8 @@ export class ServerContext {
|
||||
*/
|
||||
#handlers(): [
|
||||
rutt.Routes<RouterState>,
|
||||
{
|
||||
otherHandler: rutt.Handler<RouterState>;
|
||||
errorHandler: rutt.ErrorHandler<RouterState>;
|
||||
},
|
||||
rutt.Handler<RouterState>,
|
||||
rutt.ErrorHandler<RouterState>,
|
||||
] {
|
||||
const routes: rutt.Routes<RouterState> = {};
|
||||
|
||||
@@ -524,7 +522,7 @@ export class ServerContext {
|
||||
}
|
||||
}
|
||||
|
||||
const otherHandler: rutt.Handler<RouterState> = (
|
||||
const unknownHandler: rutt.Handler<RouterState> = (
|
||||
req,
|
||||
ctx,
|
||||
) =>
|
||||
@@ -560,7 +558,7 @@ export class ServerContext {
|
||||
);
|
||||
};
|
||||
|
||||
return [routes, { otherHandler, errorHandler }];
|
||||
return [routes, unknownHandler, errorHandler];
|
||||
}
|
||||
|
||||
#staticFileHandler(
|
||||
|
||||
+11
-12
@@ -3,30 +3,29 @@ export {
|
||||
extname,
|
||||
fromFileUrl,
|
||||
toFileUrl,
|
||||
} from "https://deno.land/std@0.177.0/path/mod.ts";
|
||||
export { walk } from "https://deno.land/std@0.177.0/fs/walk.ts";
|
||||
export { serve } from "https://deno.land/std@0.177.0/http/server.ts";
|
||||
} from "https://deno.land/std@0.150.0/path/mod.ts";
|
||||
export { walk } from "https://deno.land/std@0.150.0/fs/walk.ts";
|
||||
export { serve } from "https://deno.land/std@0.150.0/http/server.ts";
|
||||
export type {
|
||||
ConnInfo,
|
||||
Handler as RequestHandler,
|
||||
ServeInit,
|
||||
} from "https://deno.land/std@0.177.0/http/server.ts";
|
||||
export { Status } from "https://deno.land/std@0.177.0/http/http_status.ts";
|
||||
} from "https://deno.land/std@0.150.0/http/server.ts";
|
||||
export { Status } from "https://deno.land/std@0.150.0/http/http_status.ts";
|
||||
export {
|
||||
typeByExtension,
|
||||
} from "https://deno.land/std@0.177.0/media_types/mod.ts";
|
||||
} from "https://deno.land/std@0.150.0/media_types/mod.ts";
|
||||
|
||||
// -- rutt --
|
||||
export * as rutt from "https://deno.land/x/rutt@0.1.0/mod.ts";
|
||||
export * as rutt from "https://deno.land/x/rutt@0.0.14/mod.ts";
|
||||
|
||||
// -- esbuild --
|
||||
// @deno-types="https://deno.land/x/esbuild@v0.17.2/mod.d.ts"
|
||||
import * as esbuildWasm from "https://deno.land/x/esbuild@v0.17.2/wasm.js";
|
||||
import * as esbuildNative from "https://deno.land/x/esbuild@v0.17.2/mod.js";
|
||||
// @deno-types="https://deno.land/x/esbuild@v0.14.51/mod.d.ts"
|
||||
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.51/mod.js";
|
||||
// @ts-ignore trust me
|
||||
const esbuild: typeof esbuildWasm = Deno.run === undefined
|
||||
? esbuildWasm
|
||||
: esbuildNative;
|
||||
export { esbuild, esbuildWasm as esbuildTypes };
|
||||
// TODO(lino-levan): replace with tagged version
|
||||
export { denoPlugin } from "https://raw.githubusercontent.com/lucacasonato/esbuild_deno_loader/b4b3ffb43e9380865ad12ab4d1c64c0ae0ca96cd/mod.ts";
|
||||
export { denoPlugin } from "https://deno.land/x/esbuild_deno_loader@0.5.2/mod.ts";
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -87,7 +87,7 @@ export type Handler<T = any, State = Record<string, unknown>> = (
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export type Handlers<T = any, State = Record<string, unknown>> = {
|
||||
[K in typeof rutt.knownMethods[number]]?: Handler<T, State>;
|
||||
[K in typeof rutt.METHODS[number]]?: Handler<T, State>;
|
||||
};
|
||||
|
||||
export interface RouteModule {
|
||||
|
||||
Reference in New Issue
Block a user