@reblu/site-next 1.0.0 → 1.1.0

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/dist/cache.cjs ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/next-cache-adapter.ts
21
+ var next_cache_adapter_exports = {};
22
+ __export(next_cache_adapter_exports, {
23
+ NextCacheAdapter: () => NextCacheAdapter
24
+ });
25
+ module.exports = __toCommonJS(next_cache_adapter_exports);
26
+ var NextCacheAdapter = class {
27
+ /**
28
+ * @param defaultRevalidate ISR window (seconds) applied when a request omits
29
+ * its own `revalidate`. Defaults to `60` for parity with demo-site's current
30
+ * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
31
+ */
32
+ constructor(defaultRevalidate = 60) {
33
+ this.defaultRevalidate = defaultRevalidate;
34
+ }
35
+ defaultRevalidate;
36
+ resolveRequestInit(policy) {
37
+ const revalidate = policy.revalidate ?? this.defaultRevalidate;
38
+ if (revalidate === false || revalidate === 0) {
39
+ return { cache: "no-store" };
40
+ }
41
+ return { next: { revalidate } };
42
+ }
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ NextCacheAdapter
47
+ });
48
+ //# sourceMappingURL=cache.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next-cache-adapter.ts"],"sourcesContent":["import type { RebluCacheAdapter, RebluCachePolicy } from '@reblu/site-client'\n\n/**\n * Next.js ISR cache adapter (REB-418 / design doc §5.2).\n *\n * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported\n * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the\n * `fetch` options Next understands. This is the piece that restores the exact\n * ISR behavior demo-site hard-codes today — now injected instead of baked in:\n *\n * ```ts\n * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })\n * ```\n *\n * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)\n * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)\n * - omitted `revalidate` → the constructor `defaultRevalidate`\n */\nexport class NextCacheAdapter implements RebluCacheAdapter {\n /**\n * @param defaultRevalidate ISR window (seconds) applied when a request omits\n * its own `revalidate`. Defaults to `60` for parity with demo-site's current\n * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.\n */\n constructor(private readonly defaultRevalidate: number | false = 60) {}\n\n resolveRequestInit(policy: RebluCachePolicy): RequestInit {\n const revalidate = policy.revalidate ?? this.defaultRevalidate\n if (revalidate === false || revalidate === 0) {\n return { cache: 'no-store' }\n }\n return { next: { revalidate } } as RequestInit\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,IAAM,mBAAN,MAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,YAA6B,oBAAoC,IAAI;AAAxC;AAAA,EAAyC;AAAA,EAAzC;AAAA,EAE7B,mBAAmB,QAAuC;AACxD,UAAM,aAAa,OAAO,cAAc,KAAK;AAC7C,QAAI,eAAe,SAAS,eAAe,GAAG;AAC5C,aAAO,EAAE,OAAO,WAAW;AAAA,IAC7B;AACA,WAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAAA,EAChC;AACF;","names":[]}
@@ -0,0 +1,30 @@
1
+ import { RebluCacheAdapter, RebluCachePolicy } from '@reblu/site-client';
2
+
3
+ /**
4
+ * Next.js ISR cache adapter (REB-418 / design doc §5.2).
5
+ *
6
+ * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported
7
+ * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the
8
+ * `fetch` options Next understands. This is the piece that restores the exact
9
+ * ISR behavior demo-site hard-codes today — now injected instead of baked in:
10
+ *
11
+ * ```ts
12
+ * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })
13
+ * ```
14
+ *
15
+ * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)
16
+ * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)
17
+ * - omitted `revalidate` → the constructor `defaultRevalidate`
18
+ */
19
+ declare class NextCacheAdapter implements RebluCacheAdapter {
20
+ private readonly defaultRevalidate;
21
+ /**
22
+ * @param defaultRevalidate ISR window (seconds) applied when a request omits
23
+ * its own `revalidate`. Defaults to `60` for parity with demo-site's current
24
+ * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
25
+ */
26
+ constructor(defaultRevalidate?: number | false);
27
+ resolveRequestInit(policy: RebluCachePolicy): RequestInit;
28
+ }
29
+
30
+ export { NextCacheAdapter };
@@ -0,0 +1,30 @@
1
+ import { RebluCacheAdapter, RebluCachePolicy } from '@reblu/site-client';
2
+
3
+ /**
4
+ * Next.js ISR cache adapter (REB-418 / design doc §5.2).
5
+ *
6
+ * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported
7
+ * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the
8
+ * `fetch` options Next understands. This is the piece that restores the exact
9
+ * ISR behavior demo-site hard-codes today — now injected instead of baked in:
10
+ *
11
+ * ```ts
12
+ * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })
13
+ * ```
14
+ *
15
+ * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)
16
+ * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)
17
+ * - omitted `revalidate` → the constructor `defaultRevalidate`
18
+ */
19
+ declare class NextCacheAdapter implements RebluCacheAdapter {
20
+ private readonly defaultRevalidate;
21
+ /**
22
+ * @param defaultRevalidate ISR window (seconds) applied when a request omits
23
+ * its own `revalidate`. Defaults to `60` for parity with demo-site's current
24
+ * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
25
+ */
26
+ constructor(defaultRevalidate?: number | false);
27
+ resolveRequestInit(policy: RebluCachePolicy): RequestInit;
28
+ }
29
+
30
+ export { NextCacheAdapter };
package/dist/cache.js ADDED
@@ -0,0 +1,23 @@
1
+ // src/next-cache-adapter.ts
2
+ var NextCacheAdapter = class {
3
+ /**
4
+ * @param defaultRevalidate ISR window (seconds) applied when a request omits
5
+ * its own `revalidate`. Defaults to `60` for parity with demo-site's current
6
+ * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
7
+ */
8
+ constructor(defaultRevalidate = 60) {
9
+ this.defaultRevalidate = defaultRevalidate;
10
+ }
11
+ defaultRevalidate;
12
+ resolveRequestInit(policy) {
13
+ const revalidate = policy.revalidate ?? this.defaultRevalidate;
14
+ if (revalidate === false || revalidate === 0) {
15
+ return { cache: "no-store" };
16
+ }
17
+ return { next: { revalidate } };
18
+ }
19
+ };
20
+ export {
21
+ NextCacheAdapter
22
+ };
23
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next-cache-adapter.ts"],"sourcesContent":["import type { RebluCacheAdapter, RebluCachePolicy } from '@reblu/site-client'\n\n/**\n * Next.js ISR cache adapter (REB-418 / design doc §5.2).\n *\n * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported\n * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the\n * `fetch` options Next understands. This is the piece that restores the exact\n * ISR behavior demo-site hard-codes today — now injected instead of baked in:\n *\n * ```ts\n * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })\n * ```\n *\n * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)\n * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)\n * - omitted `revalidate` → the constructor `defaultRevalidate`\n */\nexport class NextCacheAdapter implements RebluCacheAdapter {\n /**\n * @param defaultRevalidate ISR window (seconds) applied when a request omits\n * its own `revalidate`. Defaults to `60` for parity with demo-site's current\n * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.\n */\n constructor(private readonly defaultRevalidate: number | false = 60) {}\n\n resolveRequestInit(policy: RebluCachePolicy): RequestInit {\n const revalidate = policy.revalidate ?? this.defaultRevalidate\n if (revalidate === false || revalidate === 0) {\n return { cache: 'no-store' }\n }\n return { next: { revalidate } } as RequestInit\n }\n}\n"],"mappings":";AAkBO,IAAM,mBAAN,MAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,YAA6B,oBAAoC,IAAI;AAAxC;AAAA,EAAyC;AAAA,EAAzC;AAAA,EAE7B,mBAAmB,QAAuC;AACxD,UAAM,aAAa,OAAO,cAAc,KAAK;AAC7C,QAAI,eAAe,SAAS,eAAe,GAAG;AAC5C,aAAO,EAAE,OAAO,WAAW;AAAA,IAC7B;AACA,WAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAAA,EAChC;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,36 +1,10 @@
1
- import { RebluCacheAdapter, RebluCachePolicy, RebluClient } from '@reblu/site-client';
1
+ export { NextCacheAdapter } from './cache.cjs';
2
2
  export { CtaButtons, CtaButtonsProps } from './cta-buttons.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { Cta } from '@reblu/site-contracts';
5
+ import { RebluClient } from '@reblu/site-client';
5
6
  import { ReactNode } from 'react';
6
7
 
7
- /**
8
- * Next.js ISR cache adapter (REB-418 / design doc §5.2).
9
- *
10
- * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported
11
- * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the
12
- * `fetch` options Next understands. This is the piece that restores the exact
13
- * ISR behavior demo-site hard-codes today — now injected instead of baked in:
14
- *
15
- * ```ts
16
- * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })
17
- * ```
18
- *
19
- * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)
20
- * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)
21
- * - omitted `revalidate` → the constructor `defaultRevalidate`
22
- */
23
- declare class NextCacheAdapter implements RebluCacheAdapter {
24
- private readonly defaultRevalidate;
25
- /**
26
- * @param defaultRevalidate ISR window (seconds) applied when a request omits
27
- * its own `revalidate`. Defaults to `60` for parity with demo-site's current
28
- * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
29
- */
30
- constructor(defaultRevalidate?: number | false);
31
- resolveRequestInit(policy: RebluCachePolicy): RequestInit;
32
- }
33
-
34
8
  interface StickyMobileCtaProps {
35
9
  ctas: Cta[];
36
10
  }
@@ -78,4 +52,4 @@ interface EditableCtaProps {
78
52
  */
79
53
  declare function EditableCta({ slot, client, className, buttonClassName, size, fallback, }: EditableCtaProps): Promise<react_jsx_runtime.JSX.Element>;
80
54
 
81
- export { type CtaClient, type CtaSlot, EditableCta, type EditableCtaProps, NextCacheAdapter, StickyMobileCta, type StickyMobileCtaProps };
55
+ export { type CtaClient, type CtaSlot, EditableCta, type EditableCtaProps, StickyMobileCta, type StickyMobileCtaProps };
package/dist/index.d.ts CHANGED
@@ -1,36 +1,10 @@
1
- import { RebluCacheAdapter, RebluCachePolicy, RebluClient } from '@reblu/site-client';
1
+ export { NextCacheAdapter } from './cache.js';
2
2
  export { CtaButtons, CtaButtonsProps } from './cta-buttons.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { Cta } from '@reblu/site-contracts';
5
+ import { RebluClient } from '@reblu/site-client';
5
6
  import { ReactNode } from 'react';
6
7
 
7
- /**
8
- * Next.js ISR cache adapter (REB-418 / design doc §5.2).
9
- *
10
- * Implements the framework-agnostic {@link RebluCacheAdapter} interface exported
11
- * by `@reblu/site-client`, translating a {@link RebluCachePolicy} into the
12
- * `fetch` options Next understands. This is the piece that restores the exact
13
- * ISR behavior demo-site hard-codes today — now injected instead of baked in:
14
- *
15
- * ```ts
16
- * createRebluClient({ baseUrl, apiKey, cache: new NextCacheAdapter(60) })
17
- * ```
18
- *
19
- * - `revalidate` > 0 → `{ next: { revalidate } }` (time-based ISR)
20
- * - `revalidate` `false` / `0` → `{ cache: 'no-store' }` (dynamic / preview)
21
- * - omitted `revalidate` → the constructor `defaultRevalidate`
22
- */
23
- declare class NextCacheAdapter implements RebluCacheAdapter {
24
- private readonly defaultRevalidate;
25
- /**
26
- * @param defaultRevalidate ISR window (seconds) applied when a request omits
27
- * its own `revalidate`. Defaults to `60` for parity with demo-site's current
28
- * ISR default (`client.ts:45`). Pass `false`/`0` to default to no-store.
29
- */
30
- constructor(defaultRevalidate?: number | false);
31
- resolveRequestInit(policy: RebluCachePolicy): RequestInit;
32
- }
33
-
34
8
  interface StickyMobileCtaProps {
35
9
  ctas: Cta[];
36
10
  }
@@ -78,4 +52,4 @@ interface EditableCtaProps {
78
52
  */
79
53
  declare function EditableCta({ slot, client, className, buttonClassName, size, fallback, }: EditableCtaProps): Promise<react_jsx_runtime.JSX.Element>;
80
54
 
81
- export { type CtaClient, type CtaSlot, EditableCta, type EditableCtaProps, NextCacheAdapter, StickyMobileCta, type StickyMobileCtaProps };
55
+ export { type CtaClient, type CtaSlot, EditableCta, type EditableCtaProps, StickyMobileCta, type StickyMobileCtaProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reblu/site-next",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Next.js RSC glue for Reblu SITEs — ISR cache adapter + editable CTA server/client components.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Reblu — Adolfo Unturbe",
@@ -50,6 +50,16 @@
50
50
  "types": "./dist/cta-buttons.d.cts",
51
51
  "default": "./dist/cta-buttons.cjs"
52
52
  }
53
+ },
54
+ "./cache": {
55
+ "import": {
56
+ "types": "./dist/cache.d.ts",
57
+ "default": "./dist/cache.js"
58
+ },
59
+ "require": {
60
+ "types": "./dist/cache.d.cts",
61
+ "default": "./dist/cache.cjs"
62
+ }
53
63
  }
54
64
  },
55
65
  "publishConfig": {
@@ -61,8 +71,8 @@
61
71
  "@reblu/site-ui": "0.2.0"
62
72
  },
63
73
  "dependencies": {
64
- "@reblu/site-client": "0.1.0",
65
- "@reblu/site-contracts": "0.1.0"
74
+ "@reblu/site-client": "^0.1.1",
75
+ "@reblu/site-contracts": "^0.1.1"
66
76
  },
67
77
  "devDependencies": {
68
78
  "@testing-library/jest-dom": "^6.9.1",