@easy-cms/next 1.42.0 → 1.42.1

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.js +26 -1
  3. package/package.json +5 -5
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Kanawoot K.
3
+ Copyright (c) 2026 Kanawut K.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  resolveConfig,
9
9
  sharedEasyCMS
10
10
  } from "@easy-cms/core";
11
+ import { platformWaitUntil } from "@easy-cms/core/internal";
11
12
  import { cacheTags } from "@easy-cms/core";
12
13
  function getEasyCMS(config) {
13
14
  if (typeof globalThis.EdgeRuntime === "string") {
@@ -20,7 +21,20 @@ function getEasyCMS(config) {
20
21
  return sharedEasyCMS(config);
21
22
  }
22
23
  function createRouteHandlers(config, options = {}) {
23
- const handle = createApiHandler(config, options);
24
+ let after;
25
+ const api = createApiHandler(config, {
26
+ // Work after the response (a backup, emails) with Next.js's `after`, which a serverless host
27
+ // keeps the function running for. Called while the request is still handled.
28
+ waitUntil: (task) => {
29
+ if (after) after(() => task);
30
+ else platformWaitUntil()?.(task);
31
+ },
32
+ ...options
33
+ });
34
+ const handle = async (request) => {
35
+ after = await loadAfter();
36
+ return api(request);
37
+ };
24
38
  return {
25
39
  GET: handle,
26
40
  HEAD: handle,
@@ -31,6 +45,17 @@ function createRouteHandlers(config, options = {}) {
31
45
  OPTIONS: handle
32
46
  };
33
47
  }
48
+ var nextAfter;
49
+ function loadAfter() {
50
+ nextAfter ??= import("next/server.js").then(
51
+ (server) => {
52
+ const found = server;
53
+ return found.after ?? found.unstable_after;
54
+ },
55
+ () => void 0
56
+ );
57
+ return nextAfter;
58
+ }
34
59
  function createAdminRouteHandlers(config, options = {}) {
35
60
  let handler;
36
61
  const handle = async (request) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/next",
3
- "version": "1.42.0",
3
+ "version": "1.42.1",
4
4
  "description": "Next.js adapter for Easy CMS",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,19 +26,19 @@
26
26
  "node": ">=22.12"
27
27
  },
28
28
  "dependencies": {
29
- "@easy-cms/admin": "^1.42.0"
29
+ "@easy-cms/admin": "^1.42.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "next": ">=15.0.0",
33
33
  "react": ">=19.0.0",
34
- "@easy-cms/core": "^1.42.0"
34
+ "@easy-cms/core": "^1.42.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/react": "^19.2.0",
38
38
  "next": "^16.4.3",
39
39
  "react": "^19.2.0",
40
- "@easy-cms/core": "^1.42.0",
41
- "@easy-cms/db-sqlite": "^1.42.0"
40
+ "@easy-cms/core": "^1.42.1",
41
+ "@easy-cms/db-sqlite": "^1.42.1"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"