@gigadrive/network-config 3.3.2 → 3.4.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.
@@ -0,0 +1,15 @@
1
+ // src/nextjs-image-loader.ts
2
+ var filenameHint = (source) => {
3
+ const pathname = source.startsWith("http://") || source.startsWith("https://") ? new URL(source).pathname : source;
4
+ const candidate = pathname.split("/").filter(Boolean).at(-1)?.split("?")[0] ?? "image";
5
+ return /\.[A-Za-z0-9]{2,5}$/.test(candidate) ? candidate : `${candidate || "image"}.image`;
6
+ };
7
+ function gigadriveNextImageLoader({ src, width, quality }) {
8
+ const parameters = new URLSearchParams({ width: String(width) });
9
+ if (quality !== void 0) parameters.set("quality", String(quality));
10
+ return `/_gigadrive/image/${encodeURIComponent(src)}/${encodeURIComponent(filenameHint(src))}?${parameters}`;
11
+ }
12
+ export {
13
+ gigadriveNextImageLoader as default
14
+ };
15
+ //# sourceMappingURL=nextjs-image-loader.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/nextjs-image-loader.ts"],"sourcesContent":["interface NextImageLoaderOptions {\n src: string;\n width: number;\n quality?: number;\n}\n\nconst filenameHint = (source: string): string => {\n const pathname = source.startsWith('http://') || source.startsWith('https://') ? new URL(source).pathname : source;\n const candidate = pathname.split('/').filter(Boolean).at(-1)?.split('?')[0] ?? 'image';\n return /\\.[A-Za-z0-9]{2,5}$/.test(candidate) ? candidate : `${candidate || 'image'}.image`;\n};\n\n/** Builds the stable app-host URL consumed by Gigadrive's managed image optimizer. */\nexport default function gigadriveNextImageLoader({ src, width, quality }: NextImageLoaderOptions): string {\n const parameters = new URLSearchParams({ width: String(width) });\n if (quality !== undefined) parameters.set('quality', String(quality));\n return `/_gigadrive/image/${encodeURIComponent(src)}/${encodeURIComponent(filenameHint(src))}?${parameters}`;\n}\n"],"mappings":";AAMA,IAAM,eAAe,CAAC,WAA2B;AAC/C,QAAM,WAAW,OAAO,WAAW,SAAS,KAAK,OAAO,WAAW,UAAU,IAAI,IAAI,IAAI,MAAM,EAAE,WAAW;AAC5G,QAAM,YAAY,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,EAAE,CAAC,KAAK;AAC/E,SAAO,sBAAsB,KAAK,SAAS,IAAI,YAAY,GAAG,aAAa,OAAO;AACpF;AAGe,SAAR,yBAA0C,EAAE,KAAK,OAAO,QAAQ,GAAmC;AACxG,QAAM,aAAa,IAAI,gBAAgB,EAAE,OAAO,OAAO,KAAK,EAAE,CAAC;AAC/D,MAAI,YAAY,OAAW,YAAW,IAAI,WAAW,OAAO,OAAO,CAAC;AACpE,SAAO,qBAAqB,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,aAAa,GAAG,CAAC,CAAC,IAAI,UAAU;AAC5G;","names":[]}
@@ -26,6 +26,91 @@
26
26
  "type": ["boolean", "null"],
27
27
  "description": "If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false."
28
28
  },
29
+ "images": {
30
+ "type": ["object", "null"],
31
+ "description": "Managed image optimization policy for this deployment.",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "localPatterns": {
35
+ "type": "array",
36
+ "maxItems": 64,
37
+ "items": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "pathname": { "type": "string", "minLength": 1, "maxLength": 2048 },
42
+ "search": { "type": "string", "maxLength": 2048 }
43
+ }
44
+ }
45
+ },
46
+ "remotePatterns": {
47
+ "type": "array",
48
+ "maxItems": 64,
49
+ "items": {
50
+ "type": "object",
51
+ "required": ["hostname"],
52
+ "additionalProperties": false,
53
+ "properties": {
54
+ "protocol": { "type": "string", "enum": ["http", "https"] },
55
+ "hostname": { "type": "string", "minLength": 1, "maxLength": 253 },
56
+ "port": { "type": "string", "pattern": "^[0-9]{0,5}$" },
57
+ "pathname": { "type": "string", "minLength": 1, "maxLength": 2048 },
58
+ "search": { "type": "string", "maxLength": 2048 }
59
+ }
60
+ }
61
+ },
62
+ "widths": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "maxItems": 64,
66
+ "uniqueItems": true,
67
+ "items": { "type": "integer", "minimum": 1, "maximum": 8192 }
68
+ },
69
+ "heights": {
70
+ "type": "array",
71
+ "maxItems": 64,
72
+ "uniqueItems": true,
73
+ "items": { "type": "integer", "minimum": 1, "maximum": 8192 }
74
+ },
75
+ "qualities": {
76
+ "type": "array",
77
+ "minItems": 1,
78
+ "maxItems": 100,
79
+ "uniqueItems": true,
80
+ "items": { "type": "integer", "minimum": 1, "maximum": 100 }
81
+ },
82
+ "formats": {
83
+ "type": "array",
84
+ "minItems": 1,
85
+ "maxItems": 4,
86
+ "uniqueItems": true,
87
+ "items": { "type": "string", "enum": ["image/avif", "image/webp", "image/jpeg", "image/png"] }
88
+ },
89
+ "minimumCacheTTL": { "type": "integer", "minimum": 0, "maximum": 31536000 },
90
+ "dangerouslyAllowSVG": { "type": "boolean" },
91
+ "contentSecurityPolicy": { "type": "string", "maxLength": 4096 },
92
+ "contentDispositionType": { "type": "string", "enum": ["inline", "attachment"] },
93
+ "maximumRedirects": { "type": "integer", "minimum": 0, "maximum": 10 },
94
+ "maximumResponseBody": { "type": "integer", "minimum": 1024, "maximum": 104857600 },
95
+ "variants": {
96
+ "type": "object",
97
+ "maxProperties": 100,
98
+ "propertyNames": { "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$" },
99
+ "additionalProperties": {
100
+ "type": "object",
101
+ "minProperties": 1,
102
+ "additionalProperties": false,
103
+ "properties": {
104
+ "width": { "type": "integer", "minimum": 1, "maximum": 8192 },
105
+ "height": { "type": "integer", "minimum": 1, "maximum": 8192 },
106
+ "quality": { "type": "integer", "minimum": 1, "maximum": 100 },
107
+ "format": { "type": "string", "enum": ["image/avif", "image/webp", "image/jpeg", "image/png"] },
108
+ "fit": { "type": "string", "enum": ["contain", "cover", "fill", "inside", "outside"] }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ },
29
114
  "regions": {
30
115
  "type": ["array", "null"],
31
116
  "description": "The regions to which the project will be deployed. Use \"global\" to deploy to all regions. More regions will incur higher costs.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigadrive/network-config",
3
- "version": "3.3.2",
3
+ "version": "3.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Gigadrive/sdk.git",
@@ -18,6 +18,21 @@
18
18
  "types": "./dist/nextjs-adapter.d.ts",
19
19
  "require": "./dist/nextjs-adapter.cjs",
20
20
  "import": "./dist/nextjs-adapter.mjs"
21
+ },
22
+ "./nextjs-cache-handler": {
23
+ "types": "./dist/nextjs-cache-handler.d.ts",
24
+ "require": "./dist/nextjs-cache-handler.js",
25
+ "import": "./dist/nextjs-cache-handler.mjs"
26
+ },
27
+ "./nextjs-cache-components-handler": {
28
+ "types": "./dist/nextjs-cache-components-handler.d.ts",
29
+ "require": "./dist/nextjs-cache-components-handler.js",
30
+ "import": "./dist/nextjs-cache-components-handler.mjs"
31
+ },
32
+ "./nextjs-image-loader": {
33
+ "types": "./dist/nextjs-image-loader.d.ts",
34
+ "require": "./dist/nextjs-image-loader.js",
35
+ "import": "./dist/nextjs-image-loader.mjs"
21
36
  }
22
37
  },
23
38
  "main": "dist/index.js",
@@ -33,7 +48,7 @@
33
48
  "minimatch": "^10.0.3",
34
49
  "safe-regex2": "^5.0.0",
35
50
  "yaml": "^2.8.1",
36
- "@gigadrive/build-utils": "1.0.2",
51
+ "@gigadrive/build-utils": "1.0.3",
37
52
  "@gigadrive/commons": "2.1.1"
38
53
  },
39
54
  "devDependencies": {
@@ -41,7 +56,8 @@
41
56
  "@effect/platform-node": "^0.107.0",
42
57
  "@types/node": "^24.13.3",
43
58
  "effect": "^3.19.17",
44
- "esbuild": "^0.28.0"
59
+ "esbuild": "^0.28.0",
60
+ "next": "16.2.10"
45
61
  },
46
62
  "peerDependencies": {
47
63
  "@effect/platform": "^0.94.5 || ^0.96.0",
@@ -26,6 +26,91 @@
26
26
  "type": ["boolean", "null"],
27
27
  "description": "If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false."
28
28
  },
29
+ "images": {
30
+ "type": ["object", "null"],
31
+ "description": "Managed image optimization policy for this deployment.",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "localPatterns": {
35
+ "type": "array",
36
+ "maxItems": 64,
37
+ "items": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "pathname": { "type": "string", "minLength": 1, "maxLength": 2048 },
42
+ "search": { "type": "string", "maxLength": 2048 }
43
+ }
44
+ }
45
+ },
46
+ "remotePatterns": {
47
+ "type": "array",
48
+ "maxItems": 64,
49
+ "items": {
50
+ "type": "object",
51
+ "required": ["hostname"],
52
+ "additionalProperties": false,
53
+ "properties": {
54
+ "protocol": { "type": "string", "enum": ["http", "https"] },
55
+ "hostname": { "type": "string", "minLength": 1, "maxLength": 253 },
56
+ "port": { "type": "string", "pattern": "^[0-9]{0,5}$" },
57
+ "pathname": { "type": "string", "minLength": 1, "maxLength": 2048 },
58
+ "search": { "type": "string", "maxLength": 2048 }
59
+ }
60
+ }
61
+ },
62
+ "widths": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "maxItems": 64,
66
+ "uniqueItems": true,
67
+ "items": { "type": "integer", "minimum": 1, "maximum": 8192 }
68
+ },
69
+ "heights": {
70
+ "type": "array",
71
+ "maxItems": 64,
72
+ "uniqueItems": true,
73
+ "items": { "type": "integer", "minimum": 1, "maximum": 8192 }
74
+ },
75
+ "qualities": {
76
+ "type": "array",
77
+ "minItems": 1,
78
+ "maxItems": 100,
79
+ "uniqueItems": true,
80
+ "items": { "type": "integer", "minimum": 1, "maximum": 100 }
81
+ },
82
+ "formats": {
83
+ "type": "array",
84
+ "minItems": 1,
85
+ "maxItems": 4,
86
+ "uniqueItems": true,
87
+ "items": { "type": "string", "enum": ["image/avif", "image/webp", "image/jpeg", "image/png"] }
88
+ },
89
+ "minimumCacheTTL": { "type": "integer", "minimum": 0, "maximum": 31536000 },
90
+ "dangerouslyAllowSVG": { "type": "boolean" },
91
+ "contentSecurityPolicy": { "type": "string", "maxLength": 4096 },
92
+ "contentDispositionType": { "type": "string", "enum": ["inline", "attachment"] },
93
+ "maximumRedirects": { "type": "integer", "minimum": 0, "maximum": 10 },
94
+ "maximumResponseBody": { "type": "integer", "minimum": 1024, "maximum": 104857600 },
95
+ "variants": {
96
+ "type": "object",
97
+ "maxProperties": 100,
98
+ "propertyNames": { "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$" },
99
+ "additionalProperties": {
100
+ "type": "object",
101
+ "minProperties": 1,
102
+ "additionalProperties": false,
103
+ "properties": {
104
+ "width": { "type": "integer", "minimum": 1, "maximum": 8192 },
105
+ "height": { "type": "integer", "minimum": 1, "maximum": 8192 },
106
+ "quality": { "type": "integer", "minimum": 1, "maximum": 100 },
107
+ "format": { "type": "string", "enum": ["image/avif", "image/webp", "image/jpeg", "image/png"] },
108
+ "fit": { "type": "string", "enum": ["contain", "cover", "fill", "inside", "outside"] }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ },
29
114
  "regions": {
30
115
  "type": ["array", "null"],
31
116
  "description": "The regions to which the project will be deployed. Use \"global\" to deploy to all regions. More regions will incur higher costs.",