Skip to content

Commit

Permalink
Merge pull request #160 from elm-land/rhg/proxy
Browse files Browse the repository at this point in the history
📦 Release v0.19.5 - Proxy support, new effects, and `view` helpers
  • Loading branch information
ryan-haskell committed Jan 5, 2024
2 parents ef6ce81 + 75af25b commit ce08d05
Show file tree
Hide file tree
Showing 38 changed files with 256 additions and 182 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vitepress'

const version = '0.19.4'
const version = '0.19.5'

const sidebar = [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Here's example output of what you'd see if you ran this command in the ["Pages a

```txt
🌈 Elm Land (v0.19.4) found 5 pages in your application
🌈 Elm Land (v0.19.5) found 5 pages in your application
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
src/Pages/Home_.elm ............... http://localhost:1234/
src/Pages/SignIn.elm .............. http://localhost:1234/sign-in
Expand Down
20 changes: 12 additions & 8 deletions docs/concepts/effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,14 @@ Effect.pushRoute :
-> Effect msg
```

### `Effect.pushPath`
### `Effect.pushRoutePath`

Push a new Path onto the browser history as a route without query and hash. This is just like [Browser.Navigation.pushUrl](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Navigation#pushUrl), except it doesn't require a `Key` argument.

#### __Definition__

```elm
Effect.pushPath :
Route.Path.Path
-> Effect msg
Effect.pushRoutePath : Route.Path.Path -> Effect msg
```

### `Effect.replaceRoute`
Expand All @@ -114,16 +112,14 @@ Effect.replaceRoute :
-> Effect msg
```

### `Effect.replacePath`
### `Effect.replaceRoutePath`

Replace the current browser history entry with a new Path as URL without query and hash. This is just like [Browser.Navigation.replaceUrl](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Navigation#replaceUrl), except it doesn't require a `Key` argument.

#### __Definition__

```elm
Effect.replacePath :
Route.Path.Path
-> Effect msg
Effect.replaceRoutePath : Route.Path.Path -> Effect msg
```

### `Effect.loadExternalUrl`
Expand All @@ -134,6 +130,14 @@ Navigate to an external URL, outside your application. This is just like [Browse
Effect.loadExternalUrl : String -> Effect msg
```

### `Effect.back`

Navigate back on page. This is just like [Browser.Navigation.back](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Navigation#back), except it returns an `Effect` rather than a `Cmd`.

```elm
Effect.back : Effect msg
```


## Comparison with `Cmd`

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ elm-land build

```txt
🌈 Elm Land (v0.19.4) build was successful.
🌈 Elm Land (v0.19.5) build was successful.
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
```

Expand Down
5 changes: 3 additions & 2 deletions docs/guide/pages-and-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ elm-land routes

```txt
🌈 Elm Land (v0.19.4) found 6 pages in your application
🌈 Elm Land (v0.19.5) found 6 pages in your application
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
src/Pages/Home_.elm ........................... /
src/Pages/SignIn.elm .......................... /sign-in
Expand Down Expand Up @@ -481,7 +481,8 @@ Let's add a `<link>` tag to our HTML by updating the `app.html.link` property:
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
```
Expand Down
43 changes: 42 additions & 1 deletion docs/reference/elm-land-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ For reference, here is the default `elm-land.json` file that is created with eve
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
```
Expand Down Expand Up @@ -521,3 +522,43 @@ Route.Path.SignIn ...................... /#/sign-in
Route.Path.Users ....................... /#/users
Route.Path.Users_Id_ { id = "123" } .... /#/users/123
```

## app.proxy


::: info TYPE
```elm
Dict String String
```
:::

Configure custom proxy rules for the dev server. These options are
forwarded directly to the internal Vite dev server configuration. If
you don't have any proxy needs, you can leave this as `null`.

::: tip EXAMPLE

```jsonc {5}
{
"app": {
// ...
"proxy": {
"/api": "http://localhost:5000"
}
}
}
```

:::

The example above allows requests to `http://localhost:1234/api/xyz` to be redirected to `http://localhost:5000/api/xyz`.

__Note:__ Because the `elm-land.json` file does not support JS functions, you won't be able to
specify the `rewrite` or `configure` functions mentioned in [Vite's proxy options](https://vitejs.dev/config/server-options.html#server-proxy).

::: warning

Just like with Vite, this `proxy` setting only applies to the __development__ server. You'll need
to do something similar to get `/api` forwarding to your production API server another way.

:::
3 changes: 2 additions & 1 deletion examples/01-hello-world/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/02-pages-and-routes/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/03-user-input/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 3 additions & 0 deletions examples/04-rest-apis/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
},
"router": {
"useHashRouting": false
},
"proxy": {
"/api": "http://localhost:5000"
}
}
}
3 changes: 2 additions & 1 deletion examples/05-user-auth/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/06-query-parameters/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/07-working-with-js/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/08-nested-layouts/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/09-catch-all-routes/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/10-typescript-interop/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/11-error-reporting/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/12-elm-ui/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/13-elm-css/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/14-scss-and-assets/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/15-custom-404-pages/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/16-hash-based-routing/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": true
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/17-layout-props-types/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/18-shared-subscriptions/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
3 changes: 2 additions & 1 deletion examples/19-tailwindcss/elm-land.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"router": {
"useHashRouting": false
}
},
"proxy": null
}
}
2 changes: 1 addition & 1 deletion examples/19-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "BSD-3-Clause",
"devDependencies": {
"autoprefixer": "^10.4.16",
"elm-land": "^0.19.4",
"elm-land": "^0.19.5",
"postcss": "^8.4.32",
"tailwindcss": "^3.4.0"
}
Expand Down
2 changes: 1 addition & 1 deletion projects/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The `elm-land` CLI comes with everything you need to create your next web applic
```
$ elm-land
🌈 Welcome to Elm Land! (v0.19.4)
🌈 Welcome to Elm Land! (v0.19.5)
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
Here are the available commands:
Expand Down

0 comments on commit ce08d05

Please sign in to comment.