elm-pages 3.0.0-beta.25 → 3.0.0-beta.27
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 +1 -1
- package/codegen/elm-pages-codegen.cjs +88 -239
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateData.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateData.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateDataTest.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateDataTest.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Reporter.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Reporter.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/lock +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm.json +1 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +8000 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Runner.elm.js +27859 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +110 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +187 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/package.json +1 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/src/Reporter.elm +26 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/src/Runner.elm +62 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolationsTest.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolationsTest.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Reporter.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Reporter.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/lock +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm.json +1 -0
- package/generator/review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +8000 -0
- package/generator/review/elm-stuff/tests-0.19.1/js/Runner.elm.js +29601 -0
- package/generator/review/elm-stuff/tests-0.19.1/js/node_runner.js +110 -0
- package/generator/review/elm-stuff/tests-0.19.1/js/node_supervisor.js +187 -0
- package/generator/review/elm-stuff/tests-0.19.1/js/package.json +1 -0
- package/generator/review/elm-stuff/tests-0.19.1/src/Reporter.elm +26 -0
- package/generator/review/elm-stuff/tests-0.19.1/src/Runner.elm +62 -0
- package/generator/src/RouteBuilder.elm +5 -5
- package/generator/src/build.js +3 -3
- package/generator/src/cli.js +3 -3
- package/generator/src/codegen.js +1 -1
- package/generator/src/compatibility-key.js +2 -2
- package/generator/src/dev-server.js +2 -2
- package/generator/src/generate-template-module-connector.js +11 -9
- package/generator/src/init.js +2 -2
- package/generator/template/app/Route/Index.elm +2 -2
- package/package.json +6 -6
- package/src/Form/FieldView.elm +10 -26
- package/src/Form.elm +38 -23
- package/src/Pages/FormState.elm +6 -5
- package/src/Pages/{Msg.elm → Internal/Msg.elm} +26 -16
- package/src/Pages/Internal/Platform/Cli.elm +5 -5
- package/src/Pages/Internal/Platform/CompatibilityKey.elm +1 -1
- package/src/Pages/Internal/Platform.elm +22 -10
- package/src/Pages/ProgramConfig.elm +2 -2
- package/src/PagesMsg.elm +93 -0
- package/src/Pages/Internal/Platform/Cli.elm.bak +0 -1276
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const { parentPort } = require("worker_threads");
|
|
2
|
+
const { performance } = require("perf_hooks");
|
|
3
|
+
|
|
4
|
+
// From templates/polyfills.js
|
|
5
|
+
// Apply Node polyfills as necessary.
|
|
6
|
+
var window = {
|
|
7
|
+
Date: Date,
|
|
8
|
+
addEventListener: function () {},
|
|
9
|
+
removeEventListener: function () {},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var location = {
|
|
13
|
+
href: "",
|
|
14
|
+
host: "",
|
|
15
|
+
hostname: "",
|
|
16
|
+
protocol: "",
|
|
17
|
+
origin: "",
|
|
18
|
+
port: "",
|
|
19
|
+
pathname: "",
|
|
20
|
+
search: "",
|
|
21
|
+
hash: "",
|
|
22
|
+
username: "",
|
|
23
|
+
password: "",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var document = {
|
|
27
|
+
body: {},
|
|
28
|
+
createTextNode: function () {},
|
|
29
|
+
location: location,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var oldConsoleWarn = console.warn;
|
|
33
|
+
console.warn = function () {
|
|
34
|
+
if (
|
|
35
|
+
arguments.length === 1 &&
|
|
36
|
+
arguments[0].indexOf("Compiled in DEV mode") === 0
|
|
37
|
+
)
|
|
38
|
+
return;
|
|
39
|
+
return oldConsoleWarn.apply(console, arguments);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (typeof FileList === "undefined") {
|
|
43
|
+
var FileList = function () {};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof File === "undefined") {
|
|
47
|
+
var File = function () {};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof XMLHttpRequest === "undefined") {
|
|
51
|
+
var XMLHttpRequest = function () {
|
|
52
|
+
return {
|
|
53
|
+
addEventListener: function () {},
|
|
54
|
+
open: function () {},
|
|
55
|
+
send: function () {},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (typeof FormData === "undefined") {
|
|
61
|
+
var FormData = function () {
|
|
62
|
+
this._data = [];
|
|
63
|
+
};
|
|
64
|
+
FormData.prototype.append = function () {
|
|
65
|
+
this._data.push(Array.prototype.slice.call(arguments));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// Capture Debug.log from elm code
|
|
71
|
+
let logs = [];
|
|
72
|
+
console.elmlog = (str) => logs.push(str + "\n");
|
|
73
|
+
|
|
74
|
+
// Compiled by elm-test-rs from templates/Runner.elm
|
|
75
|
+
const { Elm } = require("./Runner.elm.js");
|
|
76
|
+
|
|
77
|
+
// Start the Elm app
|
|
78
|
+
const flags = { initialSeed: 1833568720, fuzzRuns: 100, filter: null };
|
|
79
|
+
const app = Elm.Runner.init({ flags: flags });
|
|
80
|
+
|
|
81
|
+
// Record the timing at which we received the last "runTest" message
|
|
82
|
+
let startTime;
|
|
83
|
+
|
|
84
|
+
// Communication from Supervisor to Elm runner via port
|
|
85
|
+
parentPort.on("message", (msg) => {
|
|
86
|
+
if (msg.type_ == "askTestsCount") {
|
|
87
|
+
app.ports.askTestsCount.send();
|
|
88
|
+
} else if (msg.type_ == "runTest") {
|
|
89
|
+
startTime = performance.now();
|
|
90
|
+
app.ports.receiveRunTest.send(msg.id);
|
|
91
|
+
} else {
|
|
92
|
+
console.error("Invalid supervisor msg.type_:", msg.type_);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Communication from Elm runner to Supervisor via port
|
|
97
|
+
// Subscribe to outgoing Elm ports defined in templates/Runner.elm
|
|
98
|
+
app.ports.sendResult.subscribe((msg) => {
|
|
99
|
+
msg.type_ = "testResult";
|
|
100
|
+
msg.duration = performance.now() - startTime;
|
|
101
|
+
msg.logs = logs;
|
|
102
|
+
parentPort.postMessage(msg);
|
|
103
|
+
logs.length = 0;
|
|
104
|
+
});
|
|
105
|
+
app.ports.sendTestsCount.subscribe((msg) => {
|
|
106
|
+
msg.type_ = "testsCount";
|
|
107
|
+
msg.logs = logs;
|
|
108
|
+
parentPort.postMessage(msg);
|
|
109
|
+
logs.length = 0;
|
|
110
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
process.chdir(__dirname);
|
|
2
|
+
|
|
3
|
+
// From templates/polyfills.js
|
|
4
|
+
// Apply Node polyfills as necessary.
|
|
5
|
+
var window = {
|
|
6
|
+
Date: Date,
|
|
7
|
+
addEventListener: function () {},
|
|
8
|
+
removeEventListener: function () {},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var location = {
|
|
12
|
+
href: "",
|
|
13
|
+
host: "",
|
|
14
|
+
hostname: "",
|
|
15
|
+
protocol: "",
|
|
16
|
+
origin: "",
|
|
17
|
+
port: "",
|
|
18
|
+
pathname: "",
|
|
19
|
+
search: "",
|
|
20
|
+
hash: "",
|
|
21
|
+
username: "",
|
|
22
|
+
password: "",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var document = {
|
|
26
|
+
body: {},
|
|
27
|
+
createTextNode: function () {},
|
|
28
|
+
location: location,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var oldConsoleWarn = console.warn;
|
|
32
|
+
console.warn = function () {
|
|
33
|
+
if (
|
|
34
|
+
arguments.length === 1 &&
|
|
35
|
+
arguments[0].indexOf("Compiled in DEV mode") === 0
|
|
36
|
+
)
|
|
37
|
+
return;
|
|
38
|
+
return oldConsoleWarn.apply(console, arguments);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (typeof FileList === "undefined") {
|
|
42
|
+
var FileList = function () {};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (typeof File === "undefined") {
|
|
46
|
+
var File = function () {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (typeof XMLHttpRequest === "undefined") {
|
|
50
|
+
var XMLHttpRequest = function () {
|
|
51
|
+
return {
|
|
52
|
+
addEventListener: function () {},
|
|
53
|
+
open: function () {},
|
|
54
|
+
send: function () {},
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (typeof FormData === "undefined") {
|
|
60
|
+
var FormData = function () {
|
|
61
|
+
this._data = [];
|
|
62
|
+
};
|
|
63
|
+
FormData.prototype.append = function () {
|
|
64
|
+
this._data.push(Array.prototype.slice.call(arguments));
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const { Worker } = require("worker_threads");
|
|
70
|
+
const readline = require("readline");
|
|
71
|
+
const { performance } = require("perf_hooks");
|
|
72
|
+
|
|
73
|
+
// Global variables
|
|
74
|
+
let testsCount, todoTests;
|
|
75
|
+
let reporter;
|
|
76
|
+
let runners = [];
|
|
77
|
+
let working = false;
|
|
78
|
+
let workersCount = 10;
|
|
79
|
+
let startWorkCallback = function(){};
|
|
80
|
+
const verbosity = 0;
|
|
81
|
+
|
|
82
|
+
// Create a long lived reporter worker
|
|
83
|
+
const { Elm } = require("./Reporter.elm.js");
|
|
84
|
+
const flags = {
|
|
85
|
+
initialSeed: 1833568720,
|
|
86
|
+
fuzzRuns: 100,
|
|
87
|
+
mode: "consoleColor",
|
|
88
|
+
verbosity: verbosity,
|
|
89
|
+
globs: [],
|
|
90
|
+
paths: ["/Users/dillonkearns/src/github.com/dillonkearns/elm-pages-v3-beta/generator/review/tests/Pages/Review/NoContractViolationsTest.elm"],
|
|
91
|
+
};
|
|
92
|
+
reporter = Elm.Reporter.init({ flags: flags });
|
|
93
|
+
|
|
94
|
+
// Pipe the Elm stdout port to stdout
|
|
95
|
+
reporter.ports.stdout.subscribe((str) => process.stdout.write(str));
|
|
96
|
+
|
|
97
|
+
// When the reporter has finished clean runners
|
|
98
|
+
reporter.ports.signalFinished.subscribe(async ({ exitCode, testsCount }) => {
|
|
99
|
+
await Promise.all(runners.map((runner) => runner.terminate()));
|
|
100
|
+
working = false;
|
|
101
|
+
startWorkCallback();
|
|
102
|
+
if (verbosity >= 1) {
|
|
103
|
+
console.warn("Running duration (since Node.js start):", Math.round(performance.now()), "ms\n");
|
|
104
|
+
}
|
|
105
|
+
process.exit(exitCode);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// When receiving a CLI message, start test workers
|
|
109
|
+
// The message is a string containing "/path/to/node_runner.js"
|
|
110
|
+
const rl = readline.createInterface({ input: process.stdin });
|
|
111
|
+
rl.on("line", (runnerFile) => {
|
|
112
|
+
working ? registerWork(runnerFile) : startWork(runnerFile);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
function registerWork(runnerFile) {
|
|
116
|
+
startWorkCallback = () => startWork(runnerFile);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function startWork(runnerFile) {
|
|
120
|
+
startWorkCallback = function(){};
|
|
121
|
+
working = true;
|
|
122
|
+
// Start first runner worker and prevent piped stdout and sdterr
|
|
123
|
+
runners[0] = new Worker(runnerFile, { stdout: true }); //, stderr: true });
|
|
124
|
+
runners[0].on("message", (msg) =>
|
|
125
|
+
handleRunnerMsg(runners[0], runnerFile, msg)
|
|
126
|
+
);
|
|
127
|
+
runners[0].on("online", () =>
|
|
128
|
+
runners[0].postMessage({ type_: "askTestsCount" })
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Handle a test result
|
|
133
|
+
function handleRunnerMsg(runner, runnerFile, msg) {
|
|
134
|
+
if (msg.type_ == "testsCount") {
|
|
135
|
+
if (msg.logs.length > 0) {
|
|
136
|
+
console.warn("Debug logs captured when setting up tests: -----------\n");
|
|
137
|
+
msg.logs.forEach((str) => process.stderr.write(str));
|
|
138
|
+
console.warn("\n------------------------------------------------------\n");
|
|
139
|
+
}
|
|
140
|
+
setupWithTestsCount(runnerFile, msg);
|
|
141
|
+
} else if (msg.type_ == "testResult") {
|
|
142
|
+
dispatchWork(runner, todoTests.pop());
|
|
143
|
+
reporter.ports.incomingResult.send(msg);
|
|
144
|
+
} else {
|
|
145
|
+
console.error("Invalid runner msg.type_:", msg.type_);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Reset supervisor tests count and reporter
|
|
150
|
+
// Start work on all runners
|
|
151
|
+
function setupWithTestsCount(runnerFile, msg) {
|
|
152
|
+
// Reset supervisor tests
|
|
153
|
+
testsCount = msg.testsCount;
|
|
154
|
+
todoTests = Array(testsCount)
|
|
155
|
+
.fill(0)
|
|
156
|
+
.map((_, id) => id)
|
|
157
|
+
.reverse();
|
|
158
|
+
|
|
159
|
+
// Reset reporter
|
|
160
|
+
reporter.ports.restart.send(msg);
|
|
161
|
+
|
|
162
|
+
// Send first runner job
|
|
163
|
+
if (testsCount == 0) {
|
|
164
|
+
console.error("No exposed values of type Test was found. Did you forget to expose them?");
|
|
165
|
+
return;
|
|
166
|
+
} else {
|
|
167
|
+
runners[0].postMessage({ type_: "runTest", id: todoTests.pop() });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Create and send work to all other workers.
|
|
171
|
+
let max_workers = Math.min(workersCount, testsCount);
|
|
172
|
+
for (let i = 1; i < max_workers; i++) {
|
|
173
|
+
let runner = new Worker(runnerFile); //, { stdout: true, stderr: true });
|
|
174
|
+
runners[i] = runner;
|
|
175
|
+
runner.on("message", (msg) =>
|
|
176
|
+
handleRunnerMsg(runner, runnerFile, msg)
|
|
177
|
+
);
|
|
178
|
+
runner.on("online", () => dispatchWork(runner, todoTests.pop()));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Ask runner to run some test.
|
|
183
|
+
function dispatchWork(runner, testId) {
|
|
184
|
+
if (testId != undefined) {
|
|
185
|
+
runner.postMessage({ type_: "runTest", id: testId });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "commonjs"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
port module Reporter exposing (main)
|
|
2
|
+
|
|
3
|
+
import ElmTestRunner.Reporter exposing (Flags, Model, Msg)
|
|
4
|
+
import Json.Decode exposing (Value)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
port restart : ({ kind : String, testsCount : Int } -> msg) -> Sub msg
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
port incomingResult : ({ duration : Float, result : Value, logs : List String } -> msg) -> Sub msg
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
port signalFinished : { exitCode : Int, testsCount : Int } -> Cmd msg
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
port stdout : String -> Cmd msg
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
main : Program Flags Model Msg
|
|
20
|
+
main =
|
|
21
|
+
ElmTestRunner.Reporter.worker
|
|
22
|
+
{ restart = restart
|
|
23
|
+
, incomingResult = incomingResult
|
|
24
|
+
, stdout = stdout
|
|
25
|
+
, signalFinished = signalFinished
|
|
26
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
port module Runner exposing (main)
|
|
2
|
+
|
|
3
|
+
import Pages.Review.NoContractViolationsTest
|
|
4
|
+
|
|
5
|
+
import ElmTestRunner.Runner exposing (Flags, Model, Msg)
|
|
6
|
+
import Json.Encode exposing (Value)
|
|
7
|
+
import Test exposing (Test)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
port askTestsCount : (Value -> msg) -> Sub msg
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
port sendTestsCount : { kind : String, testsCount : Int } -> Cmd msg
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
port receiveRunTest : (Int -> msg) -> Sub msg
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
port sendResult : { id : Int, result : Value } -> Cmd msg
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
{-| The implementation of this function will be replaced in the generated JS
|
|
23
|
+
with a version that returns `Just value` if `value` is a `Test`, otherwise `Nothing`.
|
|
24
|
+
If you rename or change this function you also need to update the regex that looks for it.
|
|
25
|
+
-}
|
|
26
|
+
check : a -> Maybe Test
|
|
27
|
+
check =
|
|
28
|
+
checkHelperReplaceMe___
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
checkHelperReplaceMe___ : a -> b
|
|
32
|
+
checkHelperReplaceMe___ _ =
|
|
33
|
+
Debug.todo """The regex for replacing this Debug.todo with some real code must have failed since you see this message!
|
|
34
|
+
|
|
35
|
+
Please report this bug: https://github.com/mpizenberg/elm-test-rs/issues/new
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
tests : List Test
|
|
40
|
+
tests =
|
|
41
|
+
[ check Pages.Review.NoContractViolationsTest.all ]
|
|
42
|
+
|> List.filterMap identity
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
main : Program Flags Model Msg
|
|
46
|
+
main =
|
|
47
|
+
let
|
|
48
|
+
concatenatedTest =
|
|
49
|
+
case tests of
|
|
50
|
+
[] ->
|
|
51
|
+
Nothing
|
|
52
|
+
|
|
53
|
+
_ ->
|
|
54
|
+
Just (Test.concat tests)
|
|
55
|
+
in
|
|
56
|
+
concatenatedTest
|
|
57
|
+
|> ElmTestRunner.Runner.worker
|
|
58
|
+
{ askTestsCount = askTestsCount
|
|
59
|
+
, sendTestsCount = sendTestsCount
|
|
60
|
+
, receiveRunTest = receiveRunTest
|
|
61
|
+
, sendResult = sendResult
|
|
62
|
+
}
|
|
@@ -97,7 +97,7 @@ import Pages.Fetcher
|
|
|
97
97
|
import Pages.FormState
|
|
98
98
|
import Pages.Internal.NotFoundReason exposing (NotFoundReason)
|
|
99
99
|
import Pages.Internal.RoutePattern exposing (RoutePattern)
|
|
100
|
-
import
|
|
100
|
+
import PagesMsg exposing (PagesMsg)
|
|
101
101
|
import Pages.PageUrl exposing (PageUrl)
|
|
102
102
|
import Pages.Transition
|
|
103
103
|
import Path exposing (Path)
|
|
@@ -117,7 +117,7 @@ type alias StatefulRoute routeParams data action model msg =
|
|
|
117
117
|
-> Shared.Model
|
|
118
118
|
-> model
|
|
119
119
|
-> StaticPayload data action routeParams
|
|
120
|
-
-> View (
|
|
120
|
+
-> View (PagesMsg msg)
|
|
121
121
|
, head :
|
|
122
122
|
StaticPayload data action routeParams
|
|
123
123
|
-> List Head.Tag
|
|
@@ -176,7 +176,7 @@ buildNoState :
|
|
|
176
176
|
Maybe PageUrl
|
|
177
177
|
-> Shared.Model
|
|
178
178
|
-> StaticPayload data action routeParams
|
|
179
|
-
-> View (
|
|
179
|
+
-> View (PagesMsg ())
|
|
180
180
|
}
|
|
181
181
|
-> Builder routeParams data action
|
|
182
182
|
-> StatefulRoute routeParams data action {} ()
|
|
@@ -212,7 +212,7 @@ buildWithLocalState :
|
|
|
212
212
|
-> Shared.Model
|
|
213
213
|
-> model
|
|
214
214
|
-> StaticPayload data action routeParams
|
|
215
|
-
-> View (
|
|
215
|
+
-> View (PagesMsg msg)
|
|
216
216
|
, init : Maybe PageUrl -> Shared.Model -> StaticPayload data action routeParams -> ( model, Effect msg )
|
|
217
217
|
, update : PageUrl -> Shared.Model -> StaticPayload data action routeParams -> msg -> model -> ( model, Effect msg )
|
|
218
218
|
, subscriptions : Maybe PageUrl -> routeParams -> Path -> Shared.Model -> model -> Sub msg
|
|
@@ -258,7 +258,7 @@ buildWithSharedState :
|
|
|
258
258
|
-> Shared.Model
|
|
259
259
|
-> model
|
|
260
260
|
-> StaticPayload data action routeParams
|
|
261
|
-
-> View (
|
|
261
|
+
-> View (PagesMsg msg)
|
|
262
262
|
, init : Maybe PageUrl -> Shared.Model -> StaticPayload data action routeParams -> ( model, Effect msg )
|
|
263
263
|
, update : PageUrl -> Shared.Model -> StaticPayload data action routeParams -> msg -> model -> ( model, Effect msg, Maybe Shared.Msg )
|
|
264
264
|
, subscriptions : Maybe PageUrl -> routeParams -> Path -> Shared.Model -> model -> Sub msg
|
package/generator/src/build.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as esbuild from "esbuild";
|
|
|
17
17
|
import { createHash } from "crypto";
|
|
18
18
|
import { merge_vite_configs } from "./vite-utils.js";
|
|
19
19
|
import { resolveConfig } from "./config.js";
|
|
20
|
-
import
|
|
20
|
+
import * as globby from "globby";
|
|
21
21
|
import { fileURLToPath } from "url";
|
|
22
22
|
import { copyFile } from "fs/promises";
|
|
23
23
|
|
|
@@ -166,7 +166,7 @@ export async function run(options) {
|
|
|
166
166
|
})
|
|
167
167
|
.catch((error) => {
|
|
168
168
|
const portBackendTaskFileFound =
|
|
169
|
-
globbySync("./custom-backend-task.*").length > 0;
|
|
169
|
+
globby.globbySync("./custom-backend-task.*").length > 0;
|
|
170
170
|
if (portBackendTaskFileFound) {
|
|
171
171
|
// don't present error if there are no files matching custom-backend-task
|
|
172
172
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
|
@@ -416,7 +416,7 @@ async function spawnElmMake(mode, options, elmEntrypointPath, outputPath, cwd) {
|
|
|
416
416
|
"function appendSubmitter (myFormData, event) { event.submitter && event.submitter.name && event.submitter.name.length > 0 ? myFormData.append(event.submitter.name, event.submitter.value) : myFormData; return myFormData }; return " +
|
|
417
417
|
(options.debug
|
|
418
418
|
? "_Json_wrap(Array.from(appendSubmitter(new FormData(_Json_unwrap(event).target), _Json_unwrap(event))))"
|
|
419
|
-
: "
|
|
419
|
+
: "[...(appendSubmitter(new FormData(event.target), event))]")
|
|
420
420
|
)
|
|
421
421
|
);
|
|
422
422
|
}
|
package/generator/src/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import * as fs from "node:fs";
|
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { restoreColorSafe } from "./error-formatter.js";
|
|
11
11
|
import * as renderer from "./render.js";
|
|
12
|
-
import
|
|
12
|
+
import * as globby from "globby";
|
|
13
13
|
import * as esbuild from "esbuild";
|
|
14
14
|
import { rewriteElmJson } from "./rewrite-elm-json.js";
|
|
15
15
|
import { ensureDirSync } from "./file-helpers.js";
|
|
@@ -148,7 +148,7 @@ async function main() {
|
|
|
148
148
|
})
|
|
149
149
|
.catch((error) => {
|
|
150
150
|
const portBackendTaskFileFound =
|
|
151
|
-
globbySync("./custom-backend-task.*").length > 0;
|
|
151
|
+
globby.globbySync("./custom-backend-task.*").length > 0;
|
|
152
152
|
if (portBackendTaskFileFound) {
|
|
153
153
|
// don't present error if there are no files matching custom-backend-task
|
|
154
154
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
|
@@ -247,7 +247,7 @@ async function main() {
|
|
|
247
247
|
);
|
|
248
248
|
// TODO allow no custom-backend-task
|
|
249
249
|
const portBackendTaskFileFound =
|
|
250
|
-
globbySync("./custom-backend-task.*").length > 0;
|
|
250
|
+
globby.globbySync("./custom-backend-task.*").length > 0;
|
|
251
251
|
|
|
252
252
|
const scriptRunner = `${
|
|
253
253
|
portBackendTaskFileFound
|
package/generator/src/codegen.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
-
import * as fsExtra from "fs-extra
|
|
2
|
+
import * as fsExtra from "fs-extra";
|
|
3
3
|
import { rewriteElmJson } from "./rewrite-elm-json.js";
|
|
4
4
|
import { rewriteClientElmJson } from "./rewrite-client-elm-json.js";
|
|
5
5
|
import { elmPagesCliFile, elmPagesUiFile } from "./elm-file-constants.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const compatibilityKey =
|
|
1
|
+
export const compatibilityKey = 11;
|
|
2
2
|
|
|
3
|
-
export const packageVersion = "3.0.0-beta.
|
|
3
|
+
export const packageVersion = "3.0.0-beta.27";
|
|
@@ -26,7 +26,7 @@ import * as esbuild from "esbuild";
|
|
|
26
26
|
import { merge_vite_configs } from "./vite-utils.js";
|
|
27
27
|
import { templateHtml } from "./pre-render-html.js";
|
|
28
28
|
import { resolveConfig } from "./config.js";
|
|
29
|
-
import
|
|
29
|
+
import * as globby from "globby";
|
|
30
30
|
import { fileURLToPath } from "url";
|
|
31
31
|
|
|
32
32
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -206,7 +206,7 @@ export async function start(options) {
|
|
|
206
206
|
});
|
|
207
207
|
} catch (e) {
|
|
208
208
|
const portBackendTaskFileFound =
|
|
209
|
-
globbySync("./custom-backend-task.*").length > 0;
|
|
209
|
+
globby.globbySync("./custom-backend-task.*").length > 0;
|
|
210
210
|
if (portBackendTaskFileFound) {
|
|
211
211
|
// don't present error if there are no files matching custom-backend-task
|
|
212
212
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as globby from "globby";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { default as mm } from "micromatch";
|
|
4
4
|
import * as routeHelpers from "./route-codegen-helpers.js";
|
|
@@ -10,14 +10,16 @@ import { fileURLToPath } from "url";
|
|
|
10
10
|
* @param {'browser' | 'cli'} phase
|
|
11
11
|
*/
|
|
12
12
|
export async function generateTemplateModuleConnector(basePath, phase) {
|
|
13
|
-
const templates =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const templates = globby
|
|
14
|
+
.globbySync(["app/Route/**/*.elm"], {})
|
|
15
|
+
.map((file) => {
|
|
16
|
+
const captures = mm.capture("app/Route/**/*.elm", file);
|
|
17
|
+
if (captures) {
|
|
18
|
+
return path.join(captures[0], captures[1]).split(path.sep);
|
|
19
|
+
} else {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
21
23
|
if (templates.length <= 0) {
|
|
22
24
|
throw {
|
|
23
25
|
path: "",
|
package/generator/src/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
|
-
import
|
|
2
|
+
import * as fsExtra from "fs-extra";
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import * as kleur from "kleur/colors";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
@@ -17,7 +17,7 @@ export async function run(name) {
|
|
|
17
17
|
|
|
18
18
|
if (!fs.existsSync(name)) {
|
|
19
19
|
try {
|
|
20
|
-
copySync(template, appRoot);
|
|
20
|
+
fsExtra.copySync(template, appRoot);
|
|
21
21
|
fs.renameSync(
|
|
22
22
|
path.resolve(appRoot, "gitignore"),
|
|
23
23
|
path.resolve(appRoot, ".gitignore")
|
|
@@ -6,7 +6,7 @@ import Head
|
|
|
6
6
|
import Head.Seo as Seo
|
|
7
7
|
import Html
|
|
8
8
|
import Html.Styled.Attributes as Attr
|
|
9
|
-
import
|
|
9
|
+
import PagesMsg exposing (PagesMsg)
|
|
10
10
|
import Pages.PageUrl exposing (PageUrl)
|
|
11
11
|
import Pages.Url
|
|
12
12
|
import Path
|
|
@@ -74,7 +74,7 @@ view :
|
|
|
74
74
|
Maybe PageUrl
|
|
75
75
|
-> Shared.Model
|
|
76
76
|
-> StaticPayload Data ActionData RouteParams
|
|
77
|
-
-> View (
|
|
77
|
+
-> View (PagesMsg Msg)
|
|
78
78
|
view maybeUrl sharedModel static =
|
|
79
79
|
{ title = "elm-pages is running"
|
|
80
80
|
, body =
|
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.27",
|
|
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,9 +34,9 @@
|
|
|
34
34
|
"devcert": "^1.2.2",
|
|
35
35
|
"elm-doc-preview": "^5.0.5",
|
|
36
36
|
"elm-hot": "^1.1.6",
|
|
37
|
-
"esbuild": "
|
|
37
|
+
"esbuild": "0.17.10",
|
|
38
38
|
"fs-extra": "^11.1.0",
|
|
39
|
-
"globby": "
|
|
39
|
+
"globby": "13.1.3",
|
|
40
40
|
"gray-matter": "^4.0.3",
|
|
41
41
|
"jsesc": "^3.0.2",
|
|
42
42
|
"kleur": "^4.1.5",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/cross-spawn": "^6.0.2",
|
|
53
|
-
"@types/fs-extra": "^
|
|
53
|
+
"@types/fs-extra": "^11.0.1",
|
|
54
54
|
"@types/make-fetch-happen": "^10.0.1",
|
|
55
55
|
"@types/micromatch": "^4.0.2",
|
|
56
56
|
"@types/node": "^18.11.9",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"elm-tooling": "^1.12.0",
|
|
64
64
|
"elm-verify-examples": "^5.2.0",
|
|
65
65
|
"elmi-to-json": "^1.2.0",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"typescript": "^4.9.5",
|
|
67
|
+
"vitest": "^0.28.5"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"generator/src/",
|