alinea 0.11.1 → 0.11.2

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.
@@ -7,7 +7,6 @@ import "../../chunks/chunk-U5RRZUYZ.js";
7
7
  import { Headers } from "@alinea/iso";
8
8
  import { Database } from "alinea/backend/Database";
9
9
  import { createPreviewParser } from "alinea/backend/resolver/ParsePreview";
10
- import { generatedStore } from "alinea/backend/store/GeneratedStore";
11
10
  import { Client } from "alinea/core/Client";
12
11
  import { CMS } from "alinea/core/CMS";
13
12
  import { Config } from "alinea/core/Config";
@@ -19,22 +18,26 @@ import { jsx } from "react/jsx-runtime";
19
18
  var NextCMS = class extends CMS {
20
19
  constructor(config, baseUrl) {
21
20
  let lastSync = 0;
22
- const database = PLazy.from(
23
- () => generatedStore.then((store) => new Database(this.config, store))
24
- );
25
- const previewParser = PLazy.from(() => database.then(createPreviewParser));
21
+ const init = PLazy.from(async () => {
22
+ if (process.env.NEXT_RUNTIME === "edge")
23
+ throw "assert";
24
+ const { generatedStore } = await import("alinea/backend/store/GeneratedStore");
25
+ const store = await generatedStore;
26
+ const db = new Database(config, store);
27
+ const previews = createPreviewParser(db);
28
+ return { db, previews };
29
+ });
26
30
  super(config, async () => {
27
31
  const context = await requestContext(config);
28
32
  const client = new Client({
29
33
  url: context.handlerUrl.href,
30
- applyAuth(init) {
31
- const headers = new Headers(init?.headers);
34
+ applyAuth(init2) {
35
+ const headers = new Headers(init2?.headers);
32
36
  headers.set("Authorization", `Bearer ${context.apiKey}`);
33
- return { ...init, headers };
37
+ return { ...init2, headers };
34
38
  }
35
39
  });
36
40
  const clientResolve = client.resolve.bind(client);
37
- const sync = () => database.then((db) => db.syncWith(client));
38
41
  return assign(client, {
39
42
  async resolve(params) {
40
43
  const isDev = Boolean(devUrl());
@@ -47,14 +50,14 @@ var NextCMS = class extends CMS {
47
50
  if (payload)
48
51
  preview = { payload };
49
52
  }
50
- if (isDev)
53
+ if (process.env.NEXT_RUNTIME === "edge" || isDev)
51
54
  return clientResolve({ preview, ...params });
52
55
  const { PHASE_PRODUCTION_BUILD } = await import("next/constants.js");
53
56
  const isBuild = process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD;
54
- const db = await database;
57
+ const { db, previews } = await init;
58
+ const sync = () => db.syncWith(client);
55
59
  if (!isBuild) {
56
60
  if (preview) {
57
- const previews = await previewParser;
58
61
  preview = await previews.parse(
59
62
  preview,
60
63
  sync,
@@ -2,7 +2,7 @@
2
2
  var package_default = {
3
3
  bin: "./dist/cli.js",
4
4
  name: "alinea",
5
- version: "0.11.1",
5
+ version: "0.11.2",
6
6
  license: "MIT",
7
7
  type: "module",
8
8
  scripts: {
package/dist/cli/Serve.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-Y4XBLUGH.js";
3
+ } from "../chunks/chunk-7EETFPPX.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // src/cli/Serve.ts
package/dist/cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-Y4XBLUGH.js";
3
+ } from "../chunks/chunk-7EETFPPX.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // node_modules/mri/lib/index.mjs
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-Y4XBLUGH.js";
3
+ } from "../chunks/chunk-7EETFPPX.js";
4
4
  import {
5
5
  PLazy
6
6
  } from "../chunks/chunk-IKINPSS5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../../chunks/chunk-Y4XBLUGH.js";
3
+ } from "../../chunks/chunk-7EETFPPX.js";
4
4
  import {
5
5
  create as create2
6
6
  } from "../../chunks/chunk-IOTY7UTU.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bin": "./dist/cli.js",
3
3
  "name": "alinea",
4
- "version": "0.11.1",
4
+ "version": "0.11.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "scripts": {