Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP server #65

Draft
wants to merge 117 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
cf0e25e
WIP first draft of simple HTTP server
lydell Jun 30, 2023
bc6843d
Improve responses
lydell Jul 1, 2023
8a82139
Separate file
lydell Jul 1, 2023
33da156
Make nice
lydell Jul 1, 2023
68243ab
Support video in Safari
lydell Jul 1, 2023
e99e13b
Avoid helper function
lydell Jul 1, 2023
01cf3cf
Simplify
lydell Jul 1, 2023
dd9abd4
Send Content-Length to avoid chunked
lydell Jul 1, 2023
f86ba88
Fix ctrl+c
lydell Jul 1, 2023
69630de
Set Content-Length for HTML as well
lydell Jul 1, 2023
63d0ade
Remove workaround that didn’t work
lydell Jul 1, 2023
f2665e2
Properly close sockets
lydell Jul 1, 2023
36e267a
Print the urls
lydell Jul 1, 2023
8cf3a97
Cookies and stuff
lydell Jul 2, 2023
4f0e8a2
Avoid downloads
lydell Jul 2, 2023
b72f802
wbr
lydell Jul 2, 2023
64755cd
favicons
lydell Jul 2, 2023
4dc52fa
Deduplicate escapeHtml
lydell Jul 2, 2023
62ef1d3
Add missing escapeHtml
lydell Jul 2, 2023
1f44df3
Reduce the number of lines printed in non-TTY mode
lydell Jul 2, 2023
726ca52
Update docs
lydell Jul 2, 2023
a2378b4
Update example readmes
lydell Jul 2, 2023
e89a902
No need to restrict to GET
lydell Jul 2, 2023
cb22d46
Remove markdown for Firefox
lydell Jul 2, 2023
ac86764
Fix infinite redirect
lydell Jul 2, 2023
c17d964
Shorten
lydell Jul 2, 2023
85fedb8
Fix redirect edge case
lydell Jul 2, 2023
e44688c
Fix typo
lydell Jul 2, 2023
e738b7a
Make the static HTTP server opt-in
lydell Jul 10, 2023
9ad51c4
Host type
lydell Jul 10, 2023
c012b22
Prettier
lydell Jul 10, 2023
64fe323
Update docs a little
lydell Jul 10, 2023
495867f
Move hidden state to class
lydell Jul 10, 2023
19bdc27
Better styling
lydell Jul 10, 2023
85bfee0
WIP CSS hot reloading
lydell Aug 15, 2023
5574606
Also reload CSS on WebSocket connect
lydell Aug 15, 2023
b1e05da
Better in most ways
lydell Aug 15, 2023
2b1f744
Fix sleep
lydell Aug 15, 2023
8bbd49a
Remove impossible state
lydell Aug 15, 2023
278ffe1
Tweak
lydell Aug 16, 2023
cc4d705
Make the flashing work
lydell Aug 16, 2023
1f91eb6
Make tests compile
lydell Aug 16, 2023
70e804f
Prettier
lydell Aug 16, 2023
b8abceb
Update docs
lydell Aug 16, 2023
f2c5fe9
Update comment
lydell Aug 17, 2023
0727c27
Make HTML escaping automatic
lydell Aug 18, 2023
749c8b8
Make it easier to find HTML files
lydell Aug 18, 2023
4104610
Fix emoji in Chrome
lydell Aug 18, 2023
77b23bf
Decode percentage escapes to support files with spaces (for example)
lydell Oct 7, 2023
7f255ec
Mark as beta
lydell Oct 14, 2023
9e8f4ed
Merge branch 'main' into http-server
lydell Oct 14, 2023
2e7e61f
WIP conventional index.html
lydell Dec 9, 2023
b8d04e1
Set headers
lydell Dec 10, 2023
e8e310f
Better 404 pages
lydell Dec 10, 2023
e3f6a7f
Simplify page for enabling static file server
lydell Dec 10, 2023
7f154bb
Add a link in headers as well
lydell Dec 10, 2023
08da645
Improve 404 hints
lydell Dec 12, 2023
7814d2c
Start working on docs
lydell Dec 12, 2023
09c3da6
Simplify removing comment in client.ts
lydell Dec 12, 2023
9574d97
Better error message for missing static directory
lydell Dec 12, 2023
19adb71
Update docs
lydell Dec 12, 2023
57141e8
Sync docs with main
lydell Dec 12, 2023
a79f85c
Protect against reading files outside the static files dir
lydell Dec 26, 2023
d0f10bf
More comprehensive file path handling for HTTP
lydell Dec 26, 2023
4b05a90
Disallow trailing slash for files
lydell Dec 26, 2023
f03247a
WIP reload images
lydell Dec 29, 2023
4970a96
reloadSrc
lydell Dec 29, 2023
599195d
Reload objects, iframes
lydell Dec 29, 2023
475b38d
WIP plug reloaders in
lydell Dec 29, 2023
e538d26
Hot.ts compiles
lydell Dec 29, 2023
2c7bf07
Fix srcset reloading and host check etc
lydell Dec 30, 2023
1e58301
Remove image reloading since it didn’t work for CSS
lydell Dec 31, 2023
a6424f4
WIP files changed event
lydell Dec 31, 2023
9edee74
Start adding createServer option
lydell Jan 1, 2024
1d1f7c8
Getting closer on CSS @import reload support
lydell Jan 6, 2024
57c24c2
WIP save original styles
lydell Jan 6, 2024
2bf6483
Fix original value comparisons
lydell Jan 6, 2024
c7b3faa
Replace whole rules since granular updates had edge cases
lydell Jan 6, 2024
7c999ac
Only reload CSS from one target
lydell Jan 6, 2024
8b6894f
Make it impossible to forget to initialize window.__ELM_WATCH stuff
lydell Jan 6, 2024
725b35a
Avoid setTimeout
lydell Jan 6, 2024
7f2da10
Looks like cache:reload can be used in Safari too
lydell Jan 6, 2024
0e08c8c
Check that host is the same
lydell Jan 6, 2024
a7edd0d
Remove unused ts-expect-error
lydell Jan 6, 2024
bac7325
Move CSS reloading to its own file since it’s completely standalone
lydell Jan 6, 2024
1d827d6
Document which file types are hot reloaded
lydell Jan 7, 2024
3c20376
Expose elmWatchCli function in the npm package
lydell Jan 7, 2024
2dde9b0
Allow configuring the web socket url
lydell Jan 7, 2024
1f0119a
Document
lydell Jan 7, 2024
3fee3f5
Merge branch 'main' into http-server
lydell Jan 7, 2024
ae4dd2f
Merge branch 'main' into http-server
lydell Jan 7, 2024
f2091ce
Merge branch 'main' into http-server
lydell Jan 11, 2024
b9283c7
Handle ENAMETOOLONG
lydell Jan 13, 2024
bb97263
Merge branch 'main' into http-server
lydell Jan 13, 2024
a2c5d94
Merge branch 'main' into http-server
lydell Jan 13, 2024
583ac2d
Merge branch 'main' into http-server
lydell Apr 12, 2024
1c9a4c6
Merge branch 'main' into http-server
lydell Jan 10, 2025
c9f866a
getWebSocketUrlFromEnv function
lydell Jan 10, 2025
6acbfd0
Run Prettier on index.d.ts
lydell Jan 10, 2025
f3fe605
Add missing eslint-disable-next-line comment
lydell Jan 10, 2025
5844b63
Update snapshot in Project.test.ts
lydell Jan 10, 2025
82a4ad7
Update snapshots in Help.test.ts
lydell Jan 10, 2025
ce640bb
Fix the printed server link having port 0 when not TTY
lydell Jan 10, 2025
691a075
Update a lot of the snapshots in Hot.test.ts
lydell Jan 10, 2025
0dfc192
Update HTTP test now that the HTTPS stuff is gone
lydell Jan 10, 2025
e60896e
Update the rest of the snapshots in Hot.test.ts
lydell Jan 10, 2025
920270e
Update snapshots in HotReloading.test.ts
lydell Jan 10, 2025
8541fd1
In non-TTY mode, don’t print stats again on restarts
lydell Jan 10, 2025
bbdc56d
Don’t print “web socket connections: 0” at init in non TTY mode
lydell Jan 10, 2025
624f804
Fix build script
lydell Jan 10, 2025
f2158f6
Handle headers already being sent
lydell Jan 10, 2025
11ff215
Simplify CSS hot reloading in Firefox
lydell Jan 10, 2025
b205bde
Fix test fixture
lydell Jan 11, 2025
00bc31d
Merge branch 'main' into http-server
lydell Feb 8, 2025
b4eaa40
Update test snapshots
lydell Feb 8, 2025
37e6d58
Merge branch 'main' into http-server
lydell Feb 8, 2025
212d7a1
Merge branch 'main' into http-server
lydell Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/WebSocketMessages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as Codec from "tiny-decoders";

import { NonEmptyArray } from "../src/NonEmptyArray";
import { AbsolutePath, BrowserUiPosition, CompilationMode } from "../src/Types";

const nonNegativeIntCodec = Codec.flatMap(Codec.number, {
Expand Down Expand Up @@ -114,6 +115,13 @@ export const WebSocketToClientMessage = Codec.taggedUnion("tag", [
tag: Codec.tag("OpenEditorFailed"),
error: OpenEditorError,
},
{
tag: Codec.tag("StaticFilesChanged"),
changedFileUrlPaths: NonEmptyArray(Codec.string),
},
{
tag: Codec.tag("StaticFilesMayHaveChangedWhileDisconnected"),
},
{
tag: Codec.tag("StatusChanged"),
status: StatusChange,
Expand Down
Loading
Loading