elm-pages 3.0.0-beta.4 → 3.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/codegen/elm-pages-codegen.js +261 -153
  2. package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateData.elmi +0 -0
  3. package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
  4. package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
  5. package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
  6. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1 -1
  7. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Runner.elm.js +1 -1
  8. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
  9. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +4 -4
  10. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmi +0 -0
  11. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmi +0 -0
  12. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
  13. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
  14. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
  15. package/generator/review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1 -1
  16. package/generator/review/elm-stuff/tests-0.19.1/js/Runner.elm.js +1 -1
  17. package/generator/review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
  18. package/generator/review/elm-stuff/tests-0.19.1/js/node_supervisor.js +4 -4
  19. package/generator/src/build.js +18 -15
  20. package/generator/src/dev-server.js +17 -7
  21. package/generator/src/vite-utils.js +78 -0
  22. package/package.json +2 -2
  23. package/src/Pages/Generate.elm +445 -94
  24. package/src/Pages/Internal/Platform.elm +31 -24
@@ -423,9 +423,7 @@ update config appMsg model =
423
423
  )
424
424
 
425
425
  else
426
- ( { model
427
- | url = url
428
- }
426
+ ( model
429
427
  , NoEffect
430
428
  )
431
429
  -- TODO is it reasonable to always re-fetch route data if you re-navigate to the current route? Might be a good
@@ -605,27 +603,32 @@ update config appMsg model =
605
603
  , actionData = newActionData
606
604
  }
607
605
 
608
- ( userModel, _ ) =
606
+ ( userModel, userEffect ) =
609
607
  -- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
610
608
  -- instead of calling update, call pushUrl (I think?)
611
609
  -- TODO include user Cmd
612
- config.update model.pageFormState
613
- (model.inFlightFetchers |> toFetcherState)
614
- (model.transition |> Maybe.map Tuple.second)
615
- newSharedData
616
- newPageData
617
- model.key
618
- (config.onPageChange
619
- { protocol = model.url.protocol
620
- , host = model.url.host
621
- , port_ = model.url.port_
622
- , path = urlPathToPath urlWithoutRedirectResolution
623
- , query = urlWithoutRedirectResolution.query
624
- , fragment = urlWithoutRedirectResolution.fragment
625
- , metadata = config.urlToRoute urlWithoutRedirectResolution
626
- }
627
- )
628
- previousPageData.userModel
610
+ if stayingOnSamePath then
611
+ ( previousPageData.userModel, NoEffect )
612
+
613
+ else
614
+ config.update model.pageFormState
615
+ (model.inFlightFetchers |> toFetcherState)
616
+ (model.transition |> Maybe.map Tuple.second)
617
+ newSharedData
618
+ newPageData
619
+ model.key
620
+ (config.onPageChange
621
+ { protocol = model.url.protocol
622
+ , host = model.url.host
623
+ , port_ = model.url.port_
624
+ , path = urlPathToPath urlWithoutRedirectResolution
625
+ , query = urlWithoutRedirectResolution.query
626
+ , fragment = urlWithoutRedirectResolution.fragment
627
+ , metadata = config.urlToRoute urlWithoutRedirectResolution
628
+ }
629
+ )
630
+ previousPageData.userModel
631
+ |> Tuple.mapSecond UserCmd
629
632
 
630
633
  updatedModel : Model userModel pageData actionData sharedData
631
634
  updatedModel =
@@ -656,10 +659,13 @@ update config appMsg model =
656
659
  , currentPath = newUrl.path
657
660
  }
658
661
  , if not stayingOnSamePath && scrollToTopWhenDone then
659
- ScrollToTop
662
+ Batch
663
+ [ ScrollToTop
664
+ , userEffect
665
+ ]
660
666
 
661
667
  else
662
- NoEffect
668
+ userEffect
663
669
  )
664
670
  |> (case maybeUserMsg of
665
671
  Just userMsg ->
@@ -1392,7 +1398,8 @@ loadDataAndUpdateUrl ( newPageData, newSharedData, newActionData ) maybeUserMsg
1392
1398
  , actionData = newActionData
1393
1399
  }
1394
1400
 
1395
- ( userModel, _ ) =
1401
+ -- TODO use userEffect here?
1402
+ ( userModel, userEffect ) =
1396
1403
  -- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
1397
1404
  -- instead of calling update, call pushUrl (I think?)
1398
1405
  -- TODO include user Cmd