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,6 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
|
||||
export function RoundedButton(props: h.JSX.HTMLAttributes<HTMLButtonElement>) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { apply, h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { apply, tw } from "../utils/twind.ts";
|
||||
|
||||
import {
|
||||
CATEGORIES,
|
||||
TableOfContentsCategory,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
|
||||
const LINKS = [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
|
||||
export function IconMinus() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
|
||||
export default function NavigationBar(props: { active: string }) {
|
||||
const items = [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../deps.client.ts";
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
|
||||
export default function WarningBanner() {
|
||||
const warning = tw`bg-yellow-100 border(1 yellow-200) p-4 mb-4`;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"tasks": {
|
||||
"start": "deno run -A --watch main.ts & deno run -A ../cli.ts manifest --watch"
|
||||
},
|
||||
"importMap": "./import_map.json"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../",
|
||||
"$twind": "https://esm.sh/twind@0.16.16",
|
||||
"$twind/": "https://esm.sh/twind@0.16.16/"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h, IS_BROWSER, tw, useState } from "../deps.client.ts";
|
||||
import { h, IS_BROWSER, useState } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { RoundedButton } from "../components/Button.tsx";
|
||||
import { IconMinus, IconPlus } from "../components/Icons.tsx";
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/** @jsx h */
|
||||
import {
|
||||
Fragment,
|
||||
h,
|
||||
tw,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "../deps.client.ts";
|
||||
/** @jsxFrag Fragment */
|
||||
import { Fragment, h, useEffect, useRef, useState } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { Spring, WaveTank } from "../components/WaveTank.ts";
|
||||
|
||||
function easeInCirc(x: number) {
|
||||
@@ -99,7 +94,7 @@ function LemonDrop() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<>
|
||||
<svg
|
||||
width="100"
|
||||
height="300"
|
||||
@@ -143,7 +138,7 @@ function LemonDrop() {
|
||||
>
|
||||
</polygon>
|
||||
</svg>
|
||||
</Fragment>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
/// <reference lib="deno.unstable" />
|
||||
|
||||
import { start } from "./deps.server.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// This module adds twind support.
|
||||
|
||||
import { setup, theme } from "../deps.client.ts";
|
||||
import { RenderContext, RenderFn, virtualSheet } from "../deps.server.ts";
|
||||
import { RenderContext, RenderFn } from "$fresh/server.ts";
|
||||
import { setup, theme } from "../utils/twind.ts";
|
||||
import { virtualSheet } from "$twind/sheets";
|
||||
|
||||
const sheet = virtualSheet();
|
||||
sheet.reset();
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
/** @jsx h */
|
||||
/** @jsxFrag Fragment */
|
||||
|
||||
import {
|
||||
apply,
|
||||
asset,
|
||||
Fragment,
|
||||
h,
|
||||
Head,
|
||||
PageProps,
|
||||
tw,
|
||||
} from "../../deps.client.ts";
|
||||
import { frontMatter, gfm, Handlers } from "../../deps.server.ts";
|
||||
import { Fragment, h, Head, PageProps } from "$fresh/runtime.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { apply, tw } from "../../utils/twind.ts";
|
||||
import { frontMatter, gfm } from "../../utils/markdown.ts";
|
||||
|
||||
import DocsSidebar from "../../components/DocsSidebar.tsx";
|
||||
import Footer from "../../components/Footer.tsx";
|
||||
import NavigationBar from "../../components/NavigationBar.tsx";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { gfm, Handlers } from "../deps.server.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { gfm } from "../utils/markdown.ts";
|
||||
|
||||
// TODO(lucacasonato): hash the file and use the hash as the filename, and serve
|
||||
// with high-cacheability headers.
|
||||
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
h,
|
||||
Head,
|
||||
PageProps,
|
||||
tw,
|
||||
} from "../deps.client.ts";
|
||||
} from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
import LemonDrop from "../islands/LemonDrop.tsx";
|
||||
import Footer from "../components/Footer.tsx";
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
export * from "../server.ts";
|
||||
|
||||
export { virtualSheet } from "https://esm.sh/twind@0.16.16/sheets";
|
||||
|
||||
export * as gfm from "https://deno.land/x/gfm@0.1.19/mod.ts";
|
||||
import "https://esm.sh/prismjs@1.27.0/components/prism-jsx.js?no-check";
|
||||
import "https://esm.sh/prismjs@1.27.0/components/prism-typescript.js?no-check";
|
||||
@@ -1,7 +1,6 @@
|
||||
export * from "../runtime.ts";
|
||||
import { IS_BROWSER } from "../runtime.ts";
|
||||
import { apply, setup, tw } from "https://esm.sh/twind@0.16.16";
|
||||
import * as colors from "https://esm.sh/twind@0.16.16/colors";
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import { apply, setup, tw } from "$twind";
|
||||
import * as colors from "$twind/colors";
|
||||
export { apply, setup, tw };
|
||||
export const theme = {
|
||||
colors: {
|
||||
Reference in New Issue
Block a user