Commit Graph

1253 Commits

Author SHA1 Message Date
Dillon Kearns
3c61e908bb Pass in --compiler flag to elm-review to use lamdera compiler. 2022-02-13 13:59:23 -08:00
Dillon Kearns
88ca2f8a02 Remove DataSource code from bundle. 2022-02-13 12:42:31 -08:00
Dillon Kearns
b91f978d24 Move Page Modules and special elm-pages modules into app folder. 2022-02-10 16:27:56 -08:00
Dillon Kearns
ce8a3c9e5c Delete log statement. 2022-02-10 14:51:41 -08:00
Dillon Kearns
6c2524e72a Fix Env.get. 2022-02-10 10:06:51 -08:00
Dillon Kearns
b10b247d99 Use more threads for build process. 2022-02-09 17:21:33 -08:00
Dillon Kearns
f777ecad07 Fix error decoding. 2022-02-09 16:26:28 -08:00
Dillon Kearns
d7109bfe40 Add missing await. 2022-02-09 15:08:06 -08:00
Dillon Kearns
fedda39a4f Remove manifest from Site.elm and move it into user-space. 2022-02-09 10:47:59 -08:00
Dillon Kearns
1d144996d8 Use an async version to check if file exists. 2022-02-08 11:41:05 -08:00
Dillon Kearns
50e81ca5de Remove some special cases for DataSource resolvers. 2022-02-07 17:49:14 -08:00
Dillon Kearns
364753694f Improve build error message ouptut. 2022-02-05 20:34:42 -08:00
Dillon Kearns
6663151122 Handle redirects when doing client-side navigations (through content.dat fetches). 2022-02-05 13:14:07 -08:00
Dillon Kearns
cb8509f519 Fix template for server-rendered page. 2022-02-04 11:44:26 -08:00
Dillon Kearns
5c2cdb93e1 Return empty list when listing files if directory doesn't existing. 2022-02-04 10:59:10 -08:00
Dillon Kearns
4c2f779477 Format errors if type is list. 2022-02-04 10:53:41 -08:00
Dillon Kearns
c1febe27b6 Try temporarily moving code back into source directory for better elm-review fixes. 2022-02-04 09:12:19 -08:00
Dillon Kearns
55131aa828 Delete obsolete variant. 2022-02-04 09:09:12 -08:00
Dillon Kearns
ac687f398e Remove calls to distillBytes. 2022-02-04 09:01:08 -08:00
Dillon Kearns
18831846aa Remove distillBytes calls from generated entrypoint and make sure that DataSource's resolve without it. 2022-02-04 08:59:11 -08:00
Dillon Kearns
5f181ad1bc Update error formatter to handle being passed direct JSON values. 2022-02-04 08:56:40 -08:00
Dillon Kearns
194337c80d Delete log statement. 2022-02-03 20:44:18 -08:00
Dillon Kearns
38cd1c35c6 Review fixes. 2022-02-03 20:17:00 -08:00
Dillon Kearns
1ed1d8bb8a Remove some ContentCache references. 2022-02-03 20:11:22 -08:00
Dillon Kearns
69cdf963cf Remove some instances of content.json. 2022-02-03 20:08:45 -08:00
Dillon Kearns
550c66dacb Send shared data updates for dev server to make sure shared data hot reloads. 2022-02-03 18:30:49 -08:00
Dillon Kearns
6892ee8bc7 Inline value. 2022-02-03 17:45:57 -08:00
Dillon Kearns
d3e54fcff2 Inline value. 2022-02-03 16:56:48 -08:00
Dillon Kearns
1c9d6340f1 Simplify case expression. 2022-02-03 16:38:54 -08:00
Dillon Kearns
c9f78e7c5f Encode NotFound pages for dev server. 2022-02-03 14:59:54 -08:00
Dillon Kearns
062cbea918 Send wrapper type instead of individual page data for Bytes content.dat. 2022-02-03 14:01:45 -08:00
Dillon Kearns
163f611894 Prettier formatting. 2022-02-03 11:51:34 -08:00
Dillon Kearns
159c075324 Send content.dat updates for hot reloading. 2022-02-03 11:51:17 -08:00
Dillon Kearns
e435c994b5 Uncomment hot reload watcher. 2022-02-02 09:53:47 -08:00
Dillon Kearns
103433ade6 Use Lamdera Wire decoders to decode initial page data from flags. 2022-02-01 17:59:57 -08:00
Dillon Kearns
1ee6cef81e Render base64 string without btoa function to avoid error. 2022-02-01 11:07:24 -08:00
Dillon Kearns
934846b697 Use byte decoder fail instead of Debug.todo in generated code. 2022-02-01 11:01:50 -08:00
Dillon Kearns
502b2cf42b Delete log statements. 2022-02-01 11:01:40 -08:00
Dillon Kearns
8df1439025 Write content.dat files instead of content.json for build step, and include bytes format in pre-rendered HTML output. 2022-02-01 10:57:21 -08:00
Dillon Kearns
0418d98de3 Update package-lock. 2022-02-01 10:55:46 -08:00
Dillon Kearns
db4e2f289e Add missing variable. 2022-02-01 10:38:42 -08:00
Dillon Kearns
34db57235c Add TODO comment. 2022-02-01 10:11:56 -08:00
Dillon Kearns
fcdd39b910 Use byte encodings for content.dat in dev server. 2022-02-01 10:11:47 -08:00
Dillon Kearns
cfbbf71bf5 Check if port is defined before subscribing to avoid error if port is unused. 2022-01-29 09:15:19 -08:00
Dillon Kearns
8e3736d051 Use restoreColorSafe in more places. 2022-01-29 09:01:27 -08:00
Dillon Kearns
e638bd13fd Fix error with sending api responses from dev server. 2022-01-29 09:00:38 -08:00
Dillon Kearns
c3b8032683 Add missing report option to restore dev server compiler errors. 2022-01-28 18:01:04 -08:00
Dillon Kearns
2180ee09e1 Run elm-optimize-level-2 on lamdera output. 2022-01-28 12:03:47 -08:00
Dillon Kearns
b6135799fc Skip elm-optimize-level-2 for the lamdera build for now. 2022-01-28 11:26:30 -08:00
Dillon Kearns
a0462a647e Add safe error formatter function that prints raw error if it can't be JSON parsed, and improve error output for build. 2022-01-28 11:26:14 -08:00
Dillon Kearns
7ac4ceecde Add NoPrematureLetComputation review rule. 2022-01-28 08:27:04 -08:00
Dillon Kearns
59346721b5 Remove log. 2022-01-27 20:13:30 -08:00
Dillon Kearns
59fb87782a elm-review fixes. 2022-01-27 16:16:40 -08:00
Dillon Kearns
f82ae79e24 Remove obsolete SecretsDict usage. 2022-01-27 15:50:59 -08:00
Dillon Kearns
ed956ae341 Remove now obsolete Secrets API! 2022-01-27 15:45:51 -08:00
Dillon Kearns
d7dd124880 Show error output if it can't be parsed as JSON. 2022-01-26 15:03:44 -08:00
Dillon Kearns
7497934772 Merge branch 'lamdera-wire' into serverless-latest
# Conflicts:
#	examples/pokedex/netlify.toml
#	examples/pokedex/src/Api.elm
#	examples/pokedex/src/Page/Greet.elm
#	examples/pokedex/src/Page/Login.elm
#	src/Session.elm
2022-01-26 14:32:39 -08:00
Dillon Kearns
e2145a5844 Restore --report json option to make command. 2022-01-26 14:27:24 -08:00
Dillon Kearns
b979c5bc3c Run lamdera compiler instead of elm to make wire encoders available. 2022-01-26 14:27:15 -08:00
Dillon Kearns
d15a191d5a Distill shared data. 2022-01-26 10:45:05 -08:00
Dillon Kearns
9b4e4dab9b Log dev server errors in case they can't be decoded to JSON. 2022-01-26 08:36:48 -08:00
Dillon Kearns
3e9a93c636 Generate distillBytes with wire codecs for all page modules. 2022-01-25 21:56:02 -08:00
Dillon Kearns
21d9ae9e35 Add port to reload current page's data. 2022-01-25 11:20:18 -08:00
Dillon Kearns
e84232d67a Include form helper in build output elm file. 2022-01-24 20:54:53 -08:00
Dillon Kearns
f21b8b61b1 Add form data decoder and example. 2022-01-24 15:50:25 -08:00
Dillon Kearns
1becbff897 Wire through errors with session checksums. 2022-01-23 13:35:04 -08:00
Dillon Kearns
69feca1c42 Add distillBytes with some lamdera wire encoder/decoders. 2022-01-21 09:31:18 -08:00
Dillon Kearns
08e635cbeb Try all secrets in list for decoding signed cookies. 2022-01-20 19:09:37 -08:00
Dillon Kearns
30ab850c90 Add prototype for withSession helper. 2022-01-20 18:00:38 -08:00
Dillon Kearns
ea5be72234 Update generator. 2022-01-17 20:59:17 -08:00
Dillon Kearns
51aea3b539 Simplify Server.Response API by combining render repsonses and server responses into the same API. 2022-01-17 20:56:37 -08:00
Dillon Kearns
03dd16a86f Wire through custom headers and status codes for RenderPage server responses. 2022-01-17 16:56:40 -08:00
Dillon Kearns
67cc4e045a Update add cli command. 2022-01-05 15:12:38 -08:00
Dillon Kearns
08138e7a26 Use () instead of Never for Msg's in stateless pages. That way, you can map Msg's (unlike never). 2022-01-05 14:09:37 -08:00
Dillon Kearns
7b743cf72d Rename module. 2021-12-31 16:15:41 -08:00
Dillon Kearns
86142cb6d8 Remove obsolete server request code from initial prototype. 2021-12-31 11:52:37 -08:00
Dillon Kearns
3aae8c1adf Remove Handler type in favor of a type variable for ServerRequest type. 2021-12-31 11:14:23 -08:00
Dillon Kearns
bfbb5866f2 Capture multiple matching errors for server requests. 2021-12-30 19:55:45 -08:00
Dillon Kearns
9e9eb26a02 Try different lamda file read root. 2021-12-30 09:31:24 -08:00
Dillon Kearns
d0d205bee4 Try new filename resolution for netlify function. 2021-12-30 09:27:20 -08:00
Dillon Kearns
2a90dc9d51 Try adding path.resolve for netlify file paths. 2021-12-29 21:57:35 -08:00
Dillon Kearns
701d949304 Remove resolved path netlify file path read trick to see if it works. 2021-12-29 21:46:47 -08:00
Dillon Kearns
6684c36852 Try resolving filepath from serverless function root. 2021-12-29 21:31:53 -08:00
Dillon Kearns
c14a38bfc6 Fix in-memory cache reset. 2021-12-29 17:38:45 -08:00
Dillon Kearns
d13a397507 Use in-memory fs or real fs for http cache depending on whether context is serverless. 2021-12-29 17:18:37 -08:00
Dillon Kearns
9a60119484 Rearrange template. 2021-12-29 16:02:18 -08:00
Dillon Kearns
862c48d134 Update template. 2021-12-29 15:57:12 -08:00
Dillon Kearns
4444ef6fc0 Update render result types and adapter script. 2021-12-29 13:58:21 -08:00
Dillon Kearns
b2c1a31c68 Handle multipart forms in dev server and adapter script. 2021-12-29 13:02:45 -08:00
Dillon Kearns
0ac78944ce Update adapter. 2021-12-28 11:53:43 -08:00
Dillon Kearns
572f6f2336 Add greet api function. 2021-12-28 11:53:33 -08:00
Dillon Kearns
5136dd50a6 Use Server.Request for ApiRoutes. 2021-12-28 08:32:25 -08:00
Dillon Kearns
0a849061b0 Add --with-fallback scaffolding option. 2021-12-27 13:46:21 -08:00
Dillon Kearns
010a6e4526 Update scaffolding template for server-rendered. 2021-12-27 10:09:10 -08:00
Dillon Kearns
10bbeb491d Use more declarative interface for Server Requests. 2021-12-26 21:56:33 -08:00
Dillon Kearns
43a7e4fda9 Add elm-pages codegen command. 2021-12-23 14:37:31 -08:00
Dillon Kearns
bf67cff13e Rename TemplateModulesBeta.elm entrypoint file -> Main.elm. 2021-12-23 14:28:52 -08:00
Dillon Kearns
31c3af5aa8
Merge pull request #258 from j-maas/expose-base
Expose base URL
2021-12-23 13:59:16 -08:00
Dillon Kearns
6f82aa59f8 Add ServerRequest.withRequestTime, and make body nullable. 2021-12-23 13:34:54 -08:00
Dillon Kearns
4fedf9ee19 Rename prerender -> preRender. 2021-12-23 13:34:19 -08:00
Dillon Kearns
afb81f7224 Replace handleFallback with PageServerResponse for prerenderWithFallback. 2021-12-23 11:14:46 -08:00
Dillon Kearns
f43e57e265 Add withBody. 2021-12-22 15:28:19 -08:00
Dillon Kearns
fc00121c27 Update serverless generator. 2021-12-22 12:07:14 -08:00
Dillon Kearns
c43d7f474b Wire through key for accessing DataSource.ServerRequest. 2021-12-22 11:29:16 -08:00
Dillon Kearns
5037ae757a Update cli generator with serverless option. 2021-12-22 10:13:02 -08:00
Dillon Kearns
9a8bf732a0 Remove duplicate of ServerResponse.toJson function. 2021-12-21 17:33:02 -08:00
Dillon Kearns
862d0ce46f Handle ServerPageResponse variants in Platform.elm. 2021-12-21 15:34:17 -08:00
Dillon Kearns
f6c13c0404 Handle API responses from serverless Page Modules. 2021-12-21 12:01:08 -08:00
Dillon Kearns
7f2d47c6de Add serverless ApiRoute builder and some examples in pokedex app. 2021-12-21 07:47:47 -08:00
Dillon Kearns
59fb56f8c6 Handle new data format in dev server. 2021-12-20 15:48:10 -08:00
Dillon Kearns
843ca0bacd Wire through headers, statusCode, and body from ServerResponse. Add redirect example. 2021-12-20 14:45:18 -08:00
Dillon Kearns
c79d76f473 Include kind in API routes to tell the rendering mode. Generate redirects for serverless API routes. 2021-12-20 13:35:34 -08:00
Dillon Kearns
7eaa94a9e4 Include Pattern information for ApiRoutes. 2021-12-20 11:26:12 -08:00
Dillon Kearns
35c5be1ee0 Transform AWS event payload into event for DataSource.ServerRequest JSON. 2021-12-16 12:05:59 -08:00
Dillon Kearns
9769e7a95c Pass through request from NodeJS and update the ServerRequest API. 2021-12-15 20:10:54 -08:00
Dillon Kearns
7a57c331bc Use route-patterns.json to generate _redirects file. 2021-12-15 15:39:35 -08:00
Dillon Kearns
4da2ab9209 Reset in-memory filesystem on each render request. 2021-12-15 12:39:15 -08:00
Dillon Kearns
dca81657ee Try in-memory fs. 2021-12-15 12:22:25 -08:00
Dillon Kearns
c113fd8008 Temp - comment out line to see what serverless function does. 2021-12-15 09:32:24 -08:00
Dillon Kearns
dacba7358e Update pokedex example. 2021-12-15 09:26:23 -08:00
Dillon Kearns
ff22d58bf3 Add --debug flag for elm-pages dev (default is now with no --debug like in elm make). 2021-12-14 15:38:20 -08:00
Dillon Kearns
9455a6fc3e
Merge pull request #261 from dillonkearns/remove-obsolete-file-from-dist
Remove obsolete script from dist folder (it is now inlined as a <script>)
2021-12-14 14:09:18 -08:00
Dillon Kearns
a5910cc672 If elm-review doesn't catch any implicit contract errors, show the raw TemplateModulesBeta.elm Elm compiler error. 2021-12-14 14:06:08 -08:00
Dillon Kearns
1d459071cf Remove obsolete script from dist folder (it is now inlined as a <script> in the HTML). Fixes #219. 2021-12-11 15:06:29 -08:00
Dillon Kearns
d51b9f0cc1
Merge pull request #260 from dillonkearns/move-internals-outside-package
Move internals outside package
2021-12-11 15:05:31 -08:00
Dillon Kearns
446525294c Remove none option from elm-pages add. 2021-12-11 12:01:47 -08:00
Dillon Kearns
86eeb4cef9 Move internal-only modules outside of Elm package and into generated code folders. 2021-12-11 11:42:35 -08:00
Dillon Kearns
00e8fd82bd Ensure that copy elm.json happens before starting elm-pages docs server. 2021-12-11 11:34:41 -08:00
Dillon Kearns
d5de1137e5 Fix typo in docs. 2021-12-10 16:11:56 -08:00
Dillon Kearns
010cfb9c2a Rename routes to pages. Routes are the category of page, pages are the specific things to pre-render for a given route, so this terminology is more consistent and clear. 2021-12-10 16:03:07 -08:00
Dillon Kearns
6583738ab2 Change font to avoid system-ui. 2021-12-10 15:38:04 -08:00
Dillon Kearns
b18ff938ca Update font. 2021-12-10 15:28:09 -08:00
Dillon Kearns
0fe75971eb Use system-ui for starter. 2021-12-10 12:08:22 -08:00
Dillon Kearns
e2a64693ff Update Page.elm docs. 2021-12-10 12:05:31 -08:00
Dillon Kearns
7b53e782a3 Update starter template app. 2021-12-10 11:34:51 -08:00
Dillon Kearns
b67a66d052 Update template. 2021-12-10 11:21:39 -08:00
Dillon Kearns
d675b2c13f Change syntax for constructor function to avoid constructor error. 2021-12-10 10:50:27 -08:00
Dillon Kearns
d752866d4e Use empty records instead of empty tuples for stateless Page Module's Model. Tweak Page builder API. Add option for local and shared state in generators. 2021-12-10 09:52:12 -08:00
Johannes Maas
72ac88334f Expose base 2021-12-04 19:19:33 +01:00
Dillon Kearns
0649fb6bad Update init template. 2021-12-01 15:38:08 -08:00
Shea Kelly
ce6fb34b1b adding https support using devcert 2021-11-06 12:13:26 +11:00
Dillon Kearns
840cb83d36 Add meta tag that needs escaping to end-to-end escaping test, and fix escaping issue in SEO attributes. 2021-10-26 10:40:04 -07:00
Dillon Kearns
26101b402a
Merge pull request #236 from j-maas/fix-head-path-separator
Use Posix-style separators in head tags
2021-10-20 14:16:15 -07:00
Dillon Kearns
c2793585ac Merge branch 'master' into pr/234 2021-10-16 14:29:44 -07:00
Dillon Kearns
807ea6517b Merge branch 'master' into pr/236 2021-10-16 09:23:47 -07:00
Dillon Kearns
3ece0dddc5
Merge pull request #237 from j-maas/fix-manifest-missing-base
Fix manifest URL missing base
2021-10-16 09:19:33 -07:00
Dillon Kearns
51acc3263c Extract constant. 2021-10-07 13:15:25 -07:00
Dillon Kearns
b876f06139 Test escaping examples both with and without --debug flag. Fix output without debug flag. 2021-10-07 12:05:13 -07:00
Dillon Kearns
c91b01d5a4 Port over HTML to string helpers from elm-explorations/test. TODO - still need to port the escaping fixes I did to the elm-explorations/test implementation. 2021-10-07 11:34:08 -07:00
Dillon Kearns
81fbbb6518 Add missing closing quote. 2021-10-02 16:54:32 -07:00
Dillon Kearns
6e6e0beeb0 Run prettier on file. 2021-10-02 16:53:16 -07:00
Johannes Maas
0359f916d4 Fix manifest URL missing base 2021-10-02 19:27:52 +02:00
Johannes Maas
b445856ad2 Use Posix-style separators in head tags
Previously, on Windows some <head> tags contained backslashes as separators.
2021-10-02 19:17:46 +02:00
Johannes Maas
cbad8ad8ad Fix empty base handling 2021-10-02 17:26:05 +02:00
Johannes Maas
42e465b4d8 Document why req.url is always the path 2021-10-02 17:02:25 +02:00
Johannes Maas
483381aaaa Fix base middleware infix detection and refactor it 2021-10-02 16:52:42 +02:00
Johannes Maas
1c83d4e219 Fix deprecated URL parsing 2021-10-02 16:45:21 +02:00
Johannes Maas
1b3859ab9a Fix error message for invalid base 2021-10-02 15:29:51 +02:00
Johannes Maas
beca0367e3 Refactor base normalization 2021-10-02 15:29:26 +02:00
Y0hy0h
7ba44a27af Fix issues with trailing slashes in the base 2021-10-02 14:55:25 +02:00
Dillon Kearns
5ed983a92f Allow some more dead-code elimination in browser Elm code through the generated code stripping off some CLI-only code. 2021-09-27 10:19:49 -07:00
Dillon Kearns
93955b00e3 Create .elm-pages folder from init command to ensure that the initial project is valid when running elm install command. Fixes #205. 2021-08-27 15:05:40 -07:00
Dillon Kearns
01dfc4b157 Update package version. 2021-08-27 11:41:30 -07:00
Dillon Kearns
f93252e79f Add elm-review to starter template. 2021-08-27 11:37:34 -07:00
Dillon Kearns
7d25c16ee8 Run elm-review in build if there are errors. 2021-08-27 11:36:03 -07:00
Dillon Kearns
7d88bc74f2 Remove extra log statement. 2021-08-27 11:35:46 -07:00
Dillon Kearns
f40e1d0db2 Give an error if elm-review isn't found on the PATH. 2021-08-27 10:59:35 -07:00
Dillon Kearns
87b60e4856 Run elm-review when errors point to generated code. 2021-08-27 10:27:37 -07:00
Dillon Kearns
8707affb37 Bump version in starter template. 2021-08-25 11:12:49 -07:00
Dillon Kearns
e26b361ac6 Add test case for <script></script> JSON escaping and only run it within the pre-rendered HTML. 2021-08-25 10:55:45 -07:00
Daniel Marin
785c7a51dd
Use jsesc instead of JSON.stringify to avoid issues
As explained here: https://mathiasbynens.be/notes/etago

One can run into issues when trying to embed JSON containing
HTML with <script> elements inside a <script> tag.

Switching to a utility with support for this fixes the issue:
https://github.com/mathiasbynens/jsesc#isscriptcontext
2021-08-20 17:55:51 +01:00
Dillon Kearns
ffb9c280be Bump elm-pages version in template. 2021-08-17 18:39:23 -07:00
Dillon Kearns
19f5e72edf Include elm-optimize-level-2 dependency in init template, as well as an elm-tooling config. 2021-08-17 17:19:11 -07:00
Dillon Kearns
06c661e8b6 Avoid printing duplicate error message for compiler errors. 2021-08-17 12:02:39 -07:00
Dillon Kearns
baac8711f9 Check for elm and elm-optimize-level-2 on the PATH before running build. 2021-08-17 11:53:06 -07:00
Dillon Kearns
d3f0c9e86d Update package version in template project. 2021-08-15 11:59:38 -07:00
Dillon Kearns
3629daa512 Fix "undefined" error printing to show compiler error, and use console.trace for unhandled errors. 2021-08-15 11:56:55 -07:00
Dillon Kearns
4ce6b18ed2 Skip unnecessary 404 check in build to avoid extra computations. 2021-08-09 19:43:06 -07:00
Dillon Kearns
a1078e65c9 Remove redundant log statement. 2021-08-09 19:12:24 -07:00
Dillon Kearns
1526417720 Update versions in init template. 2021-08-03 13:39:44 -07:00
Dillon Kearns
55b122cb70 Refer to latest elm-pages in init template. 2021-08-02 17:49:45 -07:00
Dillon Kearns
f2402899f6 Clean up error message printing in build and dev server. 2021-08-02 17:38:38 -07:00
Dillon Kearns
e15e3be999 Fix package version in init template. 2021-08-01 16:11:15 -07:00
Dillon Kearns
b553c6fa98 Fix template. 2021-08-01 14:26:32 -07:00
Dillon Kearns
c1fb9c3436 Remove obsolete argument. 2021-08-01 10:23:20 -07:00
Dillon Kearns
dc60b4e6c3 Update template package.json file. 2021-07-31 20:37:20 -07:00
Dillon Kearns
2d8cc895da Use published package in template elm.json file. 2021-07-31 20:27:17 -07:00
Dillon Kearns
51f753845f Update generated file. 2021-07-31 20:09:23 -07:00
Dillon Kearns
1d07bff182 Skip removing cache dir if it doesn't exist. 2021-07-31 17:01:56 -07:00
Dillon Kearns
c7a76ed605 Add keep-cache flag to explicitly keep HTTP/JS port cache if used. 2021-07-31 16:50:28 -07:00
Dillon Kearns
b78f8c008b Rename types in ApiRoute module. 2021-07-30 15:35:11 -07:00
Dillon Kearns
8678c95208 Rename internal module. 2021-07-30 15:21:16 -07:00
Dillon Kearns
de5ceb24ab Update some references to renamed modules. 2021-07-30 15:18:55 -07:00
Dillon Kearns
8575d56284 Rename internal module. 2021-07-30 15:13:32 -07:00
Dillon Kearns
43948c6b39 Rename internal module. 2021-07-30 15:08:30 -07:00
Dillon Kearns
89ea8b67fb Update template. 2021-07-30 14:58:42 -07:00
Dillon Kearns
a8450988dd Dev server was mixing up requests after serving a compiler error. This makes it resilient to that so it doesn't get into that state. 2021-07-30 09:58:59 -07:00
Dillon Kearns
f3a7309085 Formatting. 2021-07-30 09:58:21 -07:00
Dillon Kearns
6ee8424cf5 elm-formatting. 2021-07-29 14:19:22 -07:00
Dillon Kearns
979fa5ce4c Stop using serverless route in example temporarily. 2021-07-29 14:17:32 -07:00
Dillon Kearns
c0891afb13 Remove serverless/on-demand helpers temporarily since they're not going to be in the initial 2.0 release. 2021-07-29 14:13:22 -07:00
Dillon Kearns
f61f4614d8 Update template. 2021-07-28 10:29:11 -07:00
Dillon Kearns
5595edeee8 Remove future NodeJS optional chain syntax. 2021-07-28 10:22:07 -07:00
Dillon Kearns
5747c2f030 Use Shared.Msg instead of extra layer of abstraction for sub-msg type. 2021-07-27 10:48:42 -07:00
Dillon Kearns
eadabe1513 Remove log statement. 2021-07-26 17:06:46 -07:00
Dillon Kearns
3b2af1e9a8 Don't render hmr script load in builds (only dev-server). 2021-07-26 15:39:10 -07:00
Dillon Kearns
449e32cf9c Fail build if elm-optimize-level-2 isn't found, and print error output (for example if Debug.log's are found). 2021-07-26 12:40:50 -07:00
Dillon Kearns
69cba32d90 Use absolute URL for manifest.json link since there is no more base tag. 2021-07-26 08:35:49 -07:00
Dillon Kearns
aafd5a29e5 Rename frontmatter to route. 2021-07-21 14:53:27 -07:00
Dillon Kearns
573c6d72dd Handle base path for 404 pages. 2021-07-21 14:42:58 -07:00
Dillon Kearns
00c91c8e9d Include base path in ProgramConfig. 2021-07-21 14:29:37 -07:00
Dillon Kearns
eef18eee93 Use setImmediate to enqueue tasks sequentially so the work is delegated to multiple threads. 2021-07-20 14:47:58 -07:00
Dillon Kearns
951d57a12a Enqueue dev server response work when thread pool is all busy. 2021-07-20 14:14:56 -07:00
Dillon Kearns
4ede380fab Remove baseUrl from model, parse Path into the actual path including the base URL. 2021-07-19 20:59:42 -07:00
Dillon Kearns
c855875e97 Normalize base path arguments. 2021-07-19 18:58:58 -07:00
Dillon Kearns
a264ce10f2 Add --base option, and remove <base> tags. 2021-07-19 18:39:23 -07:00
Dillon Kearns
b241727a86 Use serveStatic to serve compiled elm.js for browser using etags/modified-dates to ensure 304's when possible. 2021-07-17 17:26:30 -07:00
Dillon Kearns
4e88d51e85 Cache Port DataSources like HTTP is cached. 2021-07-17 15:16:13 -07:00
Dillon Kearns
7b3f9889b4 Exclude the .elm-pages folder from the source directories watchers. 2021-07-17 14:14:32 -07:00
Dillon Kearns
d9f3372669 Add base middleware function. 2021-07-16 20:28:46 -07:00
Dillon Kearns
937457fb52 Catch elm-optimize-level-2 errors and run elm make to display errors (since elm-optimize-level-2 doesn't have report option. 2021-07-14 19:03:50 -07:00
Dillon Kearns
c85a5e82f4 Capture elm compiler errors in order to log them cleanly without overlapping process logs. 2021-07-14 18:07:20 -07:00
Dillon Kearns
22c5fc968d Update error formatting. 2021-07-14 18:05:03 -07:00
Dillon Kearns
fb73faaf3b Remove extra log. 2021-07-14 15:56:22 -07:00
Dillon Kearns
d96e24a25c Use ANSI color codes for error messages from NodeJS elm-pages engine. 2021-07-14 15:45:06 -07:00
Dillon Kearns
e8415317b1 Preserve port data source's require cache for build command to speed things up. 2021-07-14 11:30:38 -07:00
Dillon Kearns
82bab067ad Print error if DataSource.Port is used without port definitions file. 2021-07-14 10:29:55 -07:00
Dillon Kearns
ed0141c78e Print full error on unhandled worker exception. 2021-07-14 10:29:36 -07:00
Dillon Kearns
7988bfe69b Update error message. 2021-07-14 10:12:28 -07:00
Dillon Kearns
b904d8bbcd Pass through HTTP errors as build errors. 2021-07-14 10:02:08 -07:00
Dillon Kearns
3d3b7be40b Trigger build error from read file batch functions. 2021-07-14 09:04:45 -07:00
Dillon Kearns
669a20dfe9 Add console.time around DataSource.Port invocations. 2021-07-14 09:03:48 -07:00
Dillon Kearns
2864cfcc58 Use some fsPromises functions. 2021-07-14 09:03:17 -07:00
Dillon Kearns
cf58268c23 Send port name and use it to find exported port function. 2021-07-13 08:23:05 -07:00
Dillon Kearns
91c330f40a Handle port DataSource error, and pass in parsed JSON body as argument. 2021-07-13 07:34:31 -07:00
Dillon Kearns
0c242b1543 Add Port DataSource. 2021-07-12 20:01:43 -07:00
Dillon Kearns
3f73f9eb29 Handle errors with postMessage instead of throwing to prevent worker threads from dying. 2021-07-12 17:17:09 -07:00
Dillon Kearns
fc796da773 Include manifest in paths to generate. 2021-07-10 19:03:08 -07:00
Dillon Kearns
242dfba9bc Remove unused value. 2021-07-10 19:02:58 -07:00
Dillon Kearns
666479f2e7 Cleanup dev server start logic. 2021-07-10 16:54:38 -07:00
Dillon Kearns
d447e885ee Remove log. 2021-07-10 16:54:29 -07:00
Dillon Kearns
d2cfd7dd25 Use non-blocking IO for terser writes. 2021-07-10 16:46:21 -07:00
Dillon Kearns
53e118e845 Remove log statement. 2021-07-10 16:42:15 -07:00
Dillon Kearns
2c2b2b559e Comment out some logs in dev server output. 2021-07-10 14:27:20 -07:00
Dillon Kearns
335ff5f0b1 Avoid writing CLI app's elm.json to disk if the contents are exactly what would be written. Helps the Elm compiler speed up by around 1 second. 2021-07-10 13:57:31 -07:00
Dillon Kearns
0dbb2138db Run codegen steps in parallel. 2021-07-10 13:56:44 -07:00
Dillon Kearns
283f01b690 Remove Elm code that is obsolete with new batch response architecture. 2021-07-10 13:55:42 -07:00
Dillon Kearns
2a23815a3f Handle glob with response batching. 2021-07-10 08:33:22 -07:00
Dillon Kearns
b7160fef3f Use response batching for HTTP requests. 2021-07-10 08:23:56 -07:00
Dillon Kearns
5df5c654dd Retain in-memory cache for builds only. 2021-07-09 13:28:22 -07:00
Dillon Kearns
036271288a Try preserving cache to see how it performs on netlify builds. 2021-07-09 13:11:18 -07:00
Dillon Kearns
550f514e8c Remove some logs. 2021-07-09 13:10:58 -07:00
Dillon Kearns
ac2891c297 Batch file reads. 2021-07-09 11:04:41 -07:00
Dillon Kearns
08ca61d79b Try first step towards a batch DataSource response optimization experiment. 2021-07-08 15:10:07 -07:00
Dillon Kearns
ac06b3903d Add link for reference. 2021-07-08 13:23:11 -07:00
Dillon Kearns
19562d8937 Merge branch 'static-files' into worker-threads 2021-07-08 13:19:21 -07:00
Dillon Kearns
0764a1a714 Hot reload CSS changes. 2021-07-08 11:59:40 -07:00
Dillon Kearns
1b77273cd9 Remove unused mode flag. 2021-07-07 21:28:58 -07:00
Dillon Kearns
32b9b8e94a Remove comment. 2021-07-07 21:13:24 -07:00
Dillon Kearns
ffb9484332 Full build functionality is obsolete now as workers run single-page mode renders. Remove some unused paths. 2021-07-07 21:13:17 -07:00
Dillon Kearns
30d92da3f7 Handle promise rejection for dev server errors. 2021-07-07 14:02:16 -07:00
Dillon Kearns
8d58b8464f Remove some logging statements. 2021-07-07 12:26:50 -07:00
Dillon Kearns
5a82bb9bd0 Handle errors in worker-based build command. 2021-07-07 12:06:55 -07:00
Dillon Kearns
c903bfff68 Formatting. 2021-07-07 12:05:58 -07:00
Dillon Kearns
075e1e641a Remove redundant log. 2021-07-07 12:05:42 -07:00
Dillon Kearns
6084b7d895 Generate static API routes in worker thread build. 2021-07-07 10:24:01 -07:00
Dillon Kearns
3e61a143a6 Don't send watch message with empty set. 2021-07-07 09:59:33 -07:00
Dillon Kearns
41dadfe804 Remove obsolete cache code in main dev server thread. 2021-07-07 09:59:24 -07:00
Dillon Kearns
e56f13d3eb In build mode, don't clear Elm require cache. 2021-07-07 09:25:52 -07:00
Dillon Kearns
457aee7067 Don't send watch messages from build command. 2021-07-07 09:14:04 -07:00
Dillon Kearns
b38815170f Remove xhr2 dependency. 2021-07-07 08:56:58 -07:00
Dillon Kearns
d22a663a90 Re-require Elm lazily on each worker render, and add file watchers from workers. 2021-07-07 08:41:14 -07:00
Dillon Kearns
c3b7391ca6 Use custom thread pool for dev server in preparation for custom messages (which aren't supported by the previous npm package). 2021-07-06 16:34:29 -07:00
Dillon Kearns
c734630a2b Use custom worker thread pool in preparation for custom message passing (npm package didn't support custom messages, only completion messages). 2021-07-06 15:24:44 -07:00
Dillon Kearns
2567b6b9b2 Delete comment. 2021-07-06 10:46:52 -07:00
Dillon Kearns
4b072c2491 Delete unused. 2021-07-06 10:45:19 -07:00
Dillon Kearns
1b02442bc9 Share environment variables in worker pools to ensure PATH is persisted and secrets are available. 2021-07-06 07:50:52 -07:00
Dillon Kearns
ac3c3369e5 Use undici to perform HTTP requests with file-system cache. 2021-07-06 06:26:14 -07:00
Dillon Kearns
0fe8147b13 Use worker threads for dev server. 2021-07-04 20:14:34 -07:00
Dillon Kearns
35608ebe63 Use app.die() in worker threads to reduce memory, and restore use in dev server. 2021-07-02 16:05:16 -07:00
Dillon Kearns
9dfdf33708 Use writeFileSync in worker threads. 2021-07-02 16:04:57 -07:00
Dillon Kearns
1fd5133ba9 Base number of worker threads on number of CPUs. 2021-07-02 16:04:43 -07:00
Dillon Kearns
a94ee06c35 Run build with worker threads. 2021-07-02 15:15:41 -07:00
Dillon Kearns
5f54b4fbe3 Clear glob cache on change, removeDir, addDir. 2021-06-25 12:20:06 -07:00
Dillon Kearns
513159cd86 Update index.js page for template. 2021-06-25 09:57:05 -07:00
Dillon Kearns
08fb2b2465 Add missing dependency in template scaffolding. 2021-06-25 09:56:53 -07:00
Dillon Kearns
20f209f7da Move content.json script tag to bottom of head tag. 2021-06-25 08:14:43 -07:00
Dillon Kearns
38a8e13d4c Remove newlines between SEO head tags. 2021-06-25 08:14:20 -07:00
Dillon Kearns
33c62aaeaf Try initial content.json in a script tag. 2021-06-25 08:03:25 -07:00
Dillon Kearns
40b5b70272 Remove unused code. 2021-06-24 21:31:50 -07:00
Dillon Kearns
32a351a094 Extract common code for prerender function. 2021-06-24 19:01:12 -07:00
Dillon Kearns
d99d51d944 Extract js code to file. 2021-06-24 18:33:31 -07:00
Dillon Kearns
9e1eb683a8 Log exception message when printing errors. 2021-06-24 17:49:10 -07:00
Dillon Kearns
a089fbd248 Inline JS for elm-pages.js script, and minify it. 2021-06-24 17:48:42 -07:00
Dillon Kearns
f1750de106 Simplify elm-pages.js code. 2021-06-24 15:55:41 -07:00
Dillon Kearns
ae6133377f Rearrange template. 2021-06-24 11:34:32 -07:00
Dillon Kearns
e6c2031737 Rename Page builder functions. 2021-06-24 10:05:16 -07:00
Dillon Kearns
bc78f9cb1f Format elm compiler errors in terminal. 2021-06-24 08:53:26 -07:00
Dillon Kearns
22a3d88f63 Use OS-agnostic path delimter to split. 2021-06-24 07:38:12 -07:00
Dillon Kearns
66c6bf7063 Remove log statement in dev server. 2021-06-19 22:03:13 -07:00