Skip to content

Commit

Permalink
use deno.land for liveviewjs imports
Browse files Browse the repository at this point in the history
  • Loading branch information
floodfx committed Apr 3, 2022
1 parent a40f715 commit dec3fce
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
4 changes: 1 addition & 3 deletions packages/deno/app.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Application, nanoid, Router, send } from "./deps.ts";
import { LiveViewRouter, WsMessageRouter, SingleProcessPubSub } from "./liveviewjs.ts";
import { Application, nanoid, Router, send, LiveViewRouter, WsMessageRouter, SingleProcessPubSub } from "./deps.ts";

import { configLiveViewHandler } from "./liveViewAppAdaptor.ts";
import { rootTemplateRenderer } from "./liveViewRootTemplate.ts";
import { DenoJwtSerDe } from "./serDe.ts";
// import { SingleProcessPubSub } from "./pubSub.ts";
import { DenoWsAdaptor } from "./wsAdaptor.ts";

import { LightLiveViewComponent } from "./liveviewjs-examples/liveview-examples.mjs";
Expand Down
15 changes: 13 additions & 2 deletions packages/deno/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,16 @@ export {
send,
} from "https://deno.land/x/[email protected]/mod.ts";

// export { EventEmitter } from "https://deno.land/[email protected]/node/events.ts";
// export * as crypto from "https://deno.land/[email protected]/node/crypto.ts";
export {
WsMessageRouter, SingleProcessPubSub, handleHttpLiveView, html, live_title_tag
} from "https://deno.land/x/[email protected]/mod.ts"

export type {
LiveViewRouter,
LiveViewTemplate,
PageTitleDefaults,
HttpRequestAdaptor,
SerDe,
SessionData,
WsAdaptor
} from "https://deno.land/x/[email protected]/mod.ts";
2 changes: 1 addition & 1 deletion packages/deno/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"zod": "https://deno.land/x/[email protected]/mod.ts",
"crypto": "https://deno.land/[email protected]/node/crypto.ts",
"events": "https://deno.land/[email protected]/node/events.ts",
"liveviewjs": "./liveviewjs.ts"
"liveviewjs": "https://deno.land/x/liveviewjs@0.3.0-rc.1/mod.ts"
}
}
5 changes: 2 additions & 3 deletions packages/deno/liveViewAppAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import type {
HttpRequestAdaptor,
SerDe,
SessionData,
} from "./liveviewjs.ts";
import { handleHttpLiveView } from "./liveviewjs.ts";
} from "./deps.ts";
import { Context, nanoid, handleHttpLiveView } from "./deps.ts";
import { DenoJwtSerDe } from "./serDe.ts";
import { Context, nanoid } from "./deps.ts";

export const configLiveViewHandler = (
getRouter: () => LiveViewRouter,
Expand Down
4 changes: 2 additions & 2 deletions packages/deno/liveViewRootTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LiveViewTemplate, PageTitleDefaults } from "./liveviewjs.ts";
import { html, live_title_tag } from "./liveviewjs.ts";
import type { LiveViewTemplate, PageTitleDefaults } from "./deps.ts";
import { html, live_title_tag } from "./deps.ts";

export const rootTemplateRenderer = (
pageTitleDefault: PageTitleDefaults,
Expand Down
6 changes: 2 additions & 4 deletions packages/deno/liveViewRouterAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import type {
HttpRequestAdaptor,
SerDe,
SessionData,
} from "./liveviewjs.ts";
import { handleHttpLiveView } from "./liveviewjs.ts";
} from "./deps.ts";
import { nanoid, handleHttpLiveView, RouterContext } from "./deps.ts";
import { DenoJwtSerDe } from "./serDe.ts";
import { RouterContext, nanoid } from "./deps.ts";

interface ParamsDictionary {
[key: string]: string;
Expand All @@ -21,7 +20,6 @@ export const configLiveViewHandler = (
csrfToken: string,
content: LiveViewTemplate,
) => LiveViewTemplate,
signingSecret: string,
pageTitleDefaults?: PageTitleDefaults,
liveViewTemplateRenderer?: (
session: SessionData,
Expand Down
1 change: 0 additions & 1 deletion packages/deno/liveviewjs.ts

This file was deleted.

10 changes: 5 additions & 5 deletions packages/deno/pubSub.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Publisher,
Subscriber,
SubscriberFunction,
} from "./liveviewjs.ts";
// import {
// Publisher,
// Subscriber,
// SubscriberFunction,
// } from "./deps.ts";

// const broadcastChannel = new BroadcastChannel();

Expand Down
3 changes: 1 addition & 2 deletions packages/deno/serDe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { create, verify } from "./deps.ts";
import { SerDe } from "./liveviewjs.ts";
import { create, verify, SerDe } from "./deps.ts";
export * as crypto from "https://deno.land/[email protected]/node/crypto.ts";

// Attempt to reuse the crypto key otherwise restarting server will
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/wsAdaptor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WsAdaptor } from "./liveviewjs.ts";
import type { WsAdaptor } from "./deps.ts";

export class DenoWsAdaptor implements WsAdaptor {
private ws: WebSocket;
Expand Down

0 comments on commit dec3fce

Please sign in to comment.