Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Run deno fmt (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiloio authored Oct 11, 2024
1 parent c8666e6 commit c9bad0f
Show file tree
Hide file tree
Showing 16 changed files with 13,274 additions and 13,249 deletions.
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# sveltekit-adapter-deno

[Adapter](https://kit.svelte.dev/docs/adapters) for [SvelteKit](https://kit.svelte.dev/) apps that generates a standalone [Deno](https://deno.com/runtime) or [Deno Deploy](https://deno.com/deploy) server.
[Adapter](https://kit.svelte.dev/docs/adapters) for
[SvelteKit](https://kit.svelte.dev/) apps that generates a standalone
[Deno](https://deno.com/runtime) or [Deno Deploy](https://deno.com/deploy)
server.

## Usage

Expand All @@ -10,17 +13,18 @@ Install in your SvelteKit project:
npm install --save-dev sveltekit-adapter-deno
```

Add the adapter to your [SvelteKit configuration](https://kit.svelte.dev/docs/configuration).
Add the adapter to your
[SvelteKit configuration](https://kit.svelte.dev/docs/configuration).

```js
// svelte.config.js
import adapter from 'sveltekit-adapter-deno';
import adapter from "sveltekit-adapter-deno";

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter()
}
adapter: adapter(),
},
};

export default config;
Expand All @@ -36,7 +40,8 @@ deno run --allow-env --allow-read --allow-net mod.ts

For Deno Deploy set the entry point to `mod.ts`.

See the [GitHub Action workflow](/.github/workflows/ci.yml) for automated deployment.
See the [GitHub Action workflow](/.github/workflows/ci.yml) for automated
deployment.

Using [deployctl](https://deno.com/deploy/docs/deployctl):

Expand All @@ -46,25 +51,29 @@ deployctl deploy --project=demo --import-map=import_map.json mod.ts

## Adapter options

See the [TypeScript definition](/index.d.ts) for `AdapterOptions`. You can specify the build output directory and provide additional esbuild options.
See the [TypeScript definition](/index.d.ts) for `AdapterOptions`. You can
specify the build output directory and provide additional esbuild options.

The `usage` option is used to determine where the current directory is (this is needed for the static and prerendered files). The default is `usage: 'deno'` which uses the `import.meta.url` to get the current directory.
If you want to compile the result with `deno compile` you should use `usage: 'deno-compile'` which uses `Deno.execPath()` to get the current directory.
The `usage` option is used to determine where the current directory is (this is
needed for the static and prerendered files). The default is `usage: 'deno'`
which uses the `import.meta.url` to get the current directory. If you want to
compile the result with `deno compile` you should use `usage: 'deno-compile'`
which uses `Deno.execPath()` to get the current directory.

## Node and NPM modules

Import Node modules in server routes with the `node:` prefix:

```js
import * as fs from 'node:fs';
import {Buffer} from 'node:buffer';
import * as fs from "node:fs";
import { Buffer } from "node:buffer";
```

Import NPM modules as if coding for Node:

```js
import slugify from '@sindresorhus/slugify';
console.log(slugify('I ♥ Deno'));
import slugify from "@sindresorhus/slugify";
console.log(slugify("I ♥ Deno"));
```

## Demo App
Expand All @@ -73,6 +82,6 @@ This repo publishes a SvelteKit demo app to Deno Deploy at:

[sveltekit-adapter-deno.deno.dev](https://sveltekit-adapter-deno.deno.dev/)

* * *
---

[MIT License](/LICENSE) | Copyright © 2023 [David Bushell](https://dbushell.com)
9 changes: 6 additions & 3 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
Everything you need to build a Svelte project, powered by
[`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

Expand All @@ -16,7 +17,8 @@ npm create svelte@latest my-app

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
Once you've created a project and installed dependencies with `npm install` (or
`pnpm install` or `yarn`), start a development server:

```bash
npm run dev
Expand All @@ -35,4 +37,5 @@ npm run build

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
> To deploy your app, you may need to install an
> [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
14 changes: 7 additions & 7 deletions demo/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
20 changes: 10 additions & 10 deletions demo/src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
2 changes: 1 addition & 1 deletion demo/src/routes/about/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dev } from '$app/environment';
import { dev } from "$app/environment";

// we don't need any JS on this page, though we'll load
// it in dev so that we get hot module replacement
Expand Down
132 changes: 70 additions & 62 deletions demo/src/routes/styles.css
Original file line number Diff line number Diff line change
@@ -1,107 +1,115 @@
@import '@fontsource/fira-mono';
@import "@fontsource/fira-mono";

:root {
--font-body: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
--font-mono: 'Fira Mono', monospace;
--color-bg-0: rgb(202, 216, 228);
--color-bg-1: hsl(209, 36%, 86%);
--color-bg-2: hsl(224, 44%, 95%);
--color-theme-1: #ff3e00;
--color-theme-2: #4075a6;
--color-text: rgba(0, 0, 0, 0.7);
--column-width: 42rem;
--column-margin-top: 4rem;
font-family: var(--font-body);
color: var(--color-text);
--font-body:
Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
--font-mono: "Fira Mono", monospace;
--color-bg-0: rgb(202, 216, 228);
--color-bg-1: hsl(209, 36%, 86%);
--color-bg-2: hsl(224, 44%, 95%);
--color-theme-1: #ff3e00;
--color-theme-2: #4075a6;
--color-text: rgba(0, 0, 0, 0.7);
--column-width: 42rem;
--column-margin-top: 4rem;
font-family: var(--font-body);
color: var(--color-text);
}

body {
min-height: 100vh;
margin: 0;
background-attachment: fixed;
background-color: var(--color-bg-1);
background-size: 100vw 100vh;
background-image: radial-gradient(
50% 50% at 50% 50%,
rgba(255, 255, 255, 0.75) 0%,
rgba(255, 255, 255, 0) 100%
),
linear-gradient(180deg, var(--color-bg-0) 0%, var(--color-bg-1) 15%, var(--color-bg-2) 50%);
min-height: 100vh;
margin: 0;
background-attachment: fixed;
background-color: var(--color-bg-1);
background-size: 100vw 100vh;
background-image:
radial-gradient(
50% 50% at 50% 50%,
rgba(255, 255, 255, 0.75) 0%,
rgba(255, 255, 255, 0) 100%
),

linear-gradient(
180deg,
var(--color-bg-0) 0%,
var(--color-bg-1) 15%,
var(--color-bg-2) 50%
);
}

h1,
h2,
p {
font-weight: 400;
font-weight: 400;
}

p {
line-height: 1.5;
line-height: 1.5;
}

a {
color: var(--color-theme-1);
text-decoration: none;
color: var(--color-theme-1);
text-decoration: none;
}

a:hover {
text-decoration: underline;
text-decoration: underline;
}

h1 {
font-size: 2rem;
text-align: center;
font-size: 2rem;
text-align: center;
}

h2 {
font-size: 1rem;
font-size: 1rem;
}

pre {
font-size: 16px;
font-family: var(--font-mono);
background-color: rgba(255, 255, 255, 0.45);
border-radius: 3px;
box-shadow: 2px 2px 6px rgb(255 255 255 / 25%);
padding: 0.5em;
overflow-x: auto;
color: var(--color-text);
font-size: 16px;
font-family: var(--font-mono);
background-color: rgba(255, 255, 255, 0.45);
border-radius: 3px;
box-shadow: 2px 2px 6px rgb(255 255 255 / 25%);
padding: 0.5em;
overflow-x: auto;
color: var(--color-text);
}

.text-column {
display: flex;
max-width: 48rem;
flex: 0.6;
flex-direction: column;
justify-content: center;
margin: 0 auto;
display: flex;
max-width: 48rem;
flex: 0.6;
flex-direction: column;
justify-content: center;
margin: 0 auto;
}

input,
button {
font-size: inherit;
font-family: inherit;
font-size: inherit;
font-family: inherit;
}

button:focus:not(:focus-visible) {
outline: none;
outline: none;
}

@media (min-width: 720px) {
h1 {
font-size: 2.4rem;
}
h1 {
font-size: 2.4rem;
}
}

.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: auto;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
white-space: nowrap;
border: 0;
clip: rect(0 0 0 0);
height: auto;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
white-space: nowrap;
}
Loading

0 comments on commit c9bad0f

Please sign in to comment.