elm-pages 3.0.0-beta.31 → 3.0.0-beta.32
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/generator/src/cli.js
CHANGED
|
@@ -103,9 +103,11 @@ async function main() {
|
|
|
103
103
|
|
|
104
104
|
const portBackendTaskCompiled = esbuild
|
|
105
105
|
.build({
|
|
106
|
-
entryPoints: [
|
|
106
|
+
entryPoints: [
|
|
107
|
+
path.resolve(projectDirectory, "./custom-backend-task"),
|
|
108
|
+
],
|
|
107
109
|
platform: "node",
|
|
108
|
-
outfile: path.
|
|
110
|
+
outfile: path.resolve(
|
|
109
111
|
projectDirectory,
|
|
110
112
|
".elm-pages/compiled-ports/custom-backend-task.mjs"
|
|
111
113
|
),
|
|
@@ -126,14 +128,13 @@ async function main() {
|
|
|
126
128
|
})
|
|
127
129
|
.catch((error) => {
|
|
128
130
|
const portBackendTaskFileFound =
|
|
129
|
-
globby.globbySync(
|
|
131
|
+
globby.globbySync(
|
|
132
|
+
path.resolve(projectDirectory, "./custom-backend-task.*")
|
|
133
|
+
).length > 0;
|
|
130
134
|
if (portBackendTaskFileFound) {
|
|
131
135
|
// don't present error if there are no files matching custom-backend-task
|
|
132
136
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
|
133
|
-
console.error(
|
|
134
|
-
"Failed to start custom-backend-task watcher",
|
|
135
|
-
error
|
|
136
|
-
);
|
|
137
|
+
console.error("Failed to load custom-backend-task file.", error);
|
|
137
138
|
}
|
|
138
139
|
});
|
|
139
140
|
const portsPath = await portBackendTaskCompiled;
|
|
@@ -204,12 +205,12 @@ async function main() {
|
|
|
204
205
|
|
|
205
206
|
const portBackendTaskFileFound =
|
|
206
207
|
globby.globbySync(
|
|
207
|
-
path.
|
|
208
|
+
path.resolve(projectDirectory, "custom-backend-task.*")
|
|
208
209
|
).length > 0;
|
|
209
210
|
|
|
210
211
|
const scriptRunner = `${
|
|
211
212
|
portBackendTaskFileFound
|
|
212
|
-
? `import * as customBackendTask from "${path.
|
|
213
|
+
? `import * as customBackendTask from "${path.resolve(
|
|
213
214
|
projectDirectory,
|
|
214
215
|
"./custom-backend-task"
|
|
215
216
|
)}";`
|
|
@@ -52,10 +52,11 @@ export function resolveInputPathOrModuleName(inputPathOrModuleName) {
|
|
|
52
52
|
if (
|
|
53
53
|
/^[A-Z][a-zA-Z0-9_]*(\.[A-Z][a-zA-Z0-9_]*)*$/.test(inputPathOrModuleName)
|
|
54
54
|
) {
|
|
55
|
+
const absolutePathForScript = path.resolve("./script/src");
|
|
55
56
|
return {
|
|
56
57
|
moduleName: inputPathOrModuleName,
|
|
57
|
-
projectDirectory: "./script",
|
|
58
|
-
sourceDirectory: "./script/src",
|
|
58
|
+
projectDirectory: path.resolve("./script"),
|
|
59
|
+
sourceDirectory: path.resolve("./script/src"),
|
|
59
60
|
};
|
|
60
61
|
} else {
|
|
61
62
|
return getElmModuleName(inputPathOrModuleName);
|
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.
|
|
4
|
+
"version": "3.0.0-beta.32",
|
|
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.",
|
package/src/Scaffold/Form.elm
CHANGED
|
@@ -44,17 +44,7 @@ type alias Context =
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
{
|
|
48
|
-
formWithFields :
|
|
49
|
-
Bool
|
|
50
|
-
-> List ( String, Kind )
|
|
51
|
-
->
|
|
52
|
-
({ formState : Context
|
|
53
|
-
, params : List { name : String, kind : Kind, param : Elm.Expression }
|
|
54
|
-
}
|
|
55
|
-
-> Elm.Expression
|
|
56
|
-
)
|
|
57
|
-
-> { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression }
|
|
47
|
+
formWithFields : Bool -> List ( String, Kind ) -> ({ formState : { errors : Elm.Expression, isTransitioning : Elm.Expression, submitAttempted : Elm.Expression, data : Elm.Expression, expression : Elm.Expression }, params : List { name : String, kind : Kind, param : Elm.Expression } } -> Elm.Expression) -> { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
58
48
|
formWithFields elmCssView fields viewFn =
|
|
59
49
|
Elm.Declare.function "form"
|
|
60
50
|
[]
|
|
@@ -235,15 +225,11 @@ provide { fields, view, elmCssView } =
|
|
|
235
225
|
|
|
236
226
|
else
|
|
237
227
|
let
|
|
238
|
-
form : { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression }
|
|
228
|
+
form : { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
239
229
|
form =
|
|
240
230
|
formWithFields elmCssView fields view
|
|
241
231
|
|
|
242
|
-
formHandlersDeclaration :
|
|
243
|
-
{ declaration : Elm.Declaration
|
|
244
|
-
, call : List Elm.Expression -> Elm.Expression
|
|
245
|
-
, callFrom : List String -> List Elm.Expression -> Elm.Expression
|
|
246
|
-
}
|
|
232
|
+
formHandlersDeclaration : { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
247
233
|
formHandlersDeclaration =
|
|
248
234
|
-- TODO customizable formHandlers name?
|
|
249
235
|
Elm.Declare.function "formHandlers"
|
package/src/Scaffold/Route.elm
CHANGED
|
@@ -516,6 +516,7 @@ userFunction moduleName definitions =
|
|
|
516
516
|
{ declaration : Elm.Declaration
|
|
517
517
|
, call : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
518
518
|
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
519
|
+
, value : List String -> Elm.Expression
|
|
519
520
|
}
|
|
520
521
|
viewFn =
|
|
521
522
|
case definitions.localState of
|
|
@@ -545,6 +546,7 @@ userFunction moduleName definitions =
|
|
|
545
546
|
{ declaration : Elm.Declaration
|
|
546
547
|
, call : Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
547
548
|
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
549
|
+
, value : List String -> Elm.Expression
|
|
548
550
|
}
|
|
549
551
|
viewDeclaration =
|
|
550
552
|
Elm.Declare.fn2 "view"
|
|
@@ -568,6 +570,7 @@ userFunction moduleName definitions =
|
|
|
568
570
|
{ declaration = viewDeclaration.declaration
|
|
569
571
|
, call = \app shared _ -> viewDeclaration.call app shared
|
|
570
572
|
, callFrom = \a _ c d -> viewDeclaration.callFrom a c d
|
|
573
|
+
, value = viewDeclaration.value
|
|
571
574
|
}
|
|
572
575
|
|
|
573
576
|
localDefinitions :
|
|
@@ -576,9 +579,20 @@ userFunction moduleName definitions =
|
|
|
576
579
|
{ declaration : Elm.Declaration
|
|
577
580
|
, call : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
578
581
|
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
582
|
+
, value : List String -> Elm.Expression
|
|
583
|
+
}
|
|
584
|
+
, initFn :
|
|
585
|
+
{ declaration : Elm.Declaration
|
|
586
|
+
, call : Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
587
|
+
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
588
|
+
, value : List String -> Elm.Expression
|
|
589
|
+
}
|
|
590
|
+
, subscriptionsFn :
|
|
591
|
+
{ declaration : Elm.Declaration
|
|
592
|
+
, call : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
593
|
+
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
594
|
+
, value : List String -> Elm.Expression
|
|
579
595
|
}
|
|
580
|
-
, initFn : { declaration : Elm.Declaration, call : Elm.Expression -> Elm.Expression -> Elm.Expression, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression }
|
|
581
|
-
, subscriptionsFn : { declaration : Elm.Declaration, call : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression }
|
|
582
596
|
, state : State
|
|
583
597
|
}
|
|
584
598
|
localDefinitions =
|
|
@@ -626,7 +640,7 @@ userFunction moduleName definitions =
|
|
|
626
640
|
}
|
|
627
641
|
)
|
|
628
642
|
|
|
629
|
-
dataFn : { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression }
|
|
643
|
+
dataFn : { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
630
644
|
dataFn =
|
|
631
645
|
case definitions.action of
|
|
632
646
|
Pages Nothing ->
|
|
@@ -669,7 +683,7 @@ userFunction moduleName definitions =
|
|
|
669
683
|
Elm.unit
|
|
670
684
|
)
|
|
671
685
|
|
|
672
|
-
actionFn : Maybe { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression }
|
|
686
|
+
actionFn : Maybe { declaration : Elm.Declaration, call : List Elm.Expression -> Elm.Expression, callFrom : List String -> List Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
673
687
|
actionFn =
|
|
674
688
|
case definitions.action of
|
|
675
689
|
Action action_ ->
|
|
@@ -699,7 +713,7 @@ userFunction moduleName definitions =
|
|
|
699
713
|
(\_ -> justPagesExpression)
|
|
700
714
|
)
|
|
701
715
|
|
|
702
|
-
headFn : { declaration : Elm.Declaration, call : Elm.Expression -> Elm.Expression, callFrom : List String -> Elm.Expression -> Elm.Expression }
|
|
716
|
+
headFn : { declaration : Elm.Declaration, call : Elm.Expression -> Elm.Expression, callFrom : List String -> Elm.Expression -> Elm.Expression, value : List String -> Elm.Expression }
|
|
703
717
|
headFn =
|
|
704
718
|
Elm.Declare.fn "head"
|
|
705
719
|
( "app", Just appType )
|