@replanejs/next 0.7.6 → 0.8.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/README.md +11 -22
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @replanejs/next
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@replanejs/next)
|
|
4
|
+
[](https://github.com/replane-dev/replane-javascript/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/orgs/replane-dev/discussions)
|
|
6
|
+
|
|
3
7
|
Next.js SDK for Replane - feature flags and remote configuration with SSR support.
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
@@ -59,7 +63,7 @@ export function ThemeToggle() {
|
|
|
59
63
|
|
|
60
64
|
### Pages Router
|
|
61
65
|
|
|
62
|
-
**1. Set up ReplaneProvider in _app.tsx:**
|
|
66
|
+
**1. Set up ReplaneProvider in \_app.tsx:**
|
|
63
67
|
|
|
64
68
|
```tsx
|
|
65
69
|
// pages/_app.tsx
|
|
@@ -254,30 +258,11 @@ Fetches a snapshot of all configs. Use in `getServerSideProps`, `getStaticProps`
|
|
|
254
258
|
const snapshot = await getReplaneSnapshot<AppConfigs>({
|
|
255
259
|
baseUrl: process.env.REPLANE_BASE_URL!,
|
|
256
260
|
sdkKey: process.env.REPLANE_SDK_KEY!,
|
|
257
|
-
|
|
261
|
+
// by default, getReplaneSnapshot will reuse the created client for 60 seconds for fast subsequent calls, the client will be syncing with the server in the background during this time
|
|
262
|
+
keepAliveMs: 60_000,
|
|
258
263
|
});
|
|
259
264
|
```
|
|
260
265
|
|
|
261
|
-
#### `clearSnapshotCache(): Promise<void>`
|
|
262
|
-
|
|
263
|
-
Clears the internal client cache. Useful for testing.
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
await clearSnapshotCache();
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Environment Variables
|
|
270
|
-
|
|
271
|
-
```env
|
|
272
|
-
# Server-side only (for SSR/SSG)
|
|
273
|
-
REPLANE_BASE_URL=https://api.replane.io
|
|
274
|
-
REPLANE_SDK_KEY=your-sdk-key
|
|
275
|
-
|
|
276
|
-
# Client-side (for live updates)
|
|
277
|
-
NEXT_PUBLIC_REPLANE_BASE_URL=https://api.replane.io
|
|
278
|
-
NEXT_PUBLIC_REPLANE_SDK_KEY=your-sdk-key
|
|
279
|
-
```
|
|
280
|
-
|
|
281
266
|
## Examples
|
|
282
267
|
|
|
283
268
|
See the [examples](./examples) directory for complete working examples:
|
|
@@ -285,6 +270,10 @@ See the [examples](./examples) directory for complete working examples:
|
|
|
285
270
|
- **[next-app-router](./examples/next-app-router)** - App Router with ReplaneRoot
|
|
286
271
|
- **[next-pages-router](./examples/next-pages-router)** - Pages Router with getInitialProps
|
|
287
272
|
|
|
273
|
+
## Community
|
|
274
|
+
|
|
275
|
+
Have questions or want to discuss Replane? Join the conversation in [GitHub Discussions](https://github.com/orgs/replane-dev/discussions).
|
|
276
|
+
|
|
288
277
|
## License
|
|
289
278
|
|
|
290
279
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -82,12 +82,6 @@ Object.defineProperty(exports, 'ReplaneProvider', {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
exports.ReplaneRoot = ReplaneRoot;
|
|
85
|
-
Object.defineProperty(exports, 'clearSnapshotCache', {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function () {
|
|
88
|
-
return __replanejs_react.clearSnapshotCache;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
85
|
Object.defineProperty(exports, 'clearSuspenseCache', {
|
|
92
86
|
enumerable: true,
|
|
93
87
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { GetConfigOptions, ReplaneClient, ReplaneClientOptions, ReplaneClientOptions as ReplaneClientOptions$1, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneSnapshot, RestoreReplaneClientOptions, createInMemoryReplaneClient, createReplaneClient, restoreReplaneClient } from "@replanejs/sdk";
|
|
4
|
-
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps,
|
|
4
|
+
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
5
5
|
|
|
6
6
|
//#region src/root.d.ts
|
|
7
7
|
|
|
@@ -52,5 +52,5 @@ declare function ReplaneRoot<T extends object>({
|
|
|
52
52
|
}: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
|
|
53
53
|
//# sourceMappingURL=root.d.ts.map
|
|
54
54
|
//#endregion
|
|
55
|
-
export { type GetConfigOptions, type GetReplaneSnapshotOptions, type ReplaneClient, type ReplaneClientOptions, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, type RestoreReplaneClientOptions,
|
|
55
|
+
export { type GetConfigOptions, type GetReplaneSnapshotOptions, type ReplaneClient, type ReplaneClientOptions, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, type RestoreReplaneClientOptions, clearSuspenseCache, createConfigHook, createInMemoryReplaneClient, createReplaneClient, createReplaneHook, getReplaneSnapshot, restoreReplaneClient, useConfig, useReplane };
|
|
56
56
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps,
|
|
1
|
+
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
2
2
|
import { GetConfigOptions, ReplaneClient, ReplaneClientOptions, ReplaneClientOptions as ReplaneClientOptions$1, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneSnapshot, RestoreReplaneClientOptions, createInMemoryReplaneClient, createReplaneClient, restoreReplaneClient } from "@replanejs/sdk";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { ReactNode } from "react";
|
|
@@ -52,5 +52,5 @@ declare function ReplaneRoot<T extends object>({
|
|
|
52
52
|
}: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
|
|
53
53
|
//# sourceMappingURL=root.d.ts.map
|
|
54
54
|
//#endregion
|
|
55
|
-
export { type GetConfigOptions, type GetReplaneSnapshotOptions, type ReplaneClient, type ReplaneClientOptions, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, type RestoreReplaneClientOptions,
|
|
55
|
+
export { type GetConfigOptions, type GetReplaneSnapshotOptions, type ReplaneClient, type ReplaneClientOptions, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, type RestoreReplaneClientOptions, clearSuspenseCache, createConfigHook, createInMemoryReplaneClient, createReplaneClient, createReplaneHook, getReplaneSnapshot, restoreReplaneClient, useConfig, useReplane };
|
|
56
56
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReplaneProvider, ReplaneProvider as ReplaneProvider$1,
|
|
1
|
+
import { ReplaneProvider, ReplaneProvider as ReplaneProvider$1, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, getReplaneSnapshot as getReplaneSnapshot$1, useConfig, useReplane } from "@replanejs/react";
|
|
2
2
|
import { ReplaneError, ReplaneErrorCode, createInMemoryReplaneClient, createReplaneClient, restoreReplaneClient } from "@replanejs/sdk";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -40,5 +40,5 @@ async function ReplaneRoot({ options, children }) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
|
-
export { ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneRoot,
|
|
43
|
+
export { ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneRoot, clearSuspenseCache, createConfigHook, createInMemoryReplaneClient, createReplaneClient, createReplaneHook, getReplaneSnapshot, restoreReplaneClient, useConfig, useReplane };
|
|
44
44
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replanejs/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Next.js SDK for Replane - feature flags and remote configuration with SSR support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"react": ">=18.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@replanejs/react": "^0.
|
|
49
|
-
"@replanejs/sdk": "^0.
|
|
48
|
+
"@replanejs/react": "^0.8.0",
|
|
49
|
+
"@replanejs/sdk": "^0.8.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.19.3",
|