feat: use import maps instead of deps files (#209)
This commit updates fresh to use import maps instead of deps files in generated projects.
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.asynciterable" />
|
||||
/// <reference lib="deno.ns" />
|
||||
/// <reference lib="deno.unstable" />
|
||||
|
||||
export * from "../../runtime.ts";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "../../server.ts";
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Test(props: { message: string }) {
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { start } from "./deps.server.ts";
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.asynciterable" />
|
||||
/// <reference lib="deno.ns" />
|
||||
/// <reference lib="deno.unstable" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
|
||||
interface Props {
|
||||
params: Record<string, string | string[]>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, UnknownPageProps } from "../deps.client.ts";
|
||||
import { h, UnknownPageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function NotFoundPage({ url }: UnknownPageProps) {
|
||||
return <p>404 not found: {url.pathname}</p>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { ErrorPageProps, h } from "../deps.client.ts";
|
||||
import { ErrorPageProps, h } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Error500Page({ error }: ErrorPageProps) {
|
||||
return <p>500 internal error: {(error as Error).message}</p>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @jsx h */
|
||||
/** @jsxFrag Fragment */
|
||||
|
||||
import { AppProps, Fragment, h, Head } from "../deps.client.ts";
|
||||
import { AppProps, Fragment, h, Head } from "$fresh/runtime.ts";
|
||||
|
||||
export default function App(props: AppProps) {
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MiddlewareHandlerContext } from "../deps.server.ts";
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(_req: Request, ctx: MiddlewareHandlerContext) {
|
||||
ctx.state.root = "root_mw";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { asset, h } from "../../deps.client.ts";
|
||||
import { asset, h } from "$fresh/runtime.ts";
|
||||
import Test from "../../islands/Test.tsx";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps, RouteConfig } from "../../deps.client.ts";
|
||||
import { h, PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Page(props: PageProps) {
|
||||
return <div>Book {props.params.id}</div>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, IS_BROWSER } from "../deps.client.ts";
|
||||
import { h, IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import Test from "../islands/Test.tsx";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
|
||||
export default function Page() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps } from "../deps.client.ts";
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { HandlerContext, Handlers } from "../../../server.ts";
|
||||
|
||||
interface Data extends Record<string, unknown> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MiddlewareHandlerContext } from "../../deps.server.ts";
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(_req: Request, ctx: MiddlewareHandlerContext) {
|
||||
ctx.state.layer1 = "layer1_mw";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MiddlewareHandlerContext } from "../../../deps.server.ts";
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
interface State {
|
||||
root: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MiddlewareHandlerContext } from "../../../../deps.server.ts";
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(_req: Request, ctx: MiddlewareHandlerContext) {
|
||||
ctx.state.layer3 = "layer3_mw";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, RouteConfig } from "../deps.client.ts";
|
||||
import { h, RouteConfig } from "$fresh/runtime.ts";
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
|
||||
export const handler = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps } from "../../deps.client.ts";
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Home(props: PageProps) {
|
||||
return <div>{JSON.stringify(props)}</div>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { asset, h } from "../deps.client.ts";
|
||||
import { asset, h } from "$fresh/runtime.ts";
|
||||
|
||||
export default function StaticPage() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps, RouteConfig } from "../deps.client.ts";
|
||||
import { h, PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
|
||||
export default function WildcardPage({ params }: PageProps) {
|
||||
if (typeof params.path === "string") {
|
||||
|
||||
Reference in New Issue
Block a user