@codedazur/cdk-next-app 1.1.0 → 1.1.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.
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +44 -6
- package/dist/index.mjs +41 -3
- package/eslint.config.ts +5 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @codedazur/cdk-next-app
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9546c16`](https://github.com/codedazur/toolkit/commit/9546c1604999d28552cda24cb998dae0e5d5cbe3) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Cache policies are now configured for the Next.js application.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2734c9d`](https://github.com/codedazur/toolkit/commit/2734c9d2f1a6fbdbae8e7d676b1e06437200df23), [`62b823b`](https://github.com/codedazur/toolkit/commit/62b823bfb366f0b7b037b0485aafe7084fe3743f)]:
|
|
10
|
+
- @codedazur/cdk-docker-cluster@1.1.2
|
|
11
|
+
|
|
12
|
+
## 1.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`b24894a`](https://github.com/codedazur/toolkit/commit/b24894a2de01e596669c2b5aca51bc0b28533106) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Mark the package as side-effect-free for tree shaking.
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`b24894a`](https://github.com/codedazur/toolkit/commit/b24894a2de01e596669c2b5aca51bc0b28533106)]:
|
|
19
|
+
- @codedazur/cdk-docker-cluster@1.1.1
|
|
20
|
+
|
|
3
21
|
## 1.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -8,8 +8,9 @@ interface NextAppProps extends DockerClusterProps {
|
|
|
8
8
|
* A docker cluster preconfigured for running a Next.js application with support
|
|
9
9
|
* for private NPM packages using a build-time secret.
|
|
10
10
|
*
|
|
11
|
-
* @todo
|
|
12
|
-
*
|
|
11
|
+
* @todo Document and standardize a shared cache pool for Next.js applications
|
|
12
|
+
* that run on multiple containers.
|
|
13
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#configuring-caching
|
|
13
14
|
*/
|
|
14
15
|
declare class NextApp extends DockerCluster {
|
|
15
16
|
constructor(scope: Construct, id: string, { source, service: { port, ...service }, distribution, ...props }: NextAppProps);
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ interface NextAppProps extends DockerClusterProps {
|
|
|
8
8
|
* A docker cluster preconfigured for running a Next.js application with support
|
|
9
9
|
* for private NPM packages using a build-time secret.
|
|
10
10
|
*
|
|
11
|
-
* @todo
|
|
12
|
-
*
|
|
11
|
+
* @todo Document and standardize a shared cache pool for Next.js applications
|
|
12
|
+
* that run on multiple containers.
|
|
13
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#configuring-caching
|
|
13
14
|
*/
|
|
14
15
|
declare class NextApp extends DockerCluster {
|
|
15
16
|
constructor(scope: Construct, id: string, { source, service: { port, ...service }, distribution, ...props }: NextAppProps);
|
package/dist/index.js
CHANGED
|
@@ -28,17 +28,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
NextApp: () => NextApp
|
|
34
34
|
});
|
|
35
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/constructs/NextApp.ts
|
|
38
38
|
var import_os = __toESM(require("os"));
|
|
39
39
|
var import_path = __toESM(require("path"));
|
|
40
40
|
var import_cdk_docker_cluster = require("@codedazur/cdk-docker-cluster");
|
|
41
41
|
var import_aws_cdk_lib = require("aws-cdk-lib");
|
|
42
|
+
var import_aws_cloudfront = require("aws-cdk-lib/aws-cloudfront");
|
|
42
43
|
var import_aws_ecs = require("aws-cdk-lib/aws-ecs");
|
|
43
44
|
var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
|
|
44
45
|
constructor(scope, id, {
|
|
@@ -47,7 +48,6 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
|
|
|
47
48
|
distribution,
|
|
48
49
|
...props
|
|
49
50
|
}) {
|
|
50
|
-
var _a;
|
|
51
51
|
super(scope, id, {
|
|
52
52
|
source: _NextApp.withNpmSecret(source),
|
|
53
53
|
...props,
|
|
@@ -58,10 +58,48 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
|
|
|
58
58
|
distribution: {
|
|
59
59
|
...distribution,
|
|
60
60
|
behaviors: {
|
|
61
|
-
...distribution
|
|
61
|
+
...distribution?.behaviors,
|
|
62
|
+
/**
|
|
63
|
+
* API routes should not be cached by the CDN.
|
|
64
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#usage-with-cdns
|
|
65
|
+
*/
|
|
62
66
|
"/api/*": {
|
|
63
67
|
authentication: false,
|
|
64
|
-
|
|
68
|
+
allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_ALL,
|
|
69
|
+
cachePolicy: import_aws_cloudfront.CachePolicy.CACHING_DISABLED,
|
|
70
|
+
...distribution?.behaviors?.["/api/*"]
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Statically generated assets with hashes in the filename. These can
|
|
74
|
+
* be cached forever.
|
|
75
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#automatic-caching
|
|
76
|
+
*/
|
|
77
|
+
"/_next/static/*": {
|
|
78
|
+
allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
79
|
+
cachePolicy: import_aws_cloudfront.CachePolicy.CACHING_OPTIMIZED,
|
|
80
|
+
...distribution?.behaviors?.["/_next/static/*"]
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Assets for Next.js Image Optimization. Caching is based on query
|
|
84
|
+
* strings. This behavior inherits the default cache policy from the
|
|
85
|
+
* DockerCluster, which should be configured to include query
|
|
86
|
+
* strings in the cache key.
|
|
87
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#image-optimization
|
|
88
|
+
*/
|
|
89
|
+
"/_next/image*": {
|
|
90
|
+
allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
91
|
+
...distribution?.behaviors?.["/_next/image*"]
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Page data for client-side navigation. Caching should be aligned
|
|
95
|
+
* with the corresponding page. This behavior inherits the default
|
|
96
|
+
* cache policy, which should respect the origin's Cache-Control
|
|
97
|
+
* headers.
|
|
98
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#caching-and-isr
|
|
99
|
+
*/
|
|
100
|
+
"/_next/data/*": {
|
|
101
|
+
allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
102
|
+
...distribution?.behaviors?.["/_next/data/*"]
|
|
65
103
|
}
|
|
66
104
|
}
|
|
67
105
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
DockerCluster
|
|
6
6
|
} from "@codedazur/cdk-docker-cluster";
|
|
7
7
|
import { DockerBuildSecret } from "aws-cdk-lib";
|
|
8
|
+
import { AllowedMethods, CachePolicy } from "aws-cdk-lib/aws-cloudfront";
|
|
8
9
|
import { ContainerImage } from "aws-cdk-lib/aws-ecs";
|
|
9
10
|
var NextApp = class _NextApp extends DockerCluster {
|
|
10
11
|
constructor(scope, id, {
|
|
@@ -13,7 +14,6 @@ var NextApp = class _NextApp extends DockerCluster {
|
|
|
13
14
|
distribution,
|
|
14
15
|
...props
|
|
15
16
|
}) {
|
|
16
|
-
var _a;
|
|
17
17
|
super(scope, id, {
|
|
18
18
|
source: _NextApp.withNpmSecret(source),
|
|
19
19
|
...props,
|
|
@@ -24,10 +24,48 @@ var NextApp = class _NextApp extends DockerCluster {
|
|
|
24
24
|
distribution: {
|
|
25
25
|
...distribution,
|
|
26
26
|
behaviors: {
|
|
27
|
-
...distribution
|
|
27
|
+
...distribution?.behaviors,
|
|
28
|
+
/**
|
|
29
|
+
* API routes should not be cached by the CDN.
|
|
30
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#usage-with-cdns
|
|
31
|
+
*/
|
|
28
32
|
"/api/*": {
|
|
29
33
|
authentication: false,
|
|
30
|
-
|
|
34
|
+
allowedMethods: AllowedMethods.ALLOW_ALL,
|
|
35
|
+
cachePolicy: CachePolicy.CACHING_DISABLED,
|
|
36
|
+
...distribution?.behaviors?.["/api/*"]
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Statically generated assets with hashes in the filename. These can
|
|
40
|
+
* be cached forever.
|
|
41
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#automatic-caching
|
|
42
|
+
*/
|
|
43
|
+
"/_next/static/*": {
|
|
44
|
+
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
45
|
+
cachePolicy: CachePolicy.CACHING_OPTIMIZED,
|
|
46
|
+
...distribution?.behaviors?.["/_next/static/*"]
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Assets for Next.js Image Optimization. Caching is based on query
|
|
50
|
+
* strings. This behavior inherits the default cache policy from the
|
|
51
|
+
* DockerCluster, which should be configured to include query
|
|
52
|
+
* strings in the cache key.
|
|
53
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#image-optimization
|
|
54
|
+
*/
|
|
55
|
+
"/_next/image*": {
|
|
56
|
+
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
57
|
+
...distribution?.behaviors?.["/_next/image*"]
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Page data for client-side navigation. Caching should be aligned
|
|
61
|
+
* with the corresponding page. This behavior inherits the default
|
|
62
|
+
* cache policy, which should respect the origin's Cache-Control
|
|
63
|
+
* headers.
|
|
64
|
+
* @see https://nextjs.org/docs/app/guides/self-hosting#caching-and-isr
|
|
65
|
+
*/
|
|
66
|
+
"/_next/data/*": {
|
|
67
|
+
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
68
|
+
...distribution?.behaviors?.["/_next/data/*"]
|
|
31
69
|
}
|
|
32
70
|
}
|
|
33
71
|
}
|
package/eslint.config.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codedazur/cdk-next-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"main": ".dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"sideEffects": false,
|
|
17
18
|
"scripts": {
|
|
18
19
|
"develop": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
19
20
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
20
21
|
"audit": "npm audit --omit dev --audit-level high",
|
|
21
|
-
"lint": "
|
|
22
|
+
"lint": "eslint .",
|
|
22
23
|
"types": "tsc --noEmit",
|
|
23
24
|
"test": "vitest run --passWithNoTests"
|
|
24
25
|
},
|
|
@@ -27,12 +28,12 @@
|
|
|
27
28
|
"constructs": ">=10"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@codedazur/cdk-docker-cluster": "^1.1.
|
|
31
|
+
"@codedazur/cdk-docker-cluster": "^1.1.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"aws-cdk-lib": "^2.
|
|
35
|
-
"constructs": "^10.
|
|
36
|
-
"esbuild": "^0.
|
|
34
|
+
"@types/node": "^25.0.3",
|
|
35
|
+
"aws-cdk-lib": "^2.233.0",
|
|
36
|
+
"constructs": "^10.4.4",
|
|
37
|
+
"esbuild": "^0.27.2"
|
|
37
38
|
}
|
|
38
39
|
}
|