mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
commit
d4a8342888
2
codegen/.gitignore
vendored
2
codegen/.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
Gen/
|
Gen/
|
||||||
elm-pages-codegen.js
|
elm-pages-codegen.cjs
|
||||||
|
|
||||||
|
@ -3,11 +3,7 @@ import { defineConfig } from "cypress";
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
defaultCommandTimeout: 20000,
|
defaultCommandTimeout: 20000,
|
||||||
e2e: {
|
e2e: {
|
||||||
// We've imported your old cypress plugins here.
|
setupNodeEvents(on, config) {},
|
||||||
// You may want to clean this up later by importing these.
|
|
||||||
setupNodeEvents(on, config) {
|
|
||||||
return require("./cypress/plugins/index.js")(on, config);
|
|
||||||
},
|
|
||||||
baseUrl: "http://localhost:1234",
|
baseUrl: "http://localhost:1234",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/// <reference types="cypress" />
|
|
||||||
// ***********************************************************
|
|
||||||
// This example plugins/index.js can be used to load plugins
|
|
||||||
//
|
|
||||||
// You can change the location of this file or turn off loading
|
|
||||||
// the plugins file with the 'pluginsFile' configuration option.
|
|
||||||
//
|
|
||||||
// You can read more here:
|
|
||||||
// https://on.cypress.io/plugins-guide
|
|
||||||
// ***********************************************************
|
|
||||||
|
|
||||||
// This function is called when a project is opened or re-opened (e.g. due to
|
|
||||||
// the project's config changing)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Cypress.PluginConfig}
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
module.exports = (on, config) => {
|
|
||||||
// `on` is used to hook into various events Cypress emits
|
|
||||||
// `config` is the resolved Cypress config
|
|
||||||
}
|
|
2
elm.json
2
elm.json
@ -3,7 +3,7 @@
|
|||||||
"name": "dillonkearns/elm-pages-v3-beta",
|
"name": "dillonkearns/elm-pages-v3-beta",
|
||||||
"summary": "A statically typed site generator.",
|
"summary": "A statically typed site generator.",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"version": "10.0.0",
|
"version": "11.0.0",
|
||||||
"exposed-modules": [
|
"exposed-modules": [
|
||||||
"Head",
|
"Head",
|
||||||
"Head.Seo",
|
"Head.Seo",
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
v17.2.0
|
v19.2.0
|
||||||
|
|
||||||
|
@ -19,18 +19,18 @@ export default async function run({
|
|||||||
renderFunctionFilePath,
|
renderFunctionFilePath,
|
||||||
"./functions/server-render/elm-pages-cli.js"
|
"./functions/server-render/elm-pages-cli.js"
|
||||||
);
|
);
|
||||||
fs.copyFileSync(portsFilePath, "./functions/render/custom-backend-task.js");
|
fs.copyFileSync(portsFilePath, "./functions/render/custom-backend-task.mjs");
|
||||||
fs.copyFileSync(
|
fs.copyFileSync(
|
||||||
portsFilePath,
|
portsFilePath,
|
||||||
"./functions/server-render/custom-backend-task.js"
|
"./functions/server-render/custom-backend-task.mjs"
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
"./functions/render/index.js",
|
"./functions/render/index.mjs",
|
||||||
rendererCode(true, htmlTemplate)
|
rendererCode(true, htmlTemplate)
|
||||||
);
|
);
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
"./functions/server-render/index.js",
|
"./functions/server-render/index.mjs",
|
||||||
rendererCode(false, htmlTemplate)
|
rendererCode(false, htmlTemplate)
|
||||||
);
|
);
|
||||||
// TODO rename functions/render to functions/fallback-render
|
// TODO rename functions/render to functions/fallback-render
|
||||||
@ -103,18 +103,21 @@ function isServerSide(route) {
|
|||||||
* @param {string} htmlTemplate
|
* @param {string} htmlTemplate
|
||||||
*/
|
*/
|
||||||
function rendererCode(isOnDemand, htmlTemplate) {
|
function rendererCode(isOnDemand, htmlTemplate) {
|
||||||
return `const path = require("path");
|
return `import * as path from "path";
|
||||||
const busboy = require("busboy");
|
import * as busboy from "busboy";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
import * as renderer from "../../../../generator/src/render.js";
|
||||||
|
import * as preRenderHtml from "../../../../generator/src/pre-render-html.js";
|
||||||
const htmlTemplate = ${JSON.stringify(htmlTemplate)};
|
const htmlTemplate = ${JSON.stringify(htmlTemplate)};
|
||||||
|
|
||||||
${
|
${
|
||||||
isOnDemand
|
isOnDemand
|
||||||
? `const { builder } = require("@netlify/functions");
|
? `import { builder } from "@netlify/functions";
|
||||||
|
|
||||||
exports.handler = builder(render);`
|
export const handler = builder(render);`
|
||||||
: `
|
: `
|
||||||
|
|
||||||
exports.handler = render;`
|
export const handler = render;`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,12 +128,8 @@ exports.handler = render;`
|
|||||||
async function render(event, context) {
|
async function render(event, context) {
|
||||||
const requestTime = new Date();
|
const requestTime = new Date();
|
||||||
console.log(JSON.stringify(event));
|
console.log(JSON.stringify(event));
|
||||||
global.staticHttpCache = {};
|
const compiledPortsFile = "./custom-backend-task.mjs";
|
||||||
|
|
||||||
const compiledElmPath = path.join(__dirname, "elm-pages-cli.js");
|
|
||||||
const compiledPortsFile = path.join(__dirname, "custom-backend-task.js");
|
|
||||||
const renderer = require("../../../../generator/src/render");
|
|
||||||
const preRenderHtml = require("../../../../generator/src/pre-render-html");
|
|
||||||
try {
|
try {
|
||||||
const basePath = "/";
|
const basePath = "/";
|
||||||
const mode = "build";
|
const mode = "build";
|
||||||
@ -139,7 +138,7 @@ async function render(event, context) {
|
|||||||
const renderResult = await renderer.render(
|
const renderResult = await renderer.render(
|
||||||
compiledPortsFile,
|
compiledPortsFile,
|
||||||
basePath,
|
basePath,
|
||||||
require(compiledElmPath),
|
(await import("./elm-pages-cli.js")).default,
|
||||||
mode,
|
mode,
|
||||||
event.path,
|
event.path,
|
||||||
await reqToJson(event, requestTime),
|
await reqToJson(event, requestTime),
|
||||||
|
@ -39,7 +39,7 @@ type alias RouteParams =
|
|||||||
|
|
||||||
type alias ActionData =
|
type alias ActionData =
|
||||||
{ user : Maybe User
|
{ user : Maybe User
|
||||||
, formResponse : Maybe { fields : List ( String, String ), errors : Dict String (List String) }
|
, formResponse : Form.Response String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,16 +191,16 @@ action : RouteParams -> Parser (BackendTask FatalError (Server.Response.Response
|
|||||||
action routeParams =
|
action routeParams =
|
||||||
Request.formData (form |> Form.initCombined identity)
|
Request.formData (form |> Form.initCombined identity)
|
||||||
|> Request.map
|
|> Request.map
|
||||||
(\userResult ->
|
(\( response, userResult ) ->
|
||||||
(case userResult of
|
(case userResult of
|
||||||
Ok user ->
|
Ok user ->
|
||||||
{ user = Just user
|
{ user = Just user
|
||||||
, formResponse = Nothing
|
, formResponse = response
|
||||||
}
|
}
|
||||||
|
|
||||||
Err error ->
|
Err error ->
|
||||||
{ user = Nothing
|
{ user = Nothing
|
||||||
, formResponse = Just error
|
, formResponse = response
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|> Server.Response.render
|
|> Server.Response.render
|
||||||
@ -270,7 +270,7 @@ view maybeUrl sharedModel app =
|
|||||||
, Attr.style "flex-direction" "column"
|
, Attr.style "flex-direction" "column"
|
||||||
, Attr.style "gap" "20px"
|
, Attr.style "gap" "20px"
|
||||||
]
|
]
|
||||||
(app.action |> Maybe.andThen .formResponse)
|
(.formResponse >> Just)
|
||||||
app
|
app
|
||||||
defaultUser
|
defaultUser
|
||||||
]
|
]
|
||||||
|
@ -72,7 +72,7 @@ data routeParams =
|
|||||||
Request.oneOf
|
Request.oneOf
|
||||||
[ Request.formData (form |> Form.initCombined identity)
|
[ Request.formData (form |> Form.initCombined identity)
|
||||||
|> MySession.withSession
|
|> MySession.withSession
|
||||||
(\nameResult session ->
|
(\( formResponse, nameResult ) session ->
|
||||||
(nameResult
|
(nameResult
|
||||||
|> unpack
|
|> unpack
|
||||||
(\_ ->
|
(\_ ->
|
||||||
|
@ -104,7 +104,7 @@ data routeParams =
|
|||||||
Request.oneOf
|
Request.oneOf
|
||||||
[ Request.formData (form |> Form.initCombined identity)
|
[ Request.formData (form |> Form.initCombined identity)
|
||||||
|> Request.map
|
|> Request.map
|
||||||
(\formResult ->
|
(\( formResponse, formResult ) ->
|
||||||
BackendTask.succeed
|
BackendTask.succeed
|
||||||
(Response.render
|
(Response.render
|
||||||
{ results =
|
{ results =
|
||||||
@ -209,7 +209,7 @@ view maybeUrl sharedModel model static =
|
|||||||
|> Form.withGetMethod
|
|> Form.withGetMethod
|
||||||
|> Form.renderHtml []
|
|> Form.renderHtml []
|
||||||
-- TODO pass in server data
|
-- TODO pass in server data
|
||||||
Nothing
|
(\_ -> Nothing)
|
||||||
static
|
static
|
||||||
()
|
()
|
||||||
, static.data.results
|
, static.data.results
|
||||||
|
@ -60,6 +60,7 @@ route =
|
|||||||
action : RouteParams -> Request.Parser (BackendTask FatalError (Response ActionData ErrorPage))
|
action : RouteParams -> Request.Parser (BackendTask FatalError (Response ActionData ErrorPage))
|
||||||
action _ =
|
action _ =
|
||||||
(Request.formData (form |> Form.initCombined identity)
|
(Request.formData (form |> Form.initCombined identity)
|
||||||
|
|> Request.map Tuple.second
|
||||||
|> Request.map (Result.mapError (\error -> "Errors"))
|
|> Request.map (Result.mapError (\error -> "Errors"))
|
||||||
|> Request.andThen Request.fromResult
|
|> Request.andThen Request.fromResult
|
||||||
)
|
)
|
||||||
@ -270,7 +271,7 @@ view maybeUrl sharedModel model static =
|
|||||||
|> Form.toDynamicTransition "test1"
|
|> Form.toDynamicTransition "test1"
|
||||||
|> Form.renderHtml []
|
|> Form.renderHtml []
|
||||||
-- TODO pass in server data
|
-- TODO pass in server data
|
||||||
Nothing
|
(\_ -> Nothing)
|
||||||
static
|
static
|
||||||
()
|
()
|
||||||
]
|
]
|
||||||
|
@ -563,7 +563,7 @@ action routeParams =
|
|||||||
}
|
}
|
||||||
|> BackendTask.map Response.render
|
|> BackendTask.map Response.render
|
||||||
|
|
||||||
Err (Form.Response error) ->
|
Err error ->
|
||||||
BackendTask.succeed
|
BackendTask.succeed
|
||||||
{ flashMessage = Err "Got errors"
|
{ flashMessage = Err "Got errors"
|
||||||
, user = defaultUser
|
, user = defaultUser
|
||||||
@ -592,7 +592,7 @@ type alias Data =
|
|||||||
type alias ActionData =
|
type alias ActionData =
|
||||||
{ user : User
|
{ user : User
|
||||||
, flashMessage : Result String String
|
, flashMessage : Result String String
|
||||||
, formResponse : Maybe { fields : List ( String, String ), errors : Dict String (List String) }
|
, formResponse : Maybe (Form.Response String)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -722,9 +722,9 @@ view maybeUrl sharedModel model static =
|
|||||||
, form
|
, form
|
||||||
|> Form.toDynamicTransition "test"
|
|> Form.toDynamicTransition "test"
|
||||||
|> Form.renderStyledHtml []
|
|> Form.renderStyledHtml []
|
||||||
(static.action
|
--static.action
|
||||||
|> Maybe.andThen .formResponse
|
-- |> Maybe.andThen .formResponse
|
||||||
)
|
(\_ -> Nothing)
|
||||||
static
|
static
|
||||||
()
|
()
|
||||||
]
|
]
|
||||||
|
@ -12,3 +12,4 @@
|
|||||||
|
|
||||||
[functions]
|
[functions]
|
||||||
included_files = ["content/**"]
|
included_files = ["content/**"]
|
||||||
|
node_bundler = "esbuild"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// this middleware is only active when (config.base !== '/')
|
// this middleware is only active when (config.base !== '/')
|
||||||
|
|
||||||
module.exports = function baseMiddleware(base) {
|
export function baseMiddleware(base) {
|
||||||
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
||||||
return function viteBaseMiddleware(req, res, next) {
|
return function viteBaseMiddleware(req, res, next) {
|
||||||
// `req.url` only contains the path, since that is what gets passed in the HTTP request.
|
// `req.url` only contains the path, since that is what gets passed in the HTTP request.
|
||||||
@ -41,4 +41,4 @@ module.exports = function baseMiddleware(base) {
|
|||||||
|
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
const fs = require("./dir-helpers.js");
|
import * as fs from "./dir-helpers.js";
|
||||||
const fsPromises = require("fs").promises;
|
import * as fsPromises from "fs/promises";
|
||||||
|
import { runElmReview } from "./compile-elm.js";
|
||||||
const { runElmReview } = require("./compile-elm.js");
|
import { restoreColorSafe } from "./error-formatter.js";
|
||||||
const { restoreColorSafe } = require("./error-formatter");
|
import * as path from "path";
|
||||||
const path = require("path");
|
import { spawn as spawnCallback } from "cross-spawn";
|
||||||
const spawnCallback = require("cross-spawn").spawn;
|
import * as codegen from "./codegen.js";
|
||||||
const codegen = require("./codegen.js");
|
import * as terser from "terser";
|
||||||
const terser = require("terser");
|
import * as os from "os";
|
||||||
const os = require("os");
|
import { Worker, SHARE_ENV } from "worker_threads";
|
||||||
const { Worker, SHARE_ENV } = require("worker_threads");
|
import { ensureDirSync } from "./file-helpers.js";
|
||||||
const { ensureDirSync } = require("./file-helpers.js");
|
import { generateClientFolder } from "./codegen.js";
|
||||||
const { generateClientFolder } = require("./codegen.js");
|
import { default as which } from "which";
|
||||||
const which = require("which");
|
import { build } from "vite";
|
||||||
const { build } = require("vite");
|
import * as preRenderHtml from "./pre-render-html.js";
|
||||||
const preRenderHtml = require("./pre-render-html.js");
|
import * as esbuild from "esbuild";
|
||||||
const esbuild = require("esbuild");
|
import { createHash } from "crypto";
|
||||||
const { createHash } = require("crypto");
|
import { merge_vite_configs } from "./vite-utils.js";
|
||||||
const { merge_vite_configs } = require("./vite-utils.js");
|
import { resolveConfig } from "./config.js";
|
||||||
const { resolveConfig } = require("./config.js");
|
import { globbySync } from "globby";
|
||||||
const globby = require("globby");
|
import { fileURLToPath } from "url";
|
||||||
|
import { copyFile } from "fs/promises";
|
||||||
|
|
||||||
let pool = [];
|
let pool = [];
|
||||||
let pagesReady;
|
let pagesReady;
|
||||||
@ -65,7 +66,7 @@ async function ensureRequiredExecutables() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run(options) {
|
export async function run(options) {
|
||||||
try {
|
try {
|
||||||
await ensureRequiredDirs();
|
await ensureRequiredDirs();
|
||||||
await ensureRequiredExecutables();
|
await ensureRequiredExecutables();
|
||||||
@ -110,7 +111,11 @@ async function run(options) {
|
|||||||
withoutExtension
|
withoutExtension
|
||||||
);
|
);
|
||||||
const assetManifestPath = path.join(process.cwd(), "dist/manifest.json");
|
const assetManifestPath = path.join(process.cwd(), "dist/manifest.json");
|
||||||
const manifest = require(assetManifestPath);
|
const manifest = (
|
||||||
|
await import(assetManifestPath, {
|
||||||
|
assert: { type: "json" },
|
||||||
|
})
|
||||||
|
).default;
|
||||||
const indexTemplate = await fsPromises.readFile(
|
const indexTemplate = await fsPromises.readFile(
|
||||||
"dist/elm-stuff/elm-pages/index.html",
|
"dist/elm-stuff/elm-pages/index.html",
|
||||||
"utf-8"
|
"utf-8"
|
||||||
@ -161,7 +166,7 @@ async function run(options) {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const portBackendTaskFileFound =
|
const portBackendTaskFileFound =
|
||||||
globby.sync("./custom-backend-task.*").length > 0;
|
globbySync("./custom-backend-task.*").length > 0;
|
||||||
if (portBackendTaskFileFound) {
|
if (portBackendTaskFileFound) {
|
||||||
// don't present error if there are no files matching custom-backend-task
|
// don't present error if there are no files matching custom-backend-task
|
||||||
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
||||||
@ -170,7 +175,7 @@ async function run(options) {
|
|||||||
});
|
});
|
||||||
// TODO extract common code for compiling ports file?
|
// TODO extract common code for compiling ports file?
|
||||||
|
|
||||||
XMLHttpRequest = {};
|
global.XMLHttpRequest = {};
|
||||||
const compileCli = compileCliApp(options);
|
const compileCli = compileCliApp(options);
|
||||||
try {
|
try {
|
||||||
await compileCli;
|
await compileCli;
|
||||||
@ -207,6 +212,7 @@ async function run(options) {
|
|||||||
processedIndexTemplate
|
processedIndexTemplate
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.trace(error);
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(restoreColorSafe(error));
|
console.error(restoreColorSafe(error));
|
||||||
}
|
}
|
||||||
@ -220,6 +226,8 @@ async function run(options) {
|
|||||||
*/
|
*/
|
||||||
function initWorker(basePath, whenDone) {
|
function initWorker(basePath, whenDone) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
activeWorkers += 1;
|
activeWorkers += 1;
|
||||||
let newWorker = {
|
let newWorker = {
|
||||||
worker: new Worker(path.join(__dirname, "./render-worker.js"), {
|
worker: new Worker(path.join(__dirname, "./render-worker.js"), {
|
||||||
@ -369,7 +377,7 @@ function elmOptimizeLevel2(outputPath, cwd) {
|
|||||||
|
|
||||||
subprocess.on("close", async (code) => {
|
subprocess.on("close", async (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
await fs.copyFile(optimizedOutputPath, outputPath);
|
await copyFile(optimizedOutputPath, outputPath);
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
if (!buildError) {
|
if (!buildError) {
|
||||||
@ -539,7 +547,7 @@ async function runTerser(filePath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function compileCliApp(options) {
|
export async function compileCliApp(options) {
|
||||||
await spawnElmMake(
|
await spawnElmMake(
|
||||||
// TODO should be --optimize, but there seems to be an issue with the html to JSON with --optimize
|
// TODO should be --optimize, but there seems to be an issue with the html to JSON with --optimize
|
||||||
options.debug ? "debug" : "optimize",
|
options.debug ? "debug" : "optimize",
|
||||||
@ -595,7 +603,7 @@ function _HtmlAsJson_toJson(html) {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
await fsPromises.writeFile(
|
await fsPromises.writeFile(
|
||||||
ELM_FILE_PATH(),
|
ELM_FILE_PATH().replace(/\.js$/, ".cjs"),
|
||||||
elmFileContent
|
elmFileContent
|
||||||
.replace(
|
.replace(
|
||||||
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_JSON_STRINGIFY.\)/g,
|
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_JSON_STRINGIFY.\)/g,
|
||||||
@ -671,5 +679,3 @@ function defaultPreloadForFile(file) {
|
|||||||
* @param {string} contentJsonString
|
* @param {string} contentJsonString
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = { run, compileCliApp };
|
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const build = require("./build.js");
|
import * as build from "./build.js";
|
||||||
const dirHelpers = require("./dir-helpers.js");
|
import * as dev from "./dev-server.js";
|
||||||
const dev = require("./dev-server.js");
|
import * as init from "./init.js";
|
||||||
const init = require("./init.js");
|
import * as codegen from "./codegen.js";
|
||||||
const codegen = require("./codegen.js");
|
import * as fs from "fs";
|
||||||
const fs = require("fs");
|
import * as path from "path";
|
||||||
const path = require("path");
|
import { restoreColorSafe } from "./error-formatter.js";
|
||||||
const { restoreColorSafe } = require("./error-formatter");
|
import * as renderer from "./render.js";
|
||||||
const renderer = require("../../generator/src/render");
|
import { globbySync } from "globby";
|
||||||
const globby = require("globby");
|
import * as esbuild from "esbuild";
|
||||||
const esbuild = require("esbuild");
|
import { rewriteElmJson } from "./rewrite-elm-json.js";
|
||||||
const copyModifiedElmJson = require("./rewrite-elm-json.js");
|
import { ensureDirSync, deleteIfExists } from "./file-helpers.js";
|
||||||
const { ensureDirSync, deleteIfExists } = require("./file-helpers.js");
|
|
||||||
|
import * as commander from "commander";
|
||||||
|
import { runElmCodegenInstall } from "./elm-codegen.js";
|
||||||
|
|
||||||
const commander = require("commander");
|
|
||||||
const { runElmCodegenInstall } = require("./elm-codegen.js");
|
|
||||||
const Argument = commander.Argument;
|
const Argument = commander.Argument;
|
||||||
const Option = commander.Option;
|
const Option = commander.Option;
|
||||||
|
|
||||||
const packageVersion = require("../../package.json").version;
|
import * as packageJson from "../../package.json" assert { type: "json" };
|
||||||
|
const packageVersion = packageJson.version;
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const program = new commander.Command();
|
const program = new commander.Command();
|
||||||
@ -124,7 +126,7 @@ async function main() {
|
|||||||
path.join("./script/elm-stuff/elm-pages/.elm-pages/Main.elm"),
|
path.join("./script/elm-stuff/elm-pages/.elm-pages/Main.elm"),
|
||||||
generatorWrapperFile(moduleName)
|
generatorWrapperFile(moduleName)
|
||||||
);
|
);
|
||||||
await copyModifiedElmJson(
|
await rewriteElmJson(
|
||||||
"./script/elm.json",
|
"./script/elm.json",
|
||||||
"./script/elm-stuff/elm-pages/elm.json"
|
"./script/elm-stuff/elm-pages/elm.json"
|
||||||
);
|
);
|
||||||
@ -151,7 +153,7 @@ async function main() {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const portBackendTaskFileFound =
|
const portBackendTaskFileFound =
|
||||||
globby.sync("./custom-backend-task.*").length > 0;
|
globbySync("./custom-backend-task.*").length > 0;
|
||||||
if (portBackendTaskFileFound) {
|
if (portBackendTaskFileFound) {
|
||||||
// don't present error if there are no files matching custom-backend-task
|
// don't present error if there are no files matching custom-backend-task
|
||||||
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
||||||
@ -169,10 +171,14 @@ async function main() {
|
|||||||
// TODO have option for compiling with --debug or not (maybe allow running with elm-optimize-level-2 as well?)
|
// TODO have option for compiling with --debug or not (maybe allow running with elm-optimize-level-2 as well?)
|
||||||
await build.compileCliApp({ debug: "debug" });
|
await build.compileCliApp({ debug: "debug" });
|
||||||
process.chdir("../");
|
process.chdir("../");
|
||||||
|
fs.renameSync(
|
||||||
|
"./script/elm-stuff/elm-pages/elm.js",
|
||||||
|
"./script/elm-stuff/elm-pages/elm.cjs"
|
||||||
|
);
|
||||||
await renderer.runGenerator(
|
await renderer.runGenerator(
|
||||||
unprocessedCliOptions,
|
unprocessedCliOptions,
|
||||||
resolvedPortsPath,
|
resolvedPortsPath,
|
||||||
requireElm("./script/elm-stuff/elm-pages/elm.js"),
|
await requireElm("./script/elm-stuff/elm-pages/elm.cjs"),
|
||||||
moduleName
|
moduleName
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -187,7 +193,7 @@ async function main() {
|
|||||||
.option("--port <number>", "serve site at localhost:<port>", "8000")
|
.option("--port <number>", "serve site at localhost:<port>", "8000")
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
await codegen.generate("/");
|
await codegen.generate("/");
|
||||||
const DocServer = require("elm-doc-preview");
|
const DocServer = (await import("elm-doc-preview")).default;
|
||||||
const server = new DocServer({
|
const server = new DocServer({
|
||||||
port: options.port,
|
port: options.port,
|
||||||
browser: true,
|
browser: true,
|
||||||
@ -257,11 +263,11 @@ function normalizeUrl(rawPagePath) {
|
|||||||
/**
|
/**
|
||||||
* @param {string} compiledElmPath
|
* @param {string} compiledElmPath
|
||||||
*/
|
*/
|
||||||
function requireElm(compiledElmPath) {
|
async function requireElm(compiledElmPath) {
|
||||||
const warnOriginal = console.warn;
|
const warnOriginal = console.warn;
|
||||||
console.warn = function () {};
|
console.warn = function () {};
|
||||||
|
|
||||||
Elm = require(path.resolve(compiledElmPath));
|
let Elm = (await import(path.resolve(compiledElmPath))).default;
|
||||||
console.warn = warnOriginal;
|
console.warn = warnOriginal;
|
||||||
return Elm;
|
return Elm;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
const fsExtra = require("fs-extra");
|
import * as fsExtra from "fs-extra/esm";
|
||||||
const copyModifiedElmJson = require("./rewrite-elm-json.js");
|
import { rewriteElmJson } from "./rewrite-elm-json.js";
|
||||||
const copyModifiedElmJsonClient = require("./rewrite-client-elm-json.js");
|
import { rewriteClientElmJson } from "./rewrite-client-elm-json.js";
|
||||||
const { elmPagesCliFile, elmPagesUiFile } = require("./elm-file-constants.js");
|
import { elmPagesCliFile, elmPagesUiFile } from "./elm-file-constants.js";
|
||||||
const spawnCallback = require("cross-spawn").spawn;
|
import { spawn as spawnCallback } from "cross-spawn";
|
||||||
const which = require("which");
|
import { default as which } from "which";
|
||||||
const {
|
import { generateTemplateModuleConnector } from "./generate-template-module-connector.js";
|
||||||
generateTemplateModuleConnector,
|
|
||||||
} = require("./generate-template-module-connector.js");
|
import * as path from "path";
|
||||||
const path = require("path");
|
import { ensureDirSync, deleteIfExists } from "./file-helpers.js";
|
||||||
const { ensureDirSync, deleteIfExists } = require("./file-helpers.js");
|
import { fileURLToPath } from "url";
|
||||||
global.builtAt = new Date();
|
global.builtAt = new Date();
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} basePath
|
* @param {string} basePath
|
||||||
*/
|
*/
|
||||||
async function generate(basePath) {
|
export async function generate(basePath) {
|
||||||
const cliCode = await generateTemplateModuleConnector(basePath, "cli");
|
const cliCode = await generateTemplateModuleConnector(basePath, "cli");
|
||||||
const browserCode = await generateTemplateModuleConnector(
|
const browserCode = await generateTemplateModuleConnector(
|
||||||
basePath,
|
basePath,
|
||||||
@ -63,7 +66,7 @@ async function generate(basePath) {
|
|||||||
browserCode.fetcherModules
|
browserCode.fetcherModules
|
||||||
),
|
),
|
||||||
// write modified elm.json to elm-stuff/elm-pages/
|
// write modified elm.json to elm-stuff/elm-pages/
|
||||||
copyModifiedElmJson("./elm.json", "./elm-stuff/elm-pages/elm.json"),
|
rewriteElmJson("./elm.json", "./elm-stuff/elm-pages/elm.json"),
|
||||||
// ...(await listFiles("./Pages/Internal")).map(copyToBoth),
|
// ...(await listFiles("./Pages/Internal")).map(copyToBoth),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -85,7 +88,7 @@ async function newCopyBoth(modulePath) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateClientFolder(basePath) {
|
export async function generateClientFolder(basePath) {
|
||||||
const browserCode = await generateTemplateModuleConnector(
|
const browserCode = await generateTemplateModuleConnector(
|
||||||
basePath,
|
basePath,
|
||||||
"browser"
|
"browser"
|
||||||
@ -97,7 +100,7 @@ async function generateClientFolder(basePath) {
|
|||||||
await newCopyBoth("SharedTemplate.elm");
|
await newCopyBoth("SharedTemplate.elm");
|
||||||
await newCopyBoth("SiteConfig.elm");
|
await newCopyBoth("SiteConfig.elm");
|
||||||
|
|
||||||
await copyModifiedElmJsonClient();
|
await rewriteClientElmJson();
|
||||||
await fsExtra.copy("./app", "./elm-stuff/elm-pages/client/app", {
|
await fsExtra.copy("./app", "./elm-stuff/elm-pages/client/app", {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
@ -230,5 +233,3 @@ async function listFiles(dir) {
|
|||||||
function merge(arrays) {
|
function merge(arrays) {
|
||||||
return [].concat.apply([], arrays);
|
return [].concat.apply([], arrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { generate, generateClientFolder };
|
|
||||||
|
@ -1 +1 @@
|
|||||||
module.exports = { compatibilityKey: 6 };
|
export const compatibilityKey = 6;
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
const spawnCallback = require("cross-spawn").spawn;
|
import { spawn as spawnCallback } from "cross-spawn";
|
||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
const fsHelpers = require("./dir-helpers.js");
|
import * as fsHelpers from "./dir-helpers.js";
|
||||||
const fsPromises = require("fs").promises;
|
import * as fsPromises from "fs/promises";
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const kleur = require("kleur");
|
import * as kleur from "kleur/colors";
|
||||||
const { inject } = require("elm-hot");
|
import { inject } from "elm-hot";
|
||||||
const pathToClientElm = path.join(
|
import { fileURLToPath } from "url";
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
export async function compileElmForBrowser(options) {
|
||||||
|
// TODO do I need to make sure this is run from the right cwd? Before it was run outside of this function in the global scope, need to make sure that doesn't change semantics.
|
||||||
|
const pathToClientElm = path.join(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
"elm-stuff/elm-pages/",
|
"elm-stuff/elm-pages/",
|
||||||
"browser-elm.js"
|
"browser-elm.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
async function compileElmForBrowser(options) {
|
|
||||||
await runElm(options, "./.elm-pages/Main.elm", pathToClientElm);
|
await runElm(options, "./.elm-pages/Main.elm", pathToClientElm);
|
||||||
return fs.promises.writeFile(
|
return fs.promises.writeFile(
|
||||||
"./.elm-pages/cache/elm.js",
|
"./.elm-pages/cache/elm.js",
|
||||||
@ -26,7 +30,7 @@ async function compileElmForBrowser(options) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function compileCliApp(
|
export async function compileCliApp(
|
||||||
options,
|
options,
|
||||||
elmEntrypointPath,
|
elmEntrypointPath,
|
||||||
outputPath,
|
outputPath,
|
||||||
@ -79,7 +83,7 @@ function _HtmlAsJson_toJson(html) {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
await fsPromises.writeFile(
|
await fsPromises.writeFile(
|
||||||
readFrom,
|
readFrom.replace(/\.js$/, ".cjs"),
|
||||||
elmFileContent
|
elmFileContent
|
||||||
.replace(
|
.replace(
|
||||||
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_JSON_STRINGIFY.\)/g,
|
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_JSON_STRINGIFY.\)/g,
|
||||||
@ -211,7 +215,7 @@ async function runElm(options, elmEntrypointPath, outputPath, cwd) {
|
|||||||
/**
|
/**
|
||||||
* @param {string} [ cwd ]
|
* @param {string} [ cwd ]
|
||||||
*/
|
*/
|
||||||
async function runElmReview(cwd) {
|
export async function runElmReview(cwd) {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const child = spawnCallback(
|
const child = spawnCallback(
|
||||||
@ -284,12 +288,6 @@ function elmOptimizeLevel2(outputPath, cwd) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
compileElmForBrowser,
|
|
||||||
runElmReview,
|
|
||||||
compileCliApp,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} start
|
* @param {number} start
|
||||||
* @param {number} subtract
|
* @param {number} subtract
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const path = require("path");
|
import * as path from "path";
|
||||||
|
|
||||||
async function resolveConfig() {
|
export async function resolveConfig() {
|
||||||
const initialConfig = await await import(
|
const initialConfig = await await import(
|
||||||
path.join(process.cwd(), "elm-pages.config.mjs")
|
path.join(process.cwd(), "elm-pages.config.mjs")
|
||||||
)
|
)
|
||||||
@ -37,5 +37,3 @@ function defaultHeadTagsTemplate(context) {
|
|||||||
<meta name="generator" content="elm-pages v${context.cliVersion}" />
|
<meta name="generator" content="elm-pages v${context.cliVersion}" />
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { resolveConfig };
|
|
||||||
|
@ -1,40 +1,56 @@
|
|||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
const which = require("which");
|
import { default as which } from "which";
|
||||||
const chokidar = require("chokidar");
|
import * as chokidar from "chokidar";
|
||||||
const { URL } = require("url");
|
import { URL } from "url";
|
||||||
const {
|
import {
|
||||||
compileElmForBrowser,
|
compileElmForBrowser,
|
||||||
runElmReview,
|
runElmReview,
|
||||||
compileCliApp,
|
compileCliApp,
|
||||||
} = require("./compile-elm.js");
|
} from "./compile-elm.js";
|
||||||
const http = require("http");
|
import * as http from "http";
|
||||||
const https = require("https");
|
import * as https from "https";
|
||||||
const codegen = require("./codegen.js");
|
import * as codegen from "./codegen.js";
|
||||||
const kleur = require("kleur");
|
import * as kleur from "kleur/colors";
|
||||||
const serveStatic = require("serve-static");
|
import { default as serveStatic } from "serve-static";
|
||||||
const connect = require("connect");
|
import { default as connect } from "connect";
|
||||||
const { restoreColorSafe } = require("./error-formatter");
|
import { restoreColorSafe } from "./error-formatter.js";
|
||||||
const { Worker, SHARE_ENV } = require("worker_threads");
|
import { Worker, SHARE_ENV } from "worker_threads";
|
||||||
const os = require("os");
|
import * as os from "os";
|
||||||
const { ensureDirSync } = require("./file-helpers.js");
|
import { ensureDirSync } from "./file-helpers.js";
|
||||||
const baseMiddleware = require("./basepath-middleware.js");
|
import { baseMiddleware } from "./basepath-middleware.js";
|
||||||
const devcert = require("devcert");
|
import * as devcert from "devcert";
|
||||||
const busboy = require("busboy");
|
import * as busboy from "busboy";
|
||||||
const { createServer: createViteServer } = require("vite");
|
import { createServer as createViteServer } from "vite";
|
||||||
const cliVersion = require("../../package.json").version;
|
import * as esbuild from "esbuild";
|
||||||
const esbuild = require("esbuild");
|
import { merge_vite_configs } from "./vite-utils.js";
|
||||||
const { merge_vite_configs } = require("./vite-utils.js");
|
import { templateHtml } from "./pre-render-html.js";
|
||||||
const { templateHtml } = require("./pre-render-html.js");
|
import { resolveConfig } from "./config.js";
|
||||||
const { resolveConfig } = require("./config.js");
|
import { globbySync } from "globby";
|
||||||
const globby = require("globby");
|
import * as packageJson from "../../package.json" assert { type: "json" };
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const cliVersion = packageJson.version;
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{ port: string; base: string; https: boolean; debug: boolean; }} options
|
* @param {{ port: string; base: string; https: boolean; debug: boolean; }} options
|
||||||
*/
|
*/
|
||||||
async function start(options) {
|
export async function start(options) {
|
||||||
let threadReadyQueue = [];
|
let threadReadyQueue = [];
|
||||||
let pool = [];
|
let pool = [];
|
||||||
|
|
||||||
|
function restartPool() {
|
||||||
|
pool.forEach((thread) => thread.worker.terminate());
|
||||||
|
const poolSize = Math.max(1, cpuCount / 2 - 1);
|
||||||
|
pool = [];
|
||||||
|
|
||||||
|
for (let index = 0; index < poolSize; index++) {
|
||||||
|
pool.push(initWorker(options.base));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ensureDirSync(path.join(process.cwd(), ".elm-pages", "http-response-cache"));
|
ensureDirSync(path.join(process.cwd(), ".elm-pages", "http-response-cache"));
|
||||||
const cpuCount = os.cpus().length;
|
const cpuCount = os.cpus().length;
|
||||||
|
|
||||||
@ -46,6 +62,7 @@ async function start(options) {
|
|||||||
const serveCachedFiles = serveStatic(".elm-pages/cache", { index: false });
|
const serveCachedFiles = serveStatic(".elm-pages/cache", { index: false });
|
||||||
const generatedFilesDirectory = "elm-stuff/elm-pages/generated-files";
|
const generatedFilesDirectory = "elm-stuff/elm-pages/generated-files";
|
||||||
fs.mkdirSync(generatedFilesDirectory, { recursive: true });
|
fs.mkdirSync(generatedFilesDirectory, { recursive: true });
|
||||||
|
|
||||||
const serveStaticCode = serveStatic(
|
const serveStaticCode = serveStatic(
|
||||||
path.join(__dirname, "../static-code"),
|
path.join(__dirname, "../static-code"),
|
||||||
{}
|
{}
|
||||||
@ -175,7 +192,7 @@ async function start(options) {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const portBackendTaskFileFound =
|
const portBackendTaskFileFound =
|
||||||
globby.sync("./custom-backend-task.*").length > 0;
|
globbySync("./custom-backend-task.*").length > 0;
|
||||||
if (portBackendTaskFileFound) {
|
if (portBackendTaskFileFound) {
|
||||||
// don't present error if there are no files matching custom-backend-task
|
// don't present error if there are no files matching custom-backend-task
|
||||||
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
|
||||||
@ -246,6 +263,7 @@ async function start(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elmMakeRunning = true;
|
elmMakeRunning = true;
|
||||||
|
restartPool();
|
||||||
if (codegenError) {
|
if (codegenError) {
|
||||||
const errorJson = JSON.stringify({
|
const errorJson = JSON.stringify({
|
||||||
type: "compile-errors",
|
type: "compile-errors",
|
||||||
@ -784,4 +802,3 @@ function paramsToObject(entries) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
module.exports = { start };
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
const util = require("util");
|
import * as util from "util";
|
||||||
const fsSync = require("fs");
|
import * as fsSync from "fs";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
const fs = {
|
const fs = {
|
||||||
writeFile: util.promisify(fsSync.writeFile),
|
writeFile: util.promisify(fsSync.writeFile),
|
||||||
writeFileSync: fsSync.writeFileSync,
|
writeFileSync: fsSync.writeFileSync,
|
||||||
@ -15,14 +17,14 @@ const fs = {
|
|||||||
/**
|
/**
|
||||||
* @param {import("fs").PathLike} dirName
|
* @param {import("fs").PathLike} dirName
|
||||||
*/
|
*/
|
||||||
async function tryMkdir(dirName) {
|
export async function tryMkdir(dirName) {
|
||||||
const exists = await fs.exists(dirName);
|
const exists = await fs.exists(dirName);
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
await fs.mkdir(dirName, { recursive: true });
|
await fs.mkdir(dirName, { recursive: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileExists(file) {
|
export function fileExists(file) {
|
||||||
return fsSync.promises
|
return fsSync.promises
|
||||||
.access(file, fsSync.constants.F_OK)
|
.access(file, fsSync.constants.F_OK)
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
@ -33,18 +35,16 @@ function fileExists(file) {
|
|||||||
* @param {string} filePath
|
* @param {string} filePath
|
||||||
* @param {string} data
|
* @param {string} data
|
||||||
*/
|
*/
|
||||||
function writeFileSyncSafe(filePath, data) {
|
export function writeFileSyncSafe(filePath, data) {
|
||||||
fsSync.mkdirSync(path.dirname(filePath), { recursive: true });
|
fsSync.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||||
fs.writeFileSync(filePath, data);
|
fs.writeFileSync(filePath, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} srcDirectory
|
* @param {string} srcDirectory
|
||||||
* @param {string} destDir
|
* @param {string} destDir
|
||||||
*/
|
*/
|
||||||
async function copyDirFlat(srcDirectory, destDir) {
|
export async function copyDirFlat(srcDirectory, destDir) {
|
||||||
const items = await fs.readdir(srcDirectory);
|
const items = await fs.readdir(srcDirectory);
|
||||||
items.forEach(function (childItemName) {
|
items.forEach(function (childItemName) {
|
||||||
copyDirNested(
|
copyDirNested(
|
||||||
@ -58,7 +58,7 @@ async function copyDirFlat(srcDirectory, destDir) {
|
|||||||
* @param {string} src
|
* @param {string} src
|
||||||
* @param {string} dest
|
* @param {string} dest
|
||||||
*/
|
*/
|
||||||
async function copyDirNested(src, dest) {
|
export async function copyDirNested(src, dest) {
|
||||||
var exists = fsSync.existsSync(src);
|
var exists = fsSync.existsSync(src);
|
||||||
var stats = exists && fsSync.statSync(src);
|
var stats = exists && fsSync.statSync(src);
|
||||||
var isDirectory = exists && stats.isDirectory();
|
var isDirectory = exists && stats.isDirectory();
|
||||||
@ -76,19 +76,3 @@ async function copyDirNested(src, dest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
writeFile: fs.writeFile,
|
|
||||||
writeFileSync: fs.writeFileSync,
|
|
||||||
readFile: fs.readFile,
|
|
||||||
readFileSync: fsSync.readFileSync,
|
|
||||||
copyFile: fs.copyFile,
|
|
||||||
exists: fs.exists,
|
|
||||||
writeFileSyncSafe,
|
|
||||||
tryMkdir,
|
|
||||||
copyDirFlat,
|
|
||||||
copyDirNested,
|
|
||||||
rmSync: fs.rm,
|
|
||||||
rm: fs.rm,
|
|
||||||
existsSync: fs.existsSync,
|
|
||||||
fileExists: fileExists,
|
|
||||||
};
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const spawnCallback = require("cross-spawn").spawn;
|
import { spawn as spawnCallback } from "cross-spawn";
|
||||||
|
|
||||||
function runElmCodegenInstall() {
|
export function runElmCodegenInstall() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const subprocess = spawnCallback(`elm-codegen`, ["install"], {
|
const subprocess = spawnCallback(`elm-codegen`, ["install"], {
|
||||||
// ignore stdout
|
// ignore stdout
|
||||||
@ -33,5 +33,3 @@ function runElmCodegenInstall() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { runElmCodegenInstall };
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function elmPagesUiFile() {
|
export function elmPagesUiFile() {
|
||||||
return `module Pages exposing (builtAt)
|
return `module Pages exposing (builtAt)
|
||||||
|
|
||||||
import Time
|
import Time
|
||||||
@ -12,7 +12,6 @@ builtAt =
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function elmPagesCliFile() {
|
export function elmPagesCliFile() {
|
||||||
return elmPagesUiFile();
|
return elmPagesUiFile();
|
||||||
}
|
}
|
||||||
module.exports = { elmPagesUiFile, elmPagesCliFile };
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
const kleur = require("kleur");
|
"use strict";
|
||||||
|
|
||||||
|
import * as kleur from "kleur/colors";
|
||||||
|
|
||||||
/* Thanks to elm-live for this code!
|
/* Thanks to elm-live for this code!
|
||||||
https://github.com/wking-io/elm-live/blob/e317b4914c471addea7243c47f28dcebe27a5d36/lib/src/build.js#L65
|
https://github.com/wking-io/elm-live/blob/e317b4914c471addea7243c47f28dcebe27a5d36/lib/src/build.js#L65
|
||||||
@ -82,7 +84,7 @@ function toKleurColor(color) {
|
|||||||
/**
|
/**
|
||||||
* @param {RootObject} error
|
* @param {RootObject} error
|
||||||
* */
|
* */
|
||||||
const restoreColor = (error) => {
|
export const restoreColor = (error) => {
|
||||||
try {
|
try {
|
||||||
if (error.type === "compile-errors") {
|
if (error.type === "compile-errors") {
|
||||||
return error.errors
|
return error.errors
|
||||||
@ -111,7 +113,7 @@ const restoreColor = (error) => {
|
|||||||
* @param {string} error
|
* @param {string} error
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function restoreColorSafe(error) {
|
export function restoreColorSafe(error) {
|
||||||
try {
|
try {
|
||||||
if (typeof error === "string") {
|
if (typeof error === "string") {
|
||||||
const asJson = JSON.parse(error);
|
const asJson = JSON.parse(error);
|
||||||
@ -149,8 +151,6 @@ const restoreProblem =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { restoreColor, restoreColorSafe };
|
|
||||||
|
|
||||||
/** @typedef { CompilerError | ReportError | IElmReviewError } RootObject */
|
/** @typedef { CompilerError | ReportError | IElmReviewError } RootObject */
|
||||||
|
|
||||||
/** @typedef { { type: "compile-errors"; errors: Error_[]; } } CompilerError */
|
/** @typedef { { type: "compile-errors"; errors: Error_[]; } } CompilerError */
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
module.exports = { ensureDirSync, deleteIfExists };
|
|
||||||
|
|
||||||
function ensureDirSync(dirpath) {
|
export function ensureDirSync(dirpath) {
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(dirpath, { recursive: true });
|
fs.mkdirSync(dirpath, { recursive: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -9,7 +8,7 @@ function ensureDirSync(dirpath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteIfExists(/** @type string */ filePath) {
|
export function deleteIfExists(/** @type string */ filePath) {
|
||||||
if (fs.existsSync(filePath)) {
|
if (fs.existsSync(filePath)) {
|
||||||
fs.unlinkSync(filePath);
|
fs.unlinkSync(filePath);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
const globby = require("globby");
|
import { globbySync } from "globby";
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const mm = require("micromatch");
|
import { default as mm } from "micromatch";
|
||||||
const routeHelpers = require("./route-codegen-helpers");
|
import * as routeHelpers from "./route-codegen-helpers.js";
|
||||||
const { runElmCodegenInstall } = require("./elm-codegen");
|
import { restoreColorSafe } from "./error-formatter.js";
|
||||||
const { compileCliApp } = require("./compile-elm");
|
import { fileURLToPath } from "url";
|
||||||
const { restoreColorSafe } = require("./error-formatter");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} basePath
|
* @param {string} basePath
|
||||||
* @param {'browser' | 'cli'} phase
|
* @param {'browser' | 'cli'} phase
|
||||||
*/
|
*/
|
||||||
async function generateTemplateModuleConnector(basePath, phase) {
|
export async function generateTemplateModuleConnector(basePath, phase) {
|
||||||
const templates = globby.sync(["app/Route/**/*.elm"], {}).map((file) => {
|
const templates = globbySync(["app/Route/**/*.elm"], {}).map((file) => {
|
||||||
const captures = mm.capture("app/Route/**/*.elm", file);
|
const captures = mm.capture("app/Route/**/*.elm", file);
|
||||||
if (captures) {
|
if (captures) {
|
||||||
return path.join(captures[0], captures[1]).split(path.sep);
|
return path.join(captures[0], captures[1]).split(path.sep);
|
||||||
@ -63,10 +62,12 @@ async function generateTemplateModuleConnector(basePath, phase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function runElmCodegenCli(templates, basePath, phase) {
|
async function runElmCodegenCli(templates, basePath, phase) {
|
||||||
const filePath = path.join(__dirname, `../../codegen/elm-pages-codegen.js`);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const filePath = path.join(__dirname, `../../codegen/elm-pages-codegen.cjs`);
|
||||||
|
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise(async (resolve, reject) => {
|
||||||
const elmPagesCodegen = require(filePath).Elm.Generate;
|
const elmPagesCodegen = (await import(filePath)).default.Elm.Generate;
|
||||||
|
|
||||||
const app = elmPagesCodegen.init({
|
const app = elmPagesCodegen.init({
|
||||||
flags: { templates: templates, basePath, phase },
|
flags: { templates: templates, basePath, phase },
|
||||||
@ -91,7 +92,7 @@ async function runElmCodegenCli(templates, basePath, phase) {
|
|||||||
* @param {string[][]} templates
|
* @param {string[][]} templates
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function sortTemplates(templates) {
|
export function sortTemplates(templates) {
|
||||||
return templates.sort((first, second) => {
|
return templates.sort((first, second) => {
|
||||||
const a = sortScore(first);
|
const a = sortScore(first);
|
||||||
const b = sortScore(second);
|
const b = sortScore(second);
|
||||||
@ -230,5 +231,3 @@ submit toMsg options =
|
|||||||
function camelToKebab(input) {
|
function camelToKebab(input) {
|
||||||
return input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
return input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { generateTemplateModuleConnector, sortTemplates };
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
const copySync = require("fs-extra").copySync;
|
import { copySync } from "fs-extra/esm";
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const kleur = require("kleur");
|
import * as kleur from "kleur/colors";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
async function run(name) {
|
export async function run(name) {
|
||||||
console.log("Creating " + name + " project...");
|
console.log("Creating " + name + " project...");
|
||||||
|
|
||||||
const appRoot = path.resolve(name.toString());
|
const appRoot = path.resolve(name.toString());
|
||||||
@ -36,5 +39,3 @@ async function run(name) {
|
|||||||
kleur.green("Project is successfully created in `" + appRoot + "`.")
|
kleur.green("Project is successfully created in `" + appRoot + "`.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { run };
|
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
const seo = require("./seo-renderer.js");
|
import * as seo from "./seo-renderer.js";
|
||||||
const cliVersion = require("../../package.json").version;
|
import * as packageJson from "../../package.json" assert { type: "json" };
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const cliVersion = packageJson.version;
|
||||||
|
|
||||||
/** @typedef { { head: any[]; errors: any[]; html: string; route: string; title: string; } } Arg */
|
/** @typedef { { head: any[]; errors: any[]; html: string; route: string; title: string; } } Arg */
|
||||||
/** @typedef { { tag : 'PageProgress'; args : Arg[] } } PageProgress */
|
/** @typedef { { tag : 'PageProgress'; args : Arg[] } } PageProgress */
|
||||||
|
|
||||||
function wrapHtml(basePath, fromElm, contentDatPayload) {
|
export function wrapHtml(basePath, fromElm, contentDatPayload) {
|
||||||
const seoData = seo.gather(fromElm.head);
|
const seoData = seo.gather(fromElm.head);
|
||||||
return {
|
return {
|
||||||
kind: "html-template",
|
kind: "html-template",
|
||||||
@ -21,7 +24,9 @@ function wrapHtml(basePath, fromElm, contentDatPayload) {
|
|||||||
* @param {boolean} devMode
|
* @param {boolean} devMode
|
||||||
* @param {(context: {cliVersion: string;}) => string} userHeadTagsTemplate
|
* @param {(context: {cliVersion: string;}) => string} userHeadTagsTemplate
|
||||||
*/
|
*/
|
||||||
function templateHtml(devMode, userHeadTagsTemplate) {
|
export function templateHtml(devMode, userHeadTagsTemplate) {
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
return /* html */ `<!DOCTYPE html>
|
return /* html */ `<!DOCTYPE html>
|
||||||
<!-- ROOT --><html lang="en">
|
<!-- ROOT --><html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -65,7 +70,7 @@ function indent(snippet) {
|
|||||||
/**
|
/**
|
||||||
* @param {string} processedTemplate
|
* @param {string} processedTemplate
|
||||||
*/
|
*/
|
||||||
function replaceTemplate(processedTemplate, info) {
|
export function replaceTemplate(processedTemplate, info) {
|
||||||
return processedTemplate
|
return processedTemplate
|
||||||
.replace(
|
.replace(
|
||||||
/<!--\s*PLACEHOLDER_HEAD_AND_DATA\s*-->/,
|
/<!--\s*PLACEHOLDER_HEAD_AND_DATA\s*-->/,
|
||||||
@ -76,9 +81,3 @@ function replaceTemplate(processedTemplate, info) {
|
|||||||
.replace(/<!--\s*PLACEHOLDER_HTML\s* -->/, info.html)
|
.replace(/<!--\s*PLACEHOLDER_HTML\s* -->/, info.html)
|
||||||
.replace(/<!-- ROOT -->\S*<html lang="en">/m, info.rootElement);
|
.replace(/<!-- ROOT -->\S*<html lang="en">/m, info.rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
wrapHtml,
|
|
||||||
templateHtml,
|
|
||||||
replaceTemplate,
|
|
||||||
};
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
const renderer = require("../../generator/src/render");
|
import * as renderer from "../../generator/src/render.js";
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const fs = require("./dir-helpers.js");
|
import * as fs from "./dir-helpers.js";
|
||||||
const compiledElmPath = path.join(process.cwd(), "elm-stuff/elm-pages/elm.js");
|
import { readFileSync, writeFileSync } from "fs";
|
||||||
const { parentPort, threadId, workerData } = require("worker_threads");
|
import { stat } from "fs/promises";
|
||||||
let Elm;
|
import { parentPort, threadId, workerData } from "worker_threads";
|
||||||
|
|
||||||
global.staticHttpCache = {};
|
|
||||||
|
|
||||||
async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
||||||
console.time(`${threadId} ${pathname}`);
|
console.time(`${threadId} ${pathname}`);
|
||||||
@ -13,7 +11,7 @@ async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
|||||||
const renderResult = await renderer.render(
|
const renderResult = await renderer.render(
|
||||||
portsFilePath,
|
portsFilePath,
|
||||||
workerData.basePath,
|
workerData.basePath,
|
||||||
requireElm(mode),
|
await requireElm(mode),
|
||||||
mode,
|
mode,
|
||||||
pathname,
|
pathname,
|
||||||
serverRequest,
|
serverRequest,
|
||||||
@ -42,20 +40,17 @@ async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
|||||||
console.timeEnd(`${threadId} ${pathname}`);
|
console.timeEnd(`${threadId} ${pathname}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function requireElm(mode) {
|
async function requireElm(mode) {
|
||||||
if (mode === "build") {
|
const compiledElmPath = path.join(
|
||||||
if (!Elm) {
|
process.cwd(),
|
||||||
|
"elm-stuff/elm-pages/elm.cjs"
|
||||||
|
);
|
||||||
|
let elmImportPath = compiledElmPath;
|
||||||
const warnOriginal = console.warn;
|
const warnOriginal = console.warn;
|
||||||
console.warn = function () {};
|
console.warn = function () {};
|
||||||
|
const Elm = (await import(elmImportPath)).default;
|
||||||
Elm = require(compiledElmPath);
|
|
||||||
console.warn = warnOriginal;
|
console.warn = warnOriginal;
|
||||||
}
|
|
||||||
return Elm;
|
return Elm;
|
||||||
} else {
|
|
||||||
delete require.cache[require.resolve(compiledElmPath)];
|
|
||||||
return require(compiledElmPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function outputString(
|
async function outputString(
|
||||||
@ -67,13 +62,13 @@ async function outputString(
|
|||||||
const args = fromElm;
|
const args = fromElm;
|
||||||
const normalizedRoute = args.route.replace(/index$/, "");
|
const normalizedRoute = args.route.replace(/index$/, "");
|
||||||
await fs.tryMkdir(`./dist/${normalizedRoute}`);
|
await fs.tryMkdir(`./dist/${normalizedRoute}`);
|
||||||
const template = await fs.readFileSync("./dist/template.html", "utf8");
|
const template = readFileSync("./dist/template.html", "utf8");
|
||||||
fs.writeFileSync(
|
writeFileSync(
|
||||||
`dist/${normalizedRoute}/index.html`,
|
`dist/${normalizedRoute}/index.html`,
|
||||||
renderTemplate(template, fromElm)
|
renderTemplate(template, fromElm)
|
||||||
);
|
);
|
||||||
args.contentDatPayload &&
|
args.contentDatPayload &&
|
||||||
fs.writeFileSync(
|
writeFileSync(
|
||||||
`dist/${normalizedRoute}/content.dat`,
|
`dist/${normalizedRoute}/content.dat`,
|
||||||
Buffer.from(args.contentDatPayload.buffer)
|
Buffer.from(args.contentDatPayload.buffer)
|
||||||
);
|
);
|
||||||
|
@ -1,24 +1,22 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const mm = require("micromatch");
|
import { default as mm } from "micromatch";
|
||||||
const matter = require("gray-matter");
|
import { default as matter } from "gray-matter";
|
||||||
const globby = require("globby");
|
import { globby } from "globby";
|
||||||
const fsPromises = require("fs").promises;
|
import * as fsPromises from "fs/promises";
|
||||||
const preRenderHtml = require("./pre-render-html.js");
|
import * as preRenderHtml from "./pre-render-html.js";
|
||||||
const { lookupOrPerform } = require("./request-cache.js");
|
import { lookupOrPerform } from "./request-cache.js";
|
||||||
const kleur = require("kleur");
|
import * as kleur from "kleur/colors";
|
||||||
const cookie = require("cookie-signature");
|
import * as cookie from "cookie-signature";
|
||||||
const { compatibilityKey } = require("./compatibility-key.js");
|
import { compatibilityKey } from "./compatibility-key.js";
|
||||||
kleur.enabled = true;
|
import * as fs from "fs";
|
||||||
|
|
||||||
process.on("unhandledRejection", (error) => {
|
process.on("unhandledRejection", (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
let foundErrors;
|
let foundErrors;
|
||||||
|
|
||||||
module.exports = { render, runGenerator };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} basePath
|
* @param {string} basePath
|
||||||
@ -29,7 +27,7 @@ module.exports = { render, runGenerator };
|
|||||||
* @param {boolean} hasFsAccess
|
* @param {boolean} hasFsAccess
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function render(
|
export async function render(
|
||||||
portsFile,
|
portsFile,
|
||||||
basePath,
|
basePath,
|
||||||
elmModule,
|
elmModule,
|
||||||
@ -39,12 +37,12 @@ async function render(
|
|||||||
addBackendTaskWatcher,
|
addBackendTaskWatcher,
|
||||||
hasFsAccess
|
hasFsAccess
|
||||||
) {
|
) {
|
||||||
const { fs, resetInMemoryFs } = require("./request-cache-fs.js")(hasFsAccess);
|
// const { fs, resetInMemoryFs } = require("./request-cache-fs.js")(hasFsAccess);
|
||||||
resetInMemoryFs();
|
// resetInMemoryFs();
|
||||||
foundErrors = false;
|
foundErrors = false;
|
||||||
// since init/update are never called in pre-renders, and BackendTask.Http is called using pure NodeJS HTTP fetching
|
// since init/update are never called in pre-renders, and BackendTask.Http is called using pure NodeJS HTTP fetching
|
||||||
// we can provide a fake HTTP instead of xhr2 (which is otherwise needed for Elm HTTP requests from Node)
|
// we can provide a fake HTTP instead of xhr2 (which is otherwise needed for Elm HTTP requests from Node)
|
||||||
XMLHttpRequest = {};
|
global.XMLHttpRequest = {};
|
||||||
const result = await runElmApp(
|
const result = await runElmApp(
|
||||||
portsFile,
|
portsFile,
|
||||||
basePath,
|
basePath,
|
||||||
@ -53,7 +51,6 @@ async function render(
|
|||||||
path,
|
path,
|
||||||
request,
|
request,
|
||||||
addBackendTaskWatcher,
|
addBackendTaskWatcher,
|
||||||
fs,
|
|
||||||
hasFsAccess
|
hasFsAccess
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
@ -66,19 +63,19 @@ async function render(
|
|||||||
* @param {any} portsFile
|
* @param {any} portsFile
|
||||||
* @param {string} scriptModuleName
|
* @param {string} scriptModuleName
|
||||||
*/
|
*/
|
||||||
async function runGenerator(
|
export async function runGenerator(
|
||||||
cliOptions,
|
cliOptions,
|
||||||
portsFile,
|
portsFile,
|
||||||
elmModule,
|
elmModule,
|
||||||
scriptModuleName
|
scriptModuleName
|
||||||
) {
|
) {
|
||||||
global.isRunningGenerator = true;
|
global.isRunningGenerator = true;
|
||||||
const { fs, resetInMemoryFs } = require("./request-cache-fs.js")(true);
|
// const { fs, resetInMemoryFs } = require("./request-cache-fs.js")(true);
|
||||||
resetInMemoryFs();
|
// resetInMemoryFs();
|
||||||
foundErrors = false;
|
foundErrors = false;
|
||||||
// since init/update are never called in pre-renders, and BackendTask.Http is called using pure NodeJS HTTP fetching
|
// since init/update are never called in pre-renders, and BackendTask.Http is called using pure NodeJS HTTP fetching
|
||||||
// we can provide a fake HTTP instead of xhr2 (which is otherwise needed for Elm HTTP requests from Node)
|
// we can provide a fake HTTP instead of xhr2 (which is otherwise needed for Elm HTTP requests from Node)
|
||||||
XMLHttpRequest = {};
|
global.XMLHttpRequest = {};
|
||||||
const result = await runGeneratorAppHelp(
|
const result = await runGeneratorAppHelp(
|
||||||
cliOptions,
|
cliOptions,
|
||||||
portsFile,
|
portsFile,
|
||||||
@ -87,7 +84,6 @@ async function runGenerator(
|
|||||||
scriptModuleName,
|
scriptModuleName,
|
||||||
"production",
|
"production",
|
||||||
"",
|
"",
|
||||||
fs,
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
@ -112,7 +108,6 @@ function runGeneratorAppHelp(
|
|||||||
scriptModuleName,
|
scriptModuleName,
|
||||||
mode,
|
mode,
|
||||||
pagePath,
|
pagePath,
|
||||||
fs,
|
|
||||||
hasFsAccess
|
hasFsAccess
|
||||||
) {
|
) {
|
||||||
const isDevServer = mode !== "build";
|
const isDevServer = mode !== "build";
|
||||||
@ -182,7 +177,6 @@ function runGeneratorAppHelp(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
patternsToWatch
|
patternsToWatch
|
||||||
);
|
);
|
||||||
@ -193,7 +187,6 @@ function runGeneratorAppHelp(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
requestToPerform
|
requestToPerform
|
||||||
);
|
);
|
||||||
@ -236,7 +229,6 @@ function runElmApp(
|
|||||||
pagePath,
|
pagePath,
|
||||||
request,
|
request,
|
||||||
addBackendTaskWatcher,
|
addBackendTaskWatcher,
|
||||||
fs,
|
|
||||||
hasFsAccess
|
hasFsAccess
|
||||||
) {
|
) {
|
||||||
const isDevServer = mode !== "build";
|
const isDevServer = mode !== "build";
|
||||||
@ -250,7 +242,6 @@ function runElmApp(
|
|||||||
.replace(/content\.dat\/?$/, "");
|
.replace(/content\.dat\/?$/, "");
|
||||||
|
|
||||||
const modifiedRequest = { ...request, path: route };
|
const modifiedRequest = { ...request, path: route };
|
||||||
// console.log("StaticHttp cache keys", Object.keys(global.staticHttpCache));
|
|
||||||
app = elmModule.Elm.Main.init({
|
app = elmModule.Elm.Main.init({
|
||||||
flags: {
|
flags: {
|
||||||
mode,
|
mode,
|
||||||
@ -284,9 +275,6 @@ function runElmApp(
|
|||||||
console.log(fromElm.value);
|
console.log(fromElm.value);
|
||||||
} else if (fromElm.tag === "ApiResponse") {
|
} else if (fromElm.tag === "ApiResponse") {
|
||||||
const args = fromElm.args[0];
|
const args = fromElm.args[0];
|
||||||
if (mode === "build") {
|
|
||||||
global.staticHttpCache = args.staticHttpCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
kind: "api-response",
|
kind: "api-response",
|
||||||
@ -296,10 +284,6 @@ function runElmApp(
|
|||||||
});
|
});
|
||||||
} else if (fromElm.tag === "PageProgress") {
|
} else if (fromElm.tag === "PageProgress") {
|
||||||
const args = fromElm.args[0];
|
const args = fromElm.args[0];
|
||||||
if (mode === "build") {
|
|
||||||
global.staticHttpCache = args.staticHttpCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBytes) {
|
if (isBytes) {
|
||||||
resolve({
|
resolve({
|
||||||
kind: "bytes",
|
kind: "bytes",
|
||||||
@ -331,7 +315,6 @@ function runElmApp(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
patternsToWatch
|
patternsToWatch
|
||||||
);
|
);
|
||||||
@ -342,7 +325,6 @@ function runElmApp(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
requestToPerform
|
requestToPerform
|
||||||
);
|
);
|
||||||
@ -415,7 +397,6 @@ async function runHttpJob(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
useCache
|
useCache
|
||||||
) {
|
) {
|
||||||
@ -474,7 +455,6 @@ async function runInternalJob(
|
|||||||
app,
|
app,
|
||||||
mode,
|
mode,
|
||||||
requestToPerform,
|
requestToPerform,
|
||||||
fs,
|
|
||||||
hasFsAccess,
|
hasFsAccess,
|
||||||
patternsToWatch
|
patternsToWatch
|
||||||
) {
|
) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const path = require("path");
|
import * as path from "path";
|
||||||
const kleur = require("kleur");
|
import * as fsPromises from "fs/promises";
|
||||||
const fsPromises = require("fs/promises");
|
import * as kleur from "kleur/colors";
|
||||||
|
import { default as makeFetchHappenOriginal } from "make-fetch-happen";
|
||||||
|
|
||||||
const defaultHttpCachePath = "./.elm-pages/http-cache";
|
const defaultHttpCachePath = "./.elm-pages/http-cache";
|
||||||
|
|
||||||
@ -13,8 +14,14 @@ const defaultHttpCachePath = "./.elm-pages/http-cache";
|
|||||||
* @param {boolean} hasFsAccess
|
* @param {boolean} hasFsAccess
|
||||||
* @returns {Promise<Response>}
|
* @returns {Promise<Response>}
|
||||||
*/
|
*/
|
||||||
function lookupOrPerform(portsFile, mode, rawRequest, hasFsAccess, useCache) {
|
export function lookupOrPerform(
|
||||||
const makeFetchHappen = require("make-fetch-happen").defaults({
|
portsFile,
|
||||||
|
mode,
|
||||||
|
rawRequest,
|
||||||
|
hasFsAccess,
|
||||||
|
useCache
|
||||||
|
) {
|
||||||
|
const makeFetchHappen = makeFetchHappenOriginal.defaults({
|
||||||
cache: mode === "build" ? "no-cache" : "default",
|
cache: mode === "build" ? "no-cache" : "default",
|
||||||
});
|
});
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
@ -29,7 +36,7 @@ function lookupOrPerform(portsFile, mode, rawRequest, hasFsAccess, useCache) {
|
|||||||
const portBackendTaskPath = path.resolve(portsFile);
|
const portBackendTaskPath = path.resolve(portsFile);
|
||||||
// On Windows, we need cannot use paths directly and instead must use a file:// URL.
|
// On Windows, we need cannot use paths directly and instead must use a file:// URL.
|
||||||
// portBackendTask = await require(url.pathToFileURL(portBackendTaskPath).href);
|
// portBackendTask = await require(url.pathToFileURL(portBackendTaskPath).href);
|
||||||
portBackendTask = require(portBackendTaskPath);
|
portBackendTask = await import(portBackendTaskPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
portBackendTaskImportError = e;
|
portBackendTaskImportError = e;
|
||||||
}
|
}
|
||||||
@ -270,5 +277,3 @@ async function canAccess(filePath) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { lookupOrPerform };
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
|
|
||||||
module.exports = async function () {
|
export async function rewriteClientElmJson() {
|
||||||
var elmJson = JSON.parse(
|
var elmJson = JSON.parse(
|
||||||
(await fs.promises.readFile("./elm.json")).toString()
|
(await fs.promises.readFile("./elm.json")).toString()
|
||||||
);
|
);
|
||||||
@ -9,11 +9,11 @@ module.exports = async function () {
|
|||||||
|
|
||||||
await writeFileIfChanged(
|
await writeFileIfChanged(
|
||||||
"./elm-stuff/elm-pages/client/elm.json",
|
"./elm-stuff/elm-pages/client/elm.json",
|
||||||
JSON.stringify(rewriteElmJson(elmJson))
|
JSON.stringify(rewriteClientElmJsonHelp(elmJson))
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
function rewriteElmJson(elmJson) {
|
function rewriteClientElmJsonHelp(elmJson) {
|
||||||
// The internal generated file will be at:
|
// The internal generated file will be at:
|
||||||
// ./elm-stuff/elm-pages/
|
// ./elm-stuff/elm-pages/
|
||||||
// So, we need to take the existing elmJson and
|
// So, we need to take the existing elmJson and
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const fs = require("fs");
|
import * as fs from "fs";
|
||||||
|
|
||||||
module.exports = async function (sourceElmJsonPath, targetElmJsonPath) {
|
export async function rewriteElmJson(sourceElmJsonPath, targetElmJsonPath) {
|
||||||
var elmJson = JSON.parse(
|
var elmJson = JSON.parse(
|
||||||
(await fs.promises.readFile(sourceElmJsonPath)).toString()
|
(await fs.promises.readFile(sourceElmJsonPath)).toString()
|
||||||
);
|
);
|
||||||
@ -9,11 +9,11 @@ module.exports = async function (sourceElmJsonPath, targetElmJsonPath) {
|
|||||||
|
|
||||||
await writeFileIfChanged(
|
await writeFileIfChanged(
|
||||||
targetElmJsonPath,
|
targetElmJsonPath,
|
||||||
JSON.stringify(rewriteElmJson(elmJson))
|
JSON.stringify(rewriteElmJsonHelp(elmJson))
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
function rewriteElmJson(elmJson) {
|
function rewriteElmJsonHelp(elmJson) {
|
||||||
// The internal generated file will be at:
|
// The internal generated file will be at:
|
||||||
// ./elm-stuff/elm-pages/
|
// ./elm-stuff/elm-pages/
|
||||||
// So, we need to take the existing elmJson and
|
// So, we need to take the existing elmJson and
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
*/
|
*/
|
||||||
function routeParams(name) {
|
export function routeParams(name) {
|
||||||
return name
|
return name
|
||||||
.map((section) => {
|
.map((section) => {
|
||||||
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)__?$/);
|
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)__?$/);
|
||||||
@ -17,7 +17,7 @@ function routeParams(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {Segment[]}
|
* @returns {Segment[]}
|
||||||
*/
|
*/
|
||||||
function parseRouteParams(name) {
|
export function parseRouteParams(name) {
|
||||||
return name.flatMap((section) => {
|
return name.flatMap((section) => {
|
||||||
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)(_?_?)$/);
|
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)(_?_?)$/);
|
||||||
const maybeParam = (routeParamMatch && routeParamMatch[1]) || "TODO";
|
const maybeParam = (routeParamMatch && routeParamMatch[1]) || "TODO";
|
||||||
@ -68,7 +68,7 @@ function parseRouteParams(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {( Segment | {kind: 'static'; name: string})[]}
|
* @returns {( Segment | {kind: 'static'; name: string})[]}
|
||||||
*/
|
*/
|
||||||
function parseRouteParamsWithStatic(name) {
|
export function parseRouteParamsWithStatic(name) {
|
||||||
return name.flatMap((section) => {
|
return name.flatMap((section) => {
|
||||||
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)(_?_?)$/);
|
const routeParamMatch = section.match(/([A-Z][A-Za-z0-9]*)(_?_?)$/);
|
||||||
const maybeParam = (routeParamMatch && routeParamMatch[1]) || "TODO";
|
const maybeParam = (routeParamMatch && routeParamMatch[1]) || "TODO";
|
||||||
@ -123,7 +123,7 @@ function parseRouteParamsWithStatic(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function routeVariantDefinition(name) {
|
export function routeVariantDefinition(name) {
|
||||||
const newLocal = parseRouteParams(name);
|
const newLocal = parseRouteParams(name);
|
||||||
if (newLocal.length == 0) {
|
if (newLocal.length == 0) {
|
||||||
return routeVariant(name);
|
return routeVariant(name);
|
||||||
@ -151,7 +151,7 @@ function routeVariantDefinition(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function toPathPattern(name) {
|
export function toPathPattern(name) {
|
||||||
return (
|
return (
|
||||||
"/" +
|
"/" +
|
||||||
parseRouteParamsWithStatic(name)
|
parseRouteParamsWithStatic(name)
|
||||||
@ -181,7 +181,7 @@ function toPathPattern(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
function toPathPatterns(name) {
|
export function toPathPatterns(name) {
|
||||||
const segments = parseRouteParamsWithStatic(name);
|
const segments = parseRouteParamsWithStatic(name);
|
||||||
|
|
||||||
const lastSegment = segments[segments.length - 1];
|
const lastSegment = segments[segments.length - 1];
|
||||||
@ -199,7 +199,7 @@ function toPathPatterns(name) {
|
|||||||
/**
|
/**
|
||||||
* @param {string[]} segments
|
* @param {string[]} segments
|
||||||
*/
|
*/
|
||||||
function joinPath(segments) {
|
export function joinPath(segments) {
|
||||||
const joined = segments.join("/");
|
const joined = segments.join("/");
|
||||||
if (joined.startsWith("/")) {
|
if (joined.startsWith("/")) {
|
||||||
return joined;
|
return joined;
|
||||||
@ -211,7 +211,7 @@ function joinPath(segments) {
|
|||||||
/**
|
/**
|
||||||
* @return {string[]}
|
* @return {string[]}
|
||||||
*/
|
*/
|
||||||
function newHelper(segments) {
|
export function newHelper(segments) {
|
||||||
return segments.map((param) => {
|
return segments.map((param) => {
|
||||||
switch (param.kind) {
|
switch (param.kind) {
|
||||||
case "static": {
|
case "static": {
|
||||||
@ -238,7 +238,7 @@ function newHelper(segments) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function toElmPathPattern(name) {
|
export function toElmPathPattern(name) {
|
||||||
const parsedSegments = parseRouteParamsWithStatic(name);
|
const parsedSegments = parseRouteParamsWithStatic(name);
|
||||||
|
|
||||||
const foundEndings = parsedSegments.flatMap((segment) => {
|
const foundEndings = parsedSegments.flatMap((segment) => {
|
||||||
@ -297,14 +297,14 @@ function toElmPathPattern(name) {
|
|||||||
* @param {string} input
|
* @param {string} input
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function camelToKebab(input) {
|
export function camelToKebab(input) {
|
||||||
return input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
return input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
*/
|
*/
|
||||||
function paramsRecord(name) {
|
export function paramsRecord(name) {
|
||||||
return `{ ${parseRouteParams(name).map((param) => {
|
return `{ ${parseRouteParams(name).map((param) => {
|
||||||
switch (param.kind) {
|
switch (param.kind) {
|
||||||
case "dynamic": {
|
case "dynamic": {
|
||||||
@ -326,7 +326,7 @@ function paramsRecord(name) {
|
|||||||
/**
|
/**
|
||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
*/
|
*/
|
||||||
function routeVariant(name) {
|
export function routeVariant(name) {
|
||||||
return `${name.join("__")}`;
|
return `${name.join("__")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,44 +334,29 @@ function routeVariant(name) {
|
|||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
* @param {string} paramsName
|
* @param {string} paramsName
|
||||||
*/
|
*/
|
||||||
function destructureRoute(name, paramsName) {
|
export function destructureRoute(name, paramsName) {
|
||||||
return emptyRouteParams(name)
|
return emptyRouteParams(name)
|
||||||
? `Route.${routeVariant(name)}`
|
? `Route.${routeVariant(name)}`
|
||||||
: `(Route.${routeVariant(name)} ${paramsName})`;
|
: `(Route.${routeVariant(name)} ${paramsName})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function referenceRouteParams(name, paramsName) {
|
export function referenceRouteParams(name, paramsName) {
|
||||||
return emptyRouteParams(name) ? `{}` : paramsName;
|
return emptyRouteParams(name) ? `{}` : paramsName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {string[]} name
|
* @param {string[]} name
|
||||||
*/
|
*/
|
||||||
function emptyRouteParams(name) {
|
export function emptyRouteParams(name) {
|
||||||
return parseRouteParams(name).length === 0;
|
return parseRouteParams(name).length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
function toFieldName(name) {
|
export function toFieldName(name) {
|
||||||
if (name === "SPLAT") {
|
if (name === "SPLAT") {
|
||||||
return "splat";
|
return "splat";
|
||||||
} else {
|
} else {
|
||||||
return name.charAt(0).toLowerCase() + name.slice(1);
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
routeParams,
|
|
||||||
routeVariantDefinition,
|
|
||||||
routeVariant,
|
|
||||||
toFieldName,
|
|
||||||
paramsRecord,
|
|
||||||
toPathPattern,
|
|
||||||
toPathPatterns,
|
|
||||||
parseRouteParams,
|
|
||||||
parseRouteParamsWithStatic,
|
|
||||||
toElmPathPattern,
|
|
||||||
destructureRoute,
|
|
||||||
referenceRouteParams,
|
|
||||||
};
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
module.exports = { gather };
|
|
||||||
|
|
||||||
/** @typedef { { type: 'root'; keyValuePair: [string, string] } } RootTagModifier */
|
/** @typedef { { type: 'root'; keyValuePair: [string, string] } } RootTagModifier */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {( SeoTag | RootTagModifier )[]} tags
|
* @param {( SeoTag | RootTagModifier )[]} tags
|
||||||
*/
|
*/
|
||||||
function gather(tags) {
|
export function gather(tags) {
|
||||||
const withoutRootModifiers = tags.flatMap((value) => {
|
const withoutRootModifiers = tags.flatMap((value) => {
|
||||||
if (value.type === "root") {
|
if (value.type === "root") {
|
||||||
return [];
|
return [];
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @param {...import('vite').UserConfig} configs
|
* @param {...import('vite').UserConfig} configs
|
||||||
* @returns {import('vite').UserConfig}
|
* @returns {import('vite').UserConfig}
|
||||||
*/
|
*/
|
||||||
function merge_vite_configs(...configs) {
|
export function merge_vite_configs(...configs) {
|
||||||
return deep_merge(
|
return deep_merge(
|
||||||
...configs.map((config) => ({
|
...configs.map((config) => ({
|
||||||
...config,
|
...config,
|
||||||
@ -75,4 +75,3 @@ function merge_into(a, b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = { merge_vite_configs };
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
var assert = require("assert");
|
import * as assert from "assert";
|
||||||
const { sortTemplates } = require("../src/generate-template-module-connector");
|
|
||||||
|
import { sortTemplates } from "../src/generate-template-module-connector.js";
|
||||||
describe("sort", function () {
|
describe("sort", function () {
|
||||||
it("purely static comes before dynamic routes", function () {
|
it("purely static comes before dynamic routes", function () {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
var assert = require("assert");
|
import * as assert from "assert";
|
||||||
const {
|
|
||||||
toPathPattern,
|
import { toPathPattern, toPathPatterns } from "../src/route-codegen-helpers.js";
|
||||||
toPathPatterns,
|
|
||||||
} = require("../src/route-codegen-helpers.js");
|
|
||||||
|
|
||||||
describe("toPathPattern", function () {
|
describe("toPathPattern", function () {
|
||||||
it("index is normalized", function () {
|
it("index is normalized", function () {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"module": "commonjs",
|
"module": "esnext",
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
|
258
package-lock.json
generated
258
package-lock.json
generated
@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.18",
|
"version": "3.0.0-beta.19",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.18",
|
"version": "3.0.0-beta.19",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"busboy": "^1.0.0",
|
"busboy": "^1.0.0",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"commander": "^9.5.0",
|
"commander": "^10.0.0",
|
||||||
"connect": "^3.7.0",
|
"connect": "^3.7.0",
|
||||||
"cookie-signature": "^1.1.0",
|
"cookie-signature": "^1.1.0",
|
||||||
"cross-spawn": "7.0.3",
|
"cross-spawn": "7.0.3",
|
||||||
@ -19,8 +19,8 @@
|
|||||||
"elm-doc-preview": "^5.0.5",
|
"elm-doc-preview": "^5.0.5",
|
||||||
"elm-hot": "^1.1.6",
|
"elm-hot": "^1.1.6",
|
||||||
"esbuild": "^0.16.15",
|
"esbuild": "^0.16.15",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"globby": "11.0.4",
|
"globby": "^13.1.3",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"jsesc": "^3.0.2",
|
"jsesc": "^3.0.2",
|
||||||
"kleur": "^4.1.5",
|
"kleur": "^4.1.5",
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"serve-static": "^1.15.0",
|
"serve-static": "^1.15.0",
|
||||||
"terser": "^5.16.1",
|
"terser": "^5.16.1",
|
||||||
"vite": "^4.0.4",
|
"vite": "^4.0.4",
|
||||||
"which": "^2.0.2"
|
"which": "^3.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"elm-pages": "generator/src/cli.js"
|
"elm-pages": "generator/src/cli.js"
|
||||||
@ -42,7 +42,7 @@
|
|||||||
"@types/micromatch": "^4.0.2",
|
"@types/micromatch": "^4.0.2",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/serve-static": "^1.15.0",
|
"@types/serve-static": "^1.15.0",
|
||||||
"cypress": "^12.3.0",
|
"cypress": "^12.4.0",
|
||||||
"elm-codegen": "^0.2.0",
|
"elm-codegen": "^0.2.0",
|
||||||
"elm-optimize-level-2": "^0.3.5",
|
"elm-optimize-level-2": "^0.3.5",
|
||||||
"elm-review": "^2.8.2",
|
"elm-review": "^2.8.2",
|
||||||
@ -1025,14 +1025,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
||||||
},
|
},
|
||||||
"node_modules/array-union": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/asn1": {
|
"node_modules/asn1": {
|
||||||
"version": "0.2.6",
|
"version": "0.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
||||||
@ -1882,11 +1874,11 @@
|
|||||||
"integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="
|
"integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="
|
||||||
},
|
},
|
||||||
"node_modules/commander": {
|
"node_modules/commander": {
|
||||||
"version": "9.5.0",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz",
|
||||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
"integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.20.0 || >=14"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/common-tags": {
|
"node_modules/common-tags": {
|
||||||
@ -1971,10 +1963,24 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cross-spawn/node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cypress": {
|
"node_modules/cypress": {
|
||||||
"version": "12.3.0",
|
"version": "12.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.4.0.tgz",
|
||||||
"integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==",
|
"integrity": "sha512-//h93K/yGC/7pxv1KamlkADbKHLp5h3f9rZDE2McRjXZDagMETH0sXowOOanvhsH8cFt/JWspIcK+p9cuaoAqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -2487,6 +2493,21 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/elm-review/node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/elm-solve-deps-wasm": {
|
"node_modules/elm-solve-deps-wasm": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/elm-solve-deps-wasm/-/elm-solve-deps-wasm-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/elm-solve-deps-wasm/-/elm-solve-deps-wasm-1.0.2.tgz",
|
||||||
@ -2526,6 +2547,15 @@
|
|||||||
"balanced-match": "^1.0.0"
|
"balanced-match": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/elm-test/node_modules/commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/elm-test/node_modules/glob": {
|
"node_modules/elm-test/node_modules/glob": {
|
||||||
"version": "8.0.3",
|
"version": "8.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
|
||||||
@ -2557,6 +2587,21 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/elm-test/node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/elm-tooling": {
|
"node_modules/elm-tooling": {
|
||||||
"version": "1.11.0",
|
"version": "1.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/elm-tooling/-/elm-tooling-1.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/elm-tooling/-/elm-tooling-1.11.0.tgz",
|
||||||
@ -2633,6 +2678,15 @@
|
|||||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/elm-verify-examples/node_modules/commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/elm-verify-examples/node_modules/elm-test": {
|
"node_modules/elm-verify-examples/node_modules/elm-test": {
|
||||||
"version": "0.19.1-revision9",
|
"version": "0.19.1-revision9",
|
||||||
"resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision9.tgz",
|
"resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision9.tgz",
|
||||||
@ -2808,6 +2862,21 @@
|
|||||||
"node": ">= 4.0.0"
|
"node": ">= 4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/elm-verify-examples/node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/elmi-to-json": {
|
"node_modules/elmi-to-json": {
|
||||||
"version": "1.4.3",
|
"version": "1.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/elmi-to-json/-/elmi-to-json-1.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/elmi-to-json/-/elmi-to-json-1.4.3.tgz",
|
||||||
@ -3425,16 +3494,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "10.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz",
|
||||||
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
"integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
"jsonfile": "^6.0.1",
|
"jsonfile": "^6.0.1",
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=14.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fs-minipass": {
|
"node_modules/fs-minipass": {
|
||||||
@ -3593,19 +3662,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globby": {
|
"node_modules/globby": {
|
||||||
"version": "11.0.4",
|
"version": "13.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz",
|
||||||
"integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==",
|
"integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array-union": "^2.1.0",
|
|
||||||
"dir-glob": "^3.0.1",
|
"dir-glob": "^3.0.1",
|
||||||
"fast-glob": "^3.1.1",
|
"fast-glob": "^3.2.11",
|
||||||
"ignore": "^5.1.4",
|
"ignore": "^5.2.0",
|
||||||
"merge2": "^1.3.0",
|
"merge2": "^1.4.1",
|
||||||
"slash": "^3.0.0"
|
"slash": "^4.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
@ -6491,11 +6559,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/slash": {
|
"node_modules/slash": {
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
|
||||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
"integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/slice-ansi": {
|
"node_modules/slice-ansi": {
|
||||||
@ -7223,17 +7294,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/which": {
|
"node_modules/which": {
|
||||||
"version": "2.0.2",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-3.0.0.tgz",
|
||||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
"integrity": "sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"isexe": "^2.0.0"
|
"isexe": "^2.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"node-which": "bin/node-which"
|
"node-which": "bin/which.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 8"
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/which-module": {
|
"node_modules/which-module": {
|
||||||
@ -8160,11 +8231,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
||||||
},
|
},
|
||||||
"array-union": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="
|
|
||||||
},
|
|
||||||
"asn1": {
|
"asn1": {
|
||||||
"version": "0.2.6",
|
"version": "0.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
||||||
@ -8807,9 +8873,9 @@
|
|||||||
"integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="
|
"integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="
|
||||||
},
|
},
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "9.5.0",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz",
|
||||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="
|
"integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA=="
|
||||||
},
|
},
|
||||||
"common-tags": {
|
"common-tags": {
|
||||||
"version": "1.8.2",
|
"version": "1.8.2",
|
||||||
@ -8870,12 +8936,22 @@
|
|||||||
"path-key": "^3.1.0",
|
"path-key": "^3.1.0",
|
||||||
"shebang-command": "^2.0.0",
|
"shebang-command": "^2.0.0",
|
||||||
"which": "^2.0.1"
|
"which": "^2.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"requires": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cypress": {
|
"cypress": {
|
||||||
"version": "12.3.0",
|
"version": "12.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.4.0.tgz",
|
||||||
"integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==",
|
"integrity": "sha512-//h93K/yGC/7pxv1KamlkADbKHLp5h3f9rZDE2McRjXZDagMETH0sXowOOanvhsH8cFt/JWspIcK+p9cuaoAqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@cypress/request": "^2.88.10",
|
"@cypress/request": "^2.88.10",
|
||||||
@ -9280,6 +9356,15 @@
|
|||||||
"jsonfile": "^6.0.1",
|
"jsonfile": "^6.0.1",
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -9316,6 +9401,12 @@
|
|||||||
"balanced-match": "^1.0.0"
|
"balanced-match": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "8.0.3",
|
"version": "8.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
|
||||||
@ -9337,6 +9428,15 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^2.0.1"
|
"brace-expansion": "^2.0.1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -9404,6 +9504,12 @@
|
|||||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"elm-test": {
|
"elm-test": {
|
||||||
"version": "0.19.1-revision9",
|
"version": "0.19.1-revision9",
|
||||||
"resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision9.tgz",
|
"resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision9.tgz",
|
||||||
@ -9535,6 +9641,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -10017,9 +10132,9 @@
|
|||||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
|
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
|
||||||
},
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "10.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz",
|
||||||
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
"integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
"jsonfile": "^6.0.1",
|
"jsonfile": "^6.0.1",
|
||||||
@ -10144,16 +10259,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globby": {
|
"globby": {
|
||||||
"version": "11.0.4",
|
"version": "13.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz",
|
||||||
"integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==",
|
"integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"array-union": "^2.1.0",
|
|
||||||
"dir-glob": "^3.0.1",
|
"dir-glob": "^3.0.1",
|
||||||
"fast-glob": "^3.1.1",
|
"fast-glob": "^3.2.11",
|
||||||
"ignore": "^5.1.4",
|
"ignore": "^5.2.0",
|
||||||
"merge2": "^1.3.0",
|
"merge2": "^1.4.1",
|
||||||
"slash": "^3.0.0"
|
"slash": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"got": {
|
"got": {
|
||||||
@ -12284,9 +12398,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"slash": {
|
"slash": {
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
|
||||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
|
"integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew=="
|
||||||
},
|
},
|
||||||
"slice-ansi": {
|
"slice-ansi": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
@ -12807,9 +12921,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"which": {
|
"which": {
|
||||||
"version": "2.0.2",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-3.0.0.tgz",
|
||||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
"integrity": "sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"isexe": "^2.0.0"
|
"isexe": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
17
package.json
17
package.json
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.18",
|
"type": "module",
|
||||||
|
"version": "3.0.0-beta.19",
|
||||||
"homepage": "https://elm-pages.com",
|
"homepage": "https://elm-pages.com",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
|
"description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
|
||||||
@ -10,7 +11,7 @@
|
|||||||
"test": "./test.sh",
|
"test": "./test.sh",
|
||||||
"test:snapshot": "(cd examples/escaping && npm install && npm test) && (cd examples/base-path && npm install && npm test)",
|
"test:snapshot": "(cd examples/escaping && npm install && npm test) && (cd examples/base-path && npm install && npm test)",
|
||||||
"cypress": "npm start & cypress run",
|
"cypress": "npm start & cypress run",
|
||||||
"build:generator": "elm-codegen install && (cd codegen && lamdera make Generate.elm --output elm-pages-codegen.js)",
|
"build:generator": "elm-codegen install && (cd codegen && lamdera make Generate.elm --output elm-pages-codegen.js && mv elm-pages-codegen.js elm-pages-codegen.cjs)",
|
||||||
"review": "elm-review"
|
"review": "elm-review"
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/dillonkearns/elm-pages",
|
"repository": "https://github.com/dillonkearns/elm-pages",
|
||||||
@ -26,7 +27,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"busboy": "^1.0.0",
|
"busboy": "^1.0.0",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"commander": "^9.5.0",
|
"commander": "^10.0.0",
|
||||||
"connect": "^3.7.0",
|
"connect": "^3.7.0",
|
||||||
"cookie-signature": "^1.1.0",
|
"cookie-signature": "^1.1.0",
|
||||||
"cross-spawn": "7.0.3",
|
"cross-spawn": "7.0.3",
|
||||||
@ -34,8 +35,8 @@
|
|||||||
"elm-doc-preview": "^5.0.5",
|
"elm-doc-preview": "^5.0.5",
|
||||||
"elm-hot": "^1.1.6",
|
"elm-hot": "^1.1.6",
|
||||||
"esbuild": "^0.16.15",
|
"esbuild": "^0.16.15",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"globby": "11.0.4",
|
"globby": "^13.1.3",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"jsesc": "^3.0.2",
|
"jsesc": "^3.0.2",
|
||||||
"kleur": "^4.1.5",
|
"kleur": "^4.1.5",
|
||||||
@ -45,7 +46,7 @@
|
|||||||
"serve-static": "^1.15.0",
|
"serve-static": "^1.15.0",
|
||||||
"terser": "^5.16.1",
|
"terser": "^5.16.1",
|
||||||
"vite": "^4.0.4",
|
"vite": "^4.0.4",
|
||||||
"which": "^2.0.2"
|
"which": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
@ -54,7 +55,7 @@
|
|||||||
"@types/micromatch": "^4.0.2",
|
"@types/micromatch": "^4.0.2",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/serve-static": "^1.15.0",
|
"@types/serve-static": "^1.15.0",
|
||||||
"cypress": "^12.3.0",
|
"cypress": "^12.4.0",
|
||||||
"elm-codegen": "^0.2.0",
|
"elm-codegen": "^0.2.0",
|
||||||
"elm-optimize-level-2": "^0.3.5",
|
"elm-optimize-level-2": "^0.3.5",
|
||||||
"elm-review": "^2.8.2",
|
"elm-review": "^2.8.2",
|
||||||
@ -70,7 +71,7 @@
|
|||||||
"generator/review/",
|
"generator/review/",
|
||||||
"generator/dead-code-review/",
|
"generator/dead-code-review/",
|
||||||
"src/",
|
"src/",
|
||||||
"codegen/elm-pages-codegen.js",
|
"codegen/elm-pages-codegen.cjs",
|
||||||
"generator/template/",
|
"generator/template/",
|
||||||
"generator/static-code/"
|
"generator/static-code/"
|
||||||
],
|
],
|
||||||
|
8
tsconfig.json
Normal file
8
tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user