Commit Graph

883 Commits

Author SHA1 Message Date
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