@dyanet/nextjs-config-aws 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/README.md +61 -0
- package/dist/cjs/index.js +10 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react.js +50 -0
- package/dist/cjs/react.js.map +1 -0
- package/dist/cjs/server/index.js +7 -6
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/esm/index.js +10 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.js +43 -0
- package/dist/esm/react.js.map +1 -0
- package/dist/esm/server/index.js +6 -1
- package/dist/esm/server/index.js.map +1 -1
- package/dist/types/index.d.ts +9 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/react.d.ts +43 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +6 -1
- package/dist/types/server/index.d.ts.map +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @dyanet/nextjs-config-aws
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@dyanet/nextjs-config-aws)
|
|
4
|
+
[](https://github.com/dyanet/config-aws/actions/workflows/ci.yml)
|
|
5
|
+
[](https://codecov.io/gh/dyanet/config-aws)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
3
8
|
Next.js adapter for AWS configuration management. A thin wrapper around [@dyanet/config-aws](../config-aws) that provides server-side configuration loading, runtime environment variables, and automatic environment detection.
|
|
4
9
|
|
|
5
10
|
## Features
|
|
@@ -319,6 +324,8 @@ export async function GET() {
|
|
|
319
324
|
}
|
|
320
325
|
```
|
|
321
326
|
|
|
327
|
+
> **Note:** `getConfig()` works in API routes without any React dependencies. The React context providers (`ConfigProvider`, `useConfig`) are available via a separate import path - see [React Context Providers](#react-context-providers) below.
|
|
328
|
+
|
|
322
329
|
### Server Action
|
|
323
330
|
|
|
324
331
|
```typescript
|
|
@@ -396,6 +403,60 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|
|
396
403
|
|
|
397
404
|
## Advanced Usage
|
|
398
405
|
|
|
406
|
+
### React Context Providers
|
|
407
|
+
|
|
408
|
+
For sharing configuration across React server components via context, import from the `/react` subpath:
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
// app/layout.tsx
|
|
412
|
+
import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
413
|
+
import { ConfigProvider } from '@dyanet/nextjs-config-aws/react';
|
|
414
|
+
import { z } from 'zod';
|
|
415
|
+
|
|
416
|
+
const schema = z.object({
|
|
417
|
+
DATABASE_URL: z.string(),
|
|
418
|
+
API_KEY: z.string(),
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
export default async function RootLayout({ children }) {
|
|
422
|
+
const config = await getConfig({ schema });
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<html>
|
|
426
|
+
<body>
|
|
427
|
+
<ConfigProvider config={config}>
|
|
428
|
+
{children}
|
|
429
|
+
</ConfigProvider>
|
|
430
|
+
</body>
|
|
431
|
+
</html>
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```typescript
|
|
437
|
+
// app/components/my-component.tsx
|
|
438
|
+
import { useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
439
|
+
|
|
440
|
+
export function MyComponent() {
|
|
441
|
+
const config = useConfig();
|
|
442
|
+
return <div>API Key: {config.API_KEY}</div>;
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
For typed configuration, use `createConfigProvider`:
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
import { createConfigProvider } from '@dyanet/nextjs-config-aws/react';
|
|
450
|
+
|
|
451
|
+
type AppConfig = { DATABASE_URL: string; API_KEY: string };
|
|
452
|
+
|
|
453
|
+
const { ConfigProvider, useConfig } = createConfigProvider<AppConfig>();
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
> **Why a separate import?** The React context providers use `React.createContext()` which requires React to be available. By separating them into `/react`, the main package exports work in all server contexts including API routes and middleware where React isn't loaded.
|
|
457
|
+
|
|
458
|
+
### Custom Loaders
|
|
459
|
+
|
|
399
460
|
For advanced use cases such as custom loaders, direct AWS SDK integration, or fine-grained control over configuration loading, import from `@dyanet/config-aws` directly:
|
|
400
461
|
|
|
401
462
|
```typescript
|
package/dist/cjs/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
|
-
* // Server-side configuration loading
|
|
11
|
+
* // Server-side configuration loading (works in API routes, middleware, etc.)
|
|
12
12
|
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
13
13
|
*
|
|
14
14
|
* const config = await getConfig({
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
* const apiUrl = env('API_URL');
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // React context providers (for server components only)
|
|
37
|
+
* // Import from '@dyanet/nextjs-config-aws/react' to avoid loading React
|
|
38
|
+
* // in non-React contexts like API routes
|
|
39
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
34
42
|
* @remarks
|
|
35
43
|
* For advanced loader access, custom loaders, or direct AWS SDK integration,
|
|
36
44
|
* import from `@dyanet/config-aws` directly:
|
|
@@ -52,7 +60,7 @@ exports.env = exports.PublicEnvScript = exports.getConfig = exports.ValidationEr
|
|
|
52
60
|
var config_aws_1 = require("@dyanet/config-aws");
|
|
53
61
|
Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return config_aws_1.ConfigurationError; } });
|
|
54
62
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return config_aws_1.ValidationError; } });
|
|
55
|
-
// Server-side configuration loading
|
|
63
|
+
// Server-side configuration loading (React-free, works in API routes)
|
|
56
64
|
var server_1 = require("./server");
|
|
57
65
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return server_1.getConfig; } });
|
|
58
66
|
// Component for runtime environment variables
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;AAEH,mCAAmC;AACnC,iDAAyE;AAAhE,gHAAA,kBAAkB,OAAA;AAAE,6GAAA,eAAe,OAAA;AAE5C,sEAAsE;AACtE,mCAA6D;AAApD,mGAAA,SAAS,OAAA;AAElB,8CAA8C;AAC9C,2CAA0E;AAAjE,6GAAA,eAAe,OAAA;AAExB,0CAA0C;AAC1C,mCAA+B;AAAtB,6FAAA,GAAG,OAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* React-specific exports for Next.js configuration management.
|
|
4
|
+
*
|
|
5
|
+
* This module provides React context providers and hooks for accessing
|
|
6
|
+
* configuration in React server components. These exports require React
|
|
7
|
+
* to be available in the runtime environment.
|
|
8
|
+
*
|
|
9
|
+
* For React-free configuration loading (API routes, middleware), use the
|
|
10
|
+
* main package exports instead:
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // API routes, middleware (React-free)
|
|
15
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
16
|
+
*
|
|
17
|
+
* // React server components (React context)
|
|
18
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // In layout.tsx (Server Component)
|
|
24
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
25
|
+
* import { ConfigProvider } from '@dyanet/nextjs-config-aws/react';
|
|
26
|
+
*
|
|
27
|
+
* export default async function RootLayout({ children }) {
|
|
28
|
+
* const config = await getConfig({ schema });
|
|
29
|
+
* return (
|
|
30
|
+
* <html>
|
|
31
|
+
* <body>
|
|
32
|
+
* <ConfigProvider config={config}>
|
|
33
|
+
* {children}
|
|
34
|
+
* </ConfigProvider>
|
|
35
|
+
* </body>
|
|
36
|
+
* </html>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @packageDocumentation
|
|
42
|
+
*/
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.ConfigContext = exports.useConfig = exports.ConfigProvider = exports.createConfigProvider = void 0;
|
|
45
|
+
var config_provider_1 = require("./server/config-provider");
|
|
46
|
+
Object.defineProperty(exports, "createConfigProvider", { enumerable: true, get: function () { return config_provider_1.createConfigProvider; } });
|
|
47
|
+
Object.defineProperty(exports, "ConfigProvider", { enumerable: true, get: function () { return config_provider_1.ConfigProvider; } });
|
|
48
|
+
Object.defineProperty(exports, "useConfig", { enumerable: true, get: function () { return config_provider_1.useConfig; } });
|
|
49
|
+
Object.defineProperty(exports, "ConfigContext", { enumerable: true, get: function () { return config_provider_1.ConfigContext; } });
|
|
50
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;;AAEH,4DAKkC;AAJhC,uHAAA,oBAAoB,OAAA;AACpB,iHAAA,cAAc,OAAA;AACd,4GAAA,SAAS,OAAA;AACT,gHAAA,aAAa,OAAA"}
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Server-side exports for Next.js configuration management.
|
|
4
|
+
*
|
|
5
|
+
* This module exports React-free configuration utilities that work in all
|
|
6
|
+
* server contexts including API routes, middleware, and server components.
|
|
7
|
+
*
|
|
8
|
+
* For React context providers (ConfigProvider, useConfig), import from
|
|
9
|
+
* '@dyanet/nextjs-config-aws/react' instead.
|
|
4
10
|
*/
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
12
|
+
exports.invalidateConfig = exports.getConfigCacheSize = exports.clearConfigCache = exports.getConfig = void 0;
|
|
7
13
|
var get_config_1 = require("./get-config");
|
|
8
14
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return get_config_1.getConfig; } });
|
|
9
15
|
Object.defineProperty(exports, "clearConfigCache", { enumerable: true, get: function () { return get_config_1.clearConfigCache; } });
|
|
10
16
|
Object.defineProperty(exports, "getConfigCacheSize", { enumerable: true, get: function () { return get_config_1.getConfigCacheSize; } });
|
|
11
17
|
Object.defineProperty(exports, "invalidateConfig", { enumerable: true, get: function () { return get_config_1.invalidateConfig; } });
|
|
12
|
-
var config_provider_1 = require("./config-provider");
|
|
13
|
-
Object.defineProperty(exports, "createConfigProvider", { enumerable: true, get: function () { return config_provider_1.createConfigProvider; } });
|
|
14
|
-
Object.defineProperty(exports, "ConfigProvider", { enumerable: true, get: function () { return config_provider_1.ConfigProvider; } });
|
|
15
|
-
Object.defineProperty(exports, "useConfig", { enumerable: true, get: function () { return config_provider_1.useConfig; } });
|
|
16
|
-
Object.defineProperty(exports, "ConfigContext", { enumerable: true, get: function () { return config_provider_1.ConfigContext; } });
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,2CAMsB;AALpB,uGAAA,SAAS,OAAA;AACT,8GAAA,gBAAgB,OAAA;AAChB,gHAAA,kBAAkB,OAAA;AAClB,8GAAA,gBAAgB,OAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* // Server-side configuration loading
|
|
10
|
+
* // Server-side configuration loading (works in API routes, middleware, etc.)
|
|
11
11
|
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
12
12
|
*
|
|
13
13
|
* const config = await getConfig({
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
* const apiUrl = env('API_URL');
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // React context providers (for server components only)
|
|
36
|
+
* // Import from '@dyanet/nextjs-config-aws/react' to avoid loading React
|
|
37
|
+
* // in non-React contexts like API routes
|
|
38
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
33
41
|
* @remarks
|
|
34
42
|
* For advanced loader access, custom loaders, or direct AWS SDK integration,
|
|
35
43
|
* import from `@dyanet/config-aws` directly:
|
|
@@ -47,7 +55,7 @@
|
|
|
47
55
|
*/
|
|
48
56
|
// Error classes for error handling
|
|
49
57
|
export { ConfigurationError, ValidationError } from '@dyanet/config-aws';
|
|
50
|
-
// Server-side configuration loading
|
|
58
|
+
// Server-side configuration loading (React-free, works in API routes)
|
|
51
59
|
export { getConfig } from './server';
|
|
52
60
|
// Component for runtime environment variables
|
|
53
61
|
export { PublicEnvScript } from './components';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,mCAAmC;AACnC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEzE,sEAAsE;AACtE,OAAO,EAAE,SAAS,EAA0B,MAAM,UAAU,CAAC;AAE7D,8CAA8C;AAC9C,OAAO,EAAE,eAAe,EAA6B,MAAM,cAAc,CAAC;AAE1E,0CAA0C;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React-specific exports for Next.js configuration management.
|
|
3
|
+
*
|
|
4
|
+
* This module provides React context providers and hooks for accessing
|
|
5
|
+
* configuration in React server components. These exports require React
|
|
6
|
+
* to be available in the runtime environment.
|
|
7
|
+
*
|
|
8
|
+
* For React-free configuration loading (API routes, middleware), use the
|
|
9
|
+
* main package exports instead:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // API routes, middleware (React-free)
|
|
14
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
15
|
+
*
|
|
16
|
+
* // React server components (React context)
|
|
17
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // In layout.tsx (Server Component)
|
|
23
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
24
|
+
* import { ConfigProvider } from '@dyanet/nextjs-config-aws/react';
|
|
25
|
+
*
|
|
26
|
+
* export default async function RootLayout({ children }) {
|
|
27
|
+
* const config = await getConfig({ schema });
|
|
28
|
+
* return (
|
|
29
|
+
* <html>
|
|
30
|
+
* <body>
|
|
31
|
+
* <ConfigProvider config={config}>
|
|
32
|
+
* {children}
|
|
33
|
+
* </ConfigProvider>
|
|
34
|
+
* </body>
|
|
35
|
+
* </html>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @packageDocumentation
|
|
41
|
+
*/
|
|
42
|
+
export { createConfigProvider, ConfigProvider, useConfig, ConfigContext, } from './server/config-provider';
|
|
43
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,GACd,MAAM,0BAA0B,CAAC"}
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server-side exports for Next.js configuration management.
|
|
3
|
+
*
|
|
4
|
+
* This module exports React-free configuration utilities that work in all
|
|
5
|
+
* server contexts including API routes, middleware, and server components.
|
|
6
|
+
*
|
|
7
|
+
* For React context providers (ConfigProvider, useConfig), import from
|
|
8
|
+
* '@dyanet/nextjs-config-aws/react' instead.
|
|
3
9
|
*/
|
|
4
10
|
export { getConfig, clearConfigCache, getConfigCacheSize, invalidateConfig, } from './get-config';
|
|
5
|
-
export { createConfigProvider, ConfigProvider, useConfig, ConfigContext, } from './config-provider';
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,cAAc,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* // Server-side configuration loading
|
|
10
|
+
* // Server-side configuration loading (works in API routes, middleware, etc.)
|
|
11
11
|
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
12
12
|
*
|
|
13
13
|
* const config = await getConfig({
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
* const apiUrl = env('API_URL');
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // React context providers (for server components only)
|
|
36
|
+
* // Import from '@dyanet/nextjs-config-aws/react' to avoid loading React
|
|
37
|
+
* // in non-React contexts like API routes
|
|
38
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
33
41
|
* @remarks
|
|
34
42
|
* For advanced loader access, custom loaders, or direct AWS SDK integration,
|
|
35
43
|
* import from `@dyanet/config-aws` directly:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAGH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React-specific exports for Next.js configuration management.
|
|
3
|
+
*
|
|
4
|
+
* This module provides React context providers and hooks for accessing
|
|
5
|
+
* configuration in React server components. These exports require React
|
|
6
|
+
* to be available in the runtime environment.
|
|
7
|
+
*
|
|
8
|
+
* For React-free configuration loading (API routes, middleware), use the
|
|
9
|
+
* main package exports instead:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // API routes, middleware (React-free)
|
|
14
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
15
|
+
*
|
|
16
|
+
* // React server components (React context)
|
|
17
|
+
* import { ConfigProvider, useConfig } from '@dyanet/nextjs-config-aws/react';
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // In layout.tsx (Server Component)
|
|
23
|
+
* import { getConfig } from '@dyanet/nextjs-config-aws';
|
|
24
|
+
* import { ConfigProvider } from '@dyanet/nextjs-config-aws/react';
|
|
25
|
+
*
|
|
26
|
+
* export default async function RootLayout({ children }) {
|
|
27
|
+
* const config = await getConfig({ schema });
|
|
28
|
+
* return (
|
|
29
|
+
* <html>
|
|
30
|
+
* <body>
|
|
31
|
+
* <ConfigProvider config={config}>
|
|
32
|
+
* {children}
|
|
33
|
+
* </ConfigProvider>
|
|
34
|
+
* </body>
|
|
35
|
+
* </html>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @packageDocumentation
|
|
41
|
+
*/
|
|
42
|
+
export { createConfigProvider, ConfigProvider, useConfig, ConfigContext, } from './server/config-provider';
|
|
43
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,GACd,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server-side exports for Next.js configuration management.
|
|
3
|
+
*
|
|
4
|
+
* This module exports React-free configuration utilities that work in all
|
|
5
|
+
* server contexts including API routes, middleware, and server components.
|
|
6
|
+
*
|
|
7
|
+
* For React context providers (ConfigProvider, useConfig), import from
|
|
8
|
+
* '@dyanet/nextjs-config-aws/react' instead.
|
|
3
9
|
*/
|
|
4
10
|
export { getConfig, clearConfigCache, getConfigCacheSize, invalidateConfig, type NextConfigOptions, } from './get-config';
|
|
5
|
-
export { createConfigProvider, ConfigProvider, useConfig, ConfigContext, } from './config-provider';
|
|
6
11
|
export type { AwsOptions } from './internal/loader-factory';
|
|
7
12
|
export type { EnvironmentMode } from './internal/environment';
|
|
8
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dyanet/nextjs-config-aws",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Next.js adapter for AWS configuration management with support for server components, runtime environment variables, and AWS services integration",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"import": "./dist/esm/index.js",
|
|
11
11
|
"require": "./dist/cjs/index.js",
|
|
12
12
|
"types": "./dist/types/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"import": "./dist/esm/react.js",
|
|
16
|
+
"require": "./dist/cjs/react.js",
|
|
17
|
+
"types": "./dist/types/react.d.ts"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -49,8 +54,8 @@
|
|
|
49
54
|
"author": "Dyanet",
|
|
50
55
|
"license": "MIT",
|
|
51
56
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
53
|
-
"npm": ">=
|
|
57
|
+
"node": ">=20.0.0",
|
|
58
|
+
"npm": ">=10.0.0"
|
|
54
59
|
},
|
|
55
60
|
"publishConfig": {
|
|
56
61
|
"access": "public",
|
|
@@ -74,7 +79,7 @@
|
|
|
74
79
|
"jest": "^29.5.0",
|
|
75
80
|
"next": "^16.0.0",
|
|
76
81
|
"react": "^19.0.0",
|
|
77
|
-
"rimraf": "^
|
|
82
|
+
"rimraf": "^6.0.0",
|
|
78
83
|
"ts-jest": "^29.1.0",
|
|
79
84
|
"typescript": "^5.9.2",
|
|
80
85
|
"zod": "^3.22.0"
|