Commit Graph

929 Commits

Author SHA1 Message Date
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
Dillon Kearns
127607961a Fix the require'd Elm code memory leak by moving the dev server's Elm module require into the top-level dev server code instead of the renderer. 2021-06-19 21:49:42 -07:00
Dillon Kearns
5949de3f2c Add finally to clean up Elm runtime after dev server responses are sent. 2021-06-19 21:40:19 -07:00
Dillon Kearns
7650ec4651 Remove {} arguments in empty route params in Route type. 2021-06-10 15:09:27 -07:00
Dillon Kearns
80974a8c38 Use empty list of routes for default generated page module. 2021-06-10 12:38:11 -07:00
Dillon Kearns
623db29656 Remove hardcoding in matched route params in 404 dev page. 2021-06-10 12:05:28 -07:00
Dillon Kearns
908e9a4243 Include more not found context. 2021-06-10 11:53:36 -07:00
Dillon Kearns
07bed53a79 Update NotFound view. 2021-06-09 10:52:54 -07:00
Dillon Kearns
e38c3bda3e Fix types for route params to string function. 2021-06-08 15:20:21 -07:00
Dillon Kearns
e719939c33 Generate Elm type representation of pre-rendered RouteParams. 2021-06-08 13:42:52 -07:00
Dillon Kearns
bf272c5768 Show list of pre-rendered route params for found routes but not pre-rendered. 2021-06-08 11:27:44 -07:00
Dillon Kearns
3668768919 Update not found page style. 2021-06-06 21:44:08 -07:00
Dillon Kearns
e9dd54c4b0 Update not found dev page. 2021-06-06 19:09:52 -07:00
Dillon Kearns
cffafc2171 Remove unnecessary destructuring in connector module that required View type to be a record with body and title. 2021-06-06 11:09:39 -07:00
Dillon Kearns
852a84d8bb Update not found page. 2021-06-06 11:04:06 -07:00
Dillon Kearns
498faf6b3a Add netlify.toml to init scaffolding. 2021-06-04 17:54:38 -07:00
Dillon Kearns
0840afbd5a Run elm-format on file. 2021-06-03 18:53:42 -07:00
Dillon Kearns
dcf3205092 Rename ServerRequest to be under DataSource namespace. 2021-06-03 17:27:28 -07:00
Dillon Kearns
f22abc904e Normalize splat field name correctly. 2021-06-03 16:01:54 -07:00
Dillon Kearns
2177d2bf1d Use lowerCamelCase for field names. 2021-06-03 11:58:35 -07:00
Dillon Kearns
9f93efd75c Generate route patterns JSON file for use with adapter js. 2021-06-02 11:02:35 -07:00
Dillon Kearns
0d9e62c09b Update pokedex render function to send 404 status. 2021-06-01 19:31:38 -07:00
Dillon Kearns
7de131ea82 Add extra data in Page module. 2021-06-01 14:21:19 -07:00
Dillon Kearns
cc316d5cd7 Add pokedex detail page. 2021-06-01 10:57:08 -07:00
Dillon Kearns
ac7dcaf5b2 Add a jsonFile data source. 2021-05-29 12:49:49 -07:00
Dillon Kearns
dcc5ad6458 Add elm-pages docs server to show local generated docs. 2021-05-28 11:37:03 -07:00
Dillon Kearns
034569475f Ensure that CLI errors propogate through to browser instead of infinitely reloading. 2021-05-25 11:06:10 -07:00
Dillon Kearns
badd971dbb Fix elm-pages add template code. 2021-05-24 19:09:55 -07:00
Dillon Kearns
8ccdf30399 Update template to refer to a path of a local git submodule. 2021-05-24 12:37:49 -07:00
Dillon Kearns
cf13fb21cf Update template project. 2021-05-24 12:33:13 -07:00
Dillon Kearns
86c3dac0fa Move generated browser-elm.js to an already ignored path. 2021-05-24 12:23:01 -07:00
Dillon Kearns
959487cda0 Wire up SharedModel and reconfigure some of the Page builder API. 2021-05-24 12:01:17 -07:00
Dillon Kearns
2ac7dd0b24 Wire up PageUrl. 2021-05-24 11:17:34 -07:00
Dillon Kearns
ab65e84eac Remove PagePath module. 2021-05-23 15:40:01 -07:00
Dillon Kearns
48dabe8673 Add Pages.Url and replace ImagePath with Pages.Url.Url type. 2021-05-23 15:11:46 -07:00
Dillon Kearns
a2bd42f617 Use Path instead of PagePath in Manifest API. 2021-05-23 10:53:01 -07:00
Dillon Kearns
dd70e0ae8c Replace some instances of PagePath with Path. 2021-05-23 10:43:53 -07:00
Dillon Kearns
366ca7ab80 Generate routeToPath without Maybe. 2021-05-23 10:20:09 -07:00
Dillon Kearns
d908d8d01c Rename Document -> View. 2021-05-23 09:00:20 -07:00
Dillon Kearns
e9d42d8a59 Add a basic JsPort DataSource wiring. Still not ready for production usage, but the basic wiring works. 2021-05-23 08:47:36 -07:00
Dillon Kearns
2d69c67dec Pass in DataSource with all routes to API Routes for use in generating files like Sitemap. 2021-05-22 18:56:16 -07:00
Dillon Kearns
92397dda44 Remove redundant closing tag and defer tag (module imports are deferred already without that tag). 2021-05-21 09:20:54 -07:00
Dillon Kearns
50c4c6d682 Vendor elm-html-in-elm in preparation for fixing text node HTML escaping. 2021-05-21 09:20:54 -07:00
Dillon Kearns
34c78d6bee Use new WHATWG URLs instead of deprecated url.parse. 2021-05-20 19:03:39 -07:00
Dillon Kearns
c389bce67f Don't try to do page navigation requests in dev server if there is a file extension. 2021-05-20 18:53:45 -07:00
Dillon Kearns
349108ad19 Update gitignored folder. 2021-05-19 07:53:59 -07:00
Dillon Kearns
fff155bc21 Generate files in .elm-pages instead of gen. Fixes #165. 2021-05-18 11:04:56 -07:00
Dillon Kearns
1aa737c431 Rename static/ -> public/. 2021-05-18 10:44:30 -07:00
Dillon Kearns
4b429bd945 Comment out garbage collection hint for now since it's causing error in dev server. Need to investigate. 2021-05-18 09:28:53 -07:00
Dillon Kearns
2a860a1936 Inline value. 2021-05-18 08:35:04 -07:00
Dillon Kearns
f3937241e4 Try making the compiled Elm garbage collectable by using the tip from https://gist.github.com/supermario/4c2615806c6c561a16edf5dd7208a759. 2021-05-18 06:53:04 -07:00
Dillon Kearns
246a9d8a06 Use the right logic for generating RouteParams in elm-pages add. 2021-05-18 06:52:23 -07:00
Dillon Kearns
62f1ac56f8 Remove Element import from elm-pages add template. 2021-05-18 06:31:16 -07:00
Dillon Kearns
12e5f88e10 Send message for clients to hot reload after deleting or adding a new route. 2021-05-17 18:35:51 -07:00
Dillon Kearns
9585e41d9a Clear glob cache entries when file paths change. 2021-05-17 17:15:04 -07:00
Dillon Kearns
82e0d34afd Add flags. 2021-05-17 12:51:04 -07:00
Dillon Kearns
7f4ad16aac Fix issue where build didn't exit properly when there was a compiler error. 2021-05-16 10:14:19 -07:00
Dillon Kearns
884a6f4553 Add missing doc comments to generated file. 2021-05-16 10:06:52 -07:00
Dillon Kearns
63e92e5790 Remove elm-tooling from scaffold in favor of using elm-tooling init. 2021-05-16 10:04:58 -07:00
Dillon Kearns
e309891be4 Remove unused code in template. 2021-05-15 21:35:10 -07:00
Dillon Kearns
b2e37861dc Remove unused dependencies in template. 2021-05-15 21:30:45 -07:00
Dillon Kearns
ff4baf06ba Wire up elm-pages init in cli. 2021-05-15 20:45:35 -07:00
Dillon Kearns
62a7399074 Move SiteConfig to copied files. 2021-05-15 20:38:29 -07:00
Dillon Kearns
62675b6a16 Move SharedTemplate to copied gen folder. 2021-05-15 20:07:11 -07:00
Dillon Kearns
8e17ba2787 Improve dev server start message and show it after initial setup. 2021-05-15 18:33:52 -07:00
Dillon Kearns
d052049212 Update starter template. 2021-05-15 18:20:24 -07:00
Dillon Kearns
7bc7ea2cc7 Simplify template. 2021-05-15 18:17:02 -07:00
Dillon Kearns
446c7998c2 Add Page module to template. 2021-05-15 16:26:58 -07:00
Dillon Kearns
16a3bb290f Run codegen for initial run. 2021-05-15 16:21:58 -07:00
Dillon Kearns
87dc17eb66 Add basic init script. 2021-05-15 16:08:13 -07:00
Dillon Kearns
33a10ede33 Add Route.link and Route.toLink helpers. 2021-05-15 10:36:34 -07:00
Dillon Kearns
d2bf1e1204 Add a prefetch attribute. 2021-05-14 19:33:52 -07:00
Dillon Kearns
4c1f70c060 Render manifest at build-time as well as in dev server. 2021-05-14 11:57:40 -07:00
Dillon Kearns
a23dab238b Rename fields. 2021-05-12 07:38:09 -07:00
Dillon Kearns
2fc032fed3 Fix regex pattern for optional route segments. 2021-05-07 07:23:41 -07:00
Dillon Kearns
efddae6bba Use standalone Api.elm module for ApiRoutes. 2021-05-06 10:08:12 -07:00
Dillon Kearns
4d175558ce Remove obsolete generateFiles. 2021-05-06 07:14:49 -07:00
Dillon Kearns
8a9e88bc0c Send 404s for file not found in dev server. 2021-05-05 20:38:59 -07:00
Dillon Kearns
939c307fc0 Update dev server static http cache on api route render. 2021-05-05 11:14:54 -07:00
Dillon Kearns
e2c960fcec Generate manifest.json through new ApiRoute wiring. 2021-05-05 10:57:49 -07:00
Dillon Kearns
4a7279ff7f Serve static folder and static code files before trying to run renderer. 2021-05-05 10:10:09 -07:00
Dillon Kearns
759a43c28b Remove console.time statements. 2021-05-04 20:09:40 -07:00
Dillon Kearns
16b15bf4a4 Wire in initial handling for api requests. 2021-05-04 10:37:37 -07:00
Dillon Kearns
4673565123 Handle index special case in new routeToPath. 2021-04-28 13:42:47 -07:00
Dillon Kearns
a0af3dba38 Remove log statements. 2021-04-28 12:57:50 -07:00
Dillon Kearns
eeea9aff05 Sort routes. 2021-04-28 12:57:16 -07:00
Dillon Kearns
a58dfd3a90 Handle optional splat routers. 2021-04-28 11:55:54 -07:00
Dillon Kearns
f2a212fc60 Handle splat routes. 2021-04-28 10:49:00 -07:00
Dillon Kearns
a0b12d16fd Remove unused function. 2021-04-28 08:35:31 -07:00
Dillon Kearns
da62ada1b9 Fix optional routing regex. 2021-04-28 08:28:31 -07:00
Dillon Kearns
80ffd029eb Use new custom router. 2021-04-27 16:53:20 -07:00
Dillon Kearns
5d8caf5d18 Update scaffold command. 2021-04-26 14:24:56 -07:00
Dillon Kearns
dff859ce08 Simplify handleRoute and remove Maybe wrapper. 2021-04-26 10:11:16 -07:00
Dillon Kearns
eb4f375f16 Update render function. 2021-04-25 21:06:16 -07:00
Dillon Kearns
94d12ce084 Remove unused require. 2021-04-25 20:47:27 -07:00
Dillon Kearns
597c6df357 Remove now obsolete captures data in Glob DataSource. 2021-04-25 20:45:17 -07:00
Dillon Kearns
5635566712 Add setup for elm-doc-preview. 2021-04-24 16:31:10 -07:00
Dillon Kearns
735bdeb2af Fix error in slides project. 2021-04-24 16:10:10 -07:00
Dillon Kearns
38d6b65477 Add serverless request Page builder. 2021-04-24 16:01:31 -07:00
Dillon Kearns
2b78dd89bc Add new Page builder API functions. 2021-04-24 12:47:22 -07:00
Dillon Kearns
6582aa9beb Add missing await. 2021-04-24 07:21:24 -07:00
Dillon Kearns
401f67aed9 Add 2nd terser pass to reduce filesize more. 2021-04-23 23:34:32 -07:00
Dillon Kearns
0d8cc96f74 Use another async variant. 2021-04-23 23:14:40 -07:00
Dillon Kearns
a26b495655 Remove blocking in build command. 2021-04-23 23:06:36 -07:00
Dillon Kearns
8d2b60b2de Remove some blocking commands. 2021-04-23 23:01:04 -07:00
Dillon Kearns
a6e2ab9506 Remove some more blocking commands in build. 2021-04-23 22:49:27 -07:00
Dillon Kearns
7584ce09ef Reduce blocking work in build command. 2021-04-23 22:43:50 -07:00
Dillon Kearns
b16d012670 Unexpose Shared.Msg variants. 2021-04-23 16:52:35 -07:00
Dillon Kearns
521c3c0cc7 Rename StaticData -> Data. 2021-04-23 16:22:23 -07:00
Dillon Kearns
559c4b6337 Rename top-level functions from template -> page. 2021-04-23 15:54:07 -07:00
Dillon Kearns
ba6a3c6af4 Rename Template modules -> Page modules. 2021-04-23 15:46:37 -07:00
Dillon Kearns
d01d8680f5 Use new SEO function with global head tags in render function. 2021-04-23 15:32:07 -07:00
Dillon Kearns
a2d17c26c8 Handle initial content.json errors with hot reloading. 2021-04-23 13:51:12 -07:00
Dillon Kearns
0e8f48bb72 Setup HMR when there is an error on initial load. 2021-04-23 11:37:33 -07:00
Dillon Kearns
1ea3a81316 Show error message when all Page Templates are removed. 2021-04-23 10:17:25 -07:00
Dillon Kearns
ef8728961d Add Head.rootLanguage. Fixes #157. 2021-04-23 08:00:05 -07:00
Dillon Kearns
bd2aeee542 Remove unused code. 2021-04-23 07:11:44 -07:00
Dillon Kearns
11267b5f62 Serve hmr.js from framework assets (not user static folder). 2021-04-22 21:25:02 -07:00
Dillon Kearns
827f4c8f7f Comment out log statement in build. 2021-04-22 16:33:53 -07:00
Dillon Kearns
4c9c365887 File read build errors. 2021-04-22 14:53:47 -07:00
Dillon Kearns
4bcfcbd358 Add doc comment. 2021-04-22 14:26:32 -07:00
Dillon Kearns
ad3eea32cb Remove unused imports. 2021-04-22 12:22:21 -07:00
Dillon Kearns
4e7075f908 Add type annotation. 2021-04-22 12:12:50 -07:00
Dillon Kearns
e0b403b2ea Remove unused function. 2021-04-22 12:12:22 -07:00
Dillon Kearns
d08d0e7ff0 Wire in static payload to init and update. 2021-04-22 11:31:06 -07:00