elm-ssr 0.91.2 → 0.91.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/scaffold.mjs +7 -11
- package/package.json +1 -1
package/lib/scaffold.mjs
CHANGED
|
@@ -415,11 +415,10 @@ const runtimeTemplate = (appRoot, db = false, auth = undefined) => {
|
|
|
415
415
|
`import ElmRuntime from "${generatedPrefix}/app.mjs";`
|
|
416
416
|
];
|
|
417
417
|
|
|
418
|
-
|
|
419
|
-
imports.push(`import { inMemoryEffects, cloudflareEffects } from "elm-ssr/effects";`);
|
|
420
|
-
}
|
|
418
|
+
imports.push(`import { inMemoryEffects, cloudflareEffects } from "elm-ssr/effects";`);
|
|
421
419
|
if (auth) {
|
|
422
420
|
imports.push(`import { handleAuth } from "./src/Endpoints/Auth";`);
|
|
421
|
+
imports.push(`import { memorySessionStore } from "elm-ssr/sessions";`);
|
|
423
422
|
}
|
|
424
423
|
|
|
425
424
|
let dbInit = '';
|
|
@@ -464,25 +463,22 @@ if (typeof Bun !== "undefined") {
|
|
|
464
463
|
},`;
|
|
465
464
|
}
|
|
466
465
|
|
|
467
|
-
|
|
468
|
-
if (db) {
|
|
469
|
-
effectsConfig = `,
|
|
466
|
+
const effectsConfig = `,
|
|
470
467
|
effects: (effect, context) => {
|
|
471
|
-
if (context.env
|
|
472
|
-
return cloudflareEffects({ dbBinding: "DB" })(effect, context);
|
|
468
|
+
if (context.env) {
|
|
469
|
+
return cloudflareEffects(${db ? '{ dbBinding: "DB" }' : ''})(effect, context);
|
|
473
470
|
}
|
|
474
471
|
return inMemoryEffects({
|
|
475
|
-
env: process.env as any
|
|
476
|
-
sql: sqlHandler
|
|
472
|
+
env: process.env as any${db ? ',\n sql: sqlHandler' : ''}
|
|
477
473
|
})(effect, context);
|
|
478
474
|
}`;
|
|
479
|
-
}
|
|
480
475
|
|
|
481
476
|
let sessionsConfig = '';
|
|
482
477
|
if (auth) {
|
|
483
478
|
sessionsConfig = `,
|
|
484
479
|
sessions: {
|
|
485
480
|
secret: (env) => (env?.SESSION_SECRET as string) || "change-me-to-a-secure-random-hmac-secret-key-that-is-at-least-32-chars",
|
|
481
|
+
store: memorySessionStore(),
|
|
486
482
|
secure: false
|
|
487
483
|
},
|
|
488
484
|
csrf: true`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elm-ssr",
|
|
3
|
-
"version": "0.91.
|
|
3
|
+
"version": "0.91.3",
|
|
4
4
|
"description": "Elm-first SSR library and framework for Cloudflare Workers (and Bun): file-based routes/islands, backend-neutral effect adapters (KV/D1/Redis/Postgres), background tasks (waitUntil/Queues), SQL-file migrations, CLI scaffold + build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Michał Majchrzak <michmajchrzak@gmail.com>",
|