chore: rename *_deps.ts -> deps.*.ts (#206)

As per David's suggestion.
This commit is contained in:
Luca Casonato
2022-05-23 16:05:33 +02:00
committed by GitHub
parent f9f0125282
commit fd6724c050
57 changed files with 70 additions and 70 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ used to pass arbituary data to downstream (or upstream) handlers.
```ts
// routes/_middleware.ts
import { MiddlewareHandlerContext } from "../server_deps.ts";
import { MiddlewareHandlerContext } from "../deps.server.ts";
interface State {
data: string;
+4 -4
View File
@@ -22,7 +22,7 @@ Let's look at a basic route that returns a plain text string:
```tsx
// routes/plain.tsx
import { HandlerContext, Handlers } from "../server_deps.ts";
import { HandlerContext, Handlers } from "../deps.server.ts";
export const handler: Handlers = {
GET(ctx: HandlerContext) {
@@ -43,7 +43,7 @@ Now, let's render some HTML using the route component. Another example:
// routes/html.tsx
/** @jsx h */
import { h, PageProps } from "../client_deps.ts";
import { h, PageProps } from "../deps.client.ts";
export default function Page(props: PageProps) {
return <div>You are on the page '{props.url.href}'.</div>;
@@ -65,8 +65,8 @@ response after rendering the page component.
// routes/html.tsx
/** @jsx h */
import { h, PageProps } from "../client_deps.ts";
import { HandlerContext, Handlers } from "../server_deps.ts";
import { h, PageProps } from "../deps.client.ts";
import { HandlerContext, Handlers } from "../deps.server.ts";
export const handler: Handlers = {
GET(ctx: HandlerContext) {
+2 -2
View File
@@ -31,7 +31,7 @@ Here is an example of an island component that counts down to a specific time.
// islands/Countdown.tsx
/** @jsx h */
import { h, useEffect, useMemo, useState } from "../client_deps.ts";
import { h, useEffect, useMemo, useState } from "../deps.client.ts";
const timeFmt = new Intl.RelativeTimeFormat("en-US");
@@ -73,7 +73,7 @@ client with the correct props:
// routes/countdown.tsx
/** @jsx h */
import { h } from "../client_deps.ts";
import { h } from "../deps.client.ts";
import { Countdown } from "../islands/Countdown.tsx";
export default function Page() {
+2 -2
View File
@@ -29,11 +29,11 @@ files, only two are strictly necessary for a fresh project:
In addition to these two files, two other files are created that manage
dependencies:
- **`client_deps.ts`**: This file contains dependencies that you need on the
- **`deps.client.ts`**: This file contains dependencies that you need on the
client, and possibly also on the server. It should be assumed that all of the
dependencies referenced by this file will be shipped to the client. By
default, it just re-exports the `fresh` runtime.
- **`server_deps.ts`**: This file contains dependencies that are only used on
- **`deps.server.ts`**: This file contains dependencies that are only used on
the server. These are often things like database drivers, API clients, or
other code that should only be executed on the server. This file should never
be referenced by modules that might be shipped to the client. By default this
+1 -1
View File
@@ -38,7 +38,7 @@ This is done with JSX.
// routes/about.tsx
/** @jsx h */
import { h } from "../client_deps.ts";
import { h } from "../deps.client.ts";
export default function AboutPage() {
return (
+2 -2
View File
@@ -31,7 +31,7 @@ then adds a custom header to the response before returning it:
// routes/about.tsx
/** @jsx h */
import { h, Handlers } from "../client_deps.ts";
import { h, Handlers } from "../deps.client.ts";
export const handler: Handlers = {
GET(req, ctx) {
@@ -58,7 +58,7 @@ response:
```ts
// routes/api/random-uuid.ts
import { Handlers } from "../client_deps.ts";
import { Handlers } from "../deps.client.ts";
export const handler: Handlers = {
GET(req) {
+1 -1
View File
@@ -28,7 +28,7 @@ as arguments in it's `props` object though.
// routes/greet/[name].tsx
/** @jsx h */
import { h, PageProps } from "../../client_deps.ts";
import { h, PageProps } from "../../deps.client.ts";
export default function AboutPage(props: PageProps) {
const { name } = props.params;
+2 -2
View File
@@ -24,8 +24,8 @@ renders it in a page component.
// routes/github/[username].tsx
/** @jsx h */
import { h, PageProps } from "../../client_deps.ts";
import { Handlers } from "../../server_deps.ts";
import { h, PageProps } from "../../deps.client.ts";
import { Handlers } from "../../deps.server.ts";
interface User {
login: string;
+2 -2
View File
@@ -33,8 +33,8 @@ server side:
// routes/search.tsx
/** @jsx h */
import { h, PageProps } from "../../client_deps.ts";
import { Handlers } from "../../server_deps.ts";
import { h, PageProps } from "../../deps.client.ts";
import { Handlers } from "../../deps.server.ts";
const NAMES = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Frank"];
+3 -3
View File
@@ -17,8 +17,8 @@ your application. All routes can act as both API endpoints and dynamic HTML
pages. More info about how the `routes` subdirectory works can be found on the
[file system routing](./file-system-routing.md) page.
Finally there is a `client_deps.ts` and `server_deps.ts`. These files are the
central location for all external imports. The `client_deps.ts` file is used for
Finally there is a `deps.client.ts` and `deps.server.ts`. These files are the
central location for all external imports. The `deps.client.ts` file is used for
runtime dependencies (ones that are used both in routes and islands), and the
`server_deps.ts` file is used for server only dependencies (for example ones
`deps.server.ts` file is used for server only dependencies (for example ones
used in API routes or middleware).