elm-pages 3.0.0-beta.22 → 3.0.0-beta.24

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.
package/README.md CHANGED
@@ -81,7 +81,7 @@ https://github.com/dillonkearns/elm-pages/projects
81
81
  You will see an error if the NPM and Elm package do not have a matching Compatibility Key. Usually it's best to upgrade to the latest version of both the Elm and NPM
82
82
  packages when you upgrade. However, in case you want to install versions that are behind the latest, the Compatibility Key is included here for reference.
83
83
 
84
- Current Compatibility Key: 7.
84
+ Current Compatibility Key: 8.
85
85
 
86
86
  ## Contributors ✨
87
87
 
@@ -1,3 +1,3 @@
1
- export const compatibilityKey = 7;
1
+ export const compatibilityKey = 8;
2
2
 
3
- export const packageVersion = "3.0.0-beta.22";
3
+ export const packageVersion = "3.0.0-beta.24";
@@ -265,6 +265,11 @@ export async function start(options) {
265
265
  watcher.on("all", async function (eventName, pathThatChanged) {
266
266
  if (pathThatChanged === "elm.json") {
267
267
  watchElmSourceDirs(false);
268
+ } else if (
269
+ pathThatChanged.startsWith("app/Route") &&
270
+ !pathThatChanged.endsWith(".elm")
271
+ ) {
272
+ // this happens when a folder is created in app/Route. Ignore this case.
268
273
  } else if (pathThatChanged.endsWith(".elm")) {
269
274
  invalidatePool();
270
275
  if (elmMakeRunning) {
@@ -82,8 +82,7 @@ async function handleEvent(sendContentJsonPort, evt) {
82
82
 
83
83
  try {
84
84
  await fetchContentJson;
85
- const elmJsResponse = await elmJsRequest;
86
- thenApplyHmr(elmJsResponse);
85
+ thenApplyHmr(await elmJsRequest);
87
86
  } catch (errorJson) {
88
87
  if (typeof errorJson === "string") {
89
88
  errorJson = JSON.parse(errorJson);
@@ -170,8 +169,7 @@ var myDisposeCallback = function () {
170
169
  var module = {
171
170
  hot: {
172
171
  accept: async function () {
173
- const sendInUpdatedContentJson = await updateAppContentJson;
174
- sendInUpdatedContentJson();
172
+ (await updateAppContentJson)();
175
173
  },
176
174
 
177
175
  dispose: function (callback) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elm-pages",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.22",
4
+ "version": "3.0.0-beta.24",
5
5
  "homepage": "https://elm-pages.com",
6
6
  "moduleResolution": "node",
7
7
  "description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
@@ -34,18 +34,18 @@
34
34
  "devcert": "^1.2.2",
35
35
  "elm-doc-preview": "^5.0.5",
36
36
  "elm-hot": "^1.1.6",
37
- "esbuild": "^0.17.5",
37
+ "esbuild": "^0.17.8",
38
38
  "fs-extra": "^11.1.0",
39
39
  "globby": "^13.1.3",
40
40
  "gray-matter": "^4.0.3",
41
41
  "jsesc": "^3.0.2",
42
42
  "kleur": "^4.1.5",
43
- "make-fetch-happen": "^11.0.2",
43
+ "make-fetch-happen": "^11.0.3",
44
44
  "memfs": "^3.4.7",
45
45
  "micromatch": "^4.0.5",
46
46
  "serve-static": "^1.15.0",
47
- "terser": "^5.16.1",
48
- "vite": "^4.0.4",
47
+ "terser": "^5.16.3",
48
+ "vite": "^4.1.1",
49
49
  "which": "^3.0.0"
50
50
  },
51
51
  "devDependencies": {
@@ -55,16 +55,16 @@
55
55
  "@types/micromatch": "^4.0.2",
56
56
  "@types/node": "^18.11.9",
57
57
  "@types/serve-static": "^1.15.0",
58
- "cypress": "^12.4.0",
58
+ "cypress": "^12.5.1",
59
59
  "elm-codegen": "^0.2.0",
60
60
  "elm-optimize-level-2": "^0.3.5",
61
61
  "elm-review": "^2.8.2",
62
62
  "elm-test": "^0.19.1-revision11",
63
- "elm-tooling": "^1.11.0",
63
+ "elm-tooling": "^1.12.0",
64
64
  "elm-verify-examples": "^5.2.0",
65
65
  "elmi-to-json": "^1.2.0",
66
66
  "mocha": "^10.2.0",
67
- "typescript": "^4.9.3"
67
+ "typescript": "^4.9.5"
68
68
  },
69
69
  "files": [
70
70
  "generator/src/",
@@ -3,4 +3,4 @@ module Pages.Internal.Platform.CompatibilityKey exposing (currentCompatibilityKe
3
3
 
4
4
  currentCompatibilityKey : Int
5
5
  currentCompatibilityKey =
6
- 7
6
+ 8
@@ -269,7 +269,7 @@ init config flags url key =
269
269
  , url = url
270
270
  , currentPath = url.path
271
271
  , pageData = Err "Not found"
272
- , ariaNavigationAnnouncement = "Error" -- TODO use error page title for announcement?
272
+ , ariaNavigationAnnouncement = "Page Not Found" -- TODO use error page title for announcement?
273
273
  , userFlags = flags
274
274
  , notFound = Just info
275
275
  , transition = Nothing
@@ -764,7 +764,86 @@ update config appMsg model =
764
764
  _ ->
765
765
  ( model, NoEffect )
766
766
  )
767
- |> Result.withDefault ( model, NoEffect )
767
+ |> Result.withDefault
768
+ (let
769
+ pageDataResult : Maybe (InitKind sharedData pageData actionData errorPage)
770
+ pageDataResult =
771
+ case Bytes.Decode.decode config.decodeResponse pageDataBytes of
772
+ Just (ResponseSketch.RenderPage _ _) ->
773
+ Nothing
774
+
775
+ Just (ResponseSketch.HotUpdate pageData shared actionData) ->
776
+ OkPage shared pageData actionData
777
+ |> Just
778
+
779
+ Just (ResponseSketch.NotFound notFound) ->
780
+ NotFound notFound
781
+ |> Just
782
+
783
+ _ ->
784
+ Nothing
785
+ in
786
+ case pageDataResult of
787
+ Just (OkPage sharedData pageData actionData) ->
788
+ let
789
+ urls : { currentUrl : Url, basePath : List String }
790
+ urls =
791
+ { currentUrl = model.url
792
+ , basePath = config.basePath
793
+ }
794
+
795
+ pagePath : Path
796
+ pagePath =
797
+ urlsToPagePath urls
798
+
799
+ userFlags : Pages.Flags.Flags
800
+ userFlags =
801
+ model.userFlags
802
+ |> Decode.decodeValue
803
+ (Decode.field "userFlags" Decode.value)
804
+ |> Result.withDefault Json.Encode.null
805
+ |> Pages.Flags.BrowserFlags
806
+
807
+ ( userModel, userCmd ) =
808
+ Just
809
+ { path =
810
+ { path = pagePath
811
+ , query = model.url.query
812
+ , fragment = model.url.fragment
813
+ }
814
+ , metadata = config.urlToRoute model.url
815
+ , pageUrl =
816
+ Just
817
+ { protocol = model.url.protocol
818
+ , host = model.url.host
819
+ , port_ = model.url.port_
820
+ , path = pagePath
821
+ , query = model.url.query |> Maybe.map QueryParams.fromString
822
+ , fragment = model.url.fragment
823
+ }
824
+ }
825
+ |> config.init userFlags sharedData pageData actionData
826
+
827
+ cmd : Effect userMsg pageData actionData sharedData userEffect errorPage
828
+ cmd =
829
+ UserCmd userCmd
830
+ in
831
+ ( { model
832
+ | pageData =
833
+ Ok
834
+ { userModel = userModel
835
+ , sharedData = sharedData
836
+ , pageData = pageData
837
+ , actionData = actionData
838
+ }
839
+ , notFound = Nothing
840
+ }
841
+ , cmd
842
+ )
843
+
844
+ _ ->
845
+ ( model, NoEffect )
846
+ )
768
847
 
769
848
  FetcherStarted fetcherKey transitionId fetcherData initiatedAt ->
770
849
  ( { model