-
Notifications
You must be signed in to change notification settings - Fork 179
/
next.config.js
468 lines (463 loc) · 18.2 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
/** @type {import('next').NextConfig} */
const redirectBase = process.env.NEXT_PUBLIC_BASE_PATH
? `${process.env.NEXT_PUBLIC_BASE_PATH}/`
: "";
const securityHeaders = [
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'Content-Security-Policy',
value: "frame-ancestors 'none';"
}
]
const nextConfig = {
reactStrictMode: true,
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "",
assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH || "",
images: {
loader: "custom",
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
nextImageExportOptimizer: {
imageFolderPath: "public/images",
exportFolderPath: "out",
quality: 75,
},
},
env: {
storePicturesInWEBP: true,
generateAndUseBlurImages: true,
distServer: "https://dist.ballerina.io",
gitHubPath:
"https://github.com/ballerina-platform/ballerina-dev-website/blob/master/",
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/:path*',
headers: securityHeaders,
},
]
},
async rewrites() {
return [
{
source: `/learn/build-a-data-service-in-ballerina`,
destination: `/learn/resources/featured-scenarios/build-a-data-service-in-ballerina`,
},
{
source: `/${redirectBase}learn/deploy-ballerina-on-kubernetes`,
destination: `/${redirectBase}learn/resources/featured-scenarios/deploy-ballerina-on-kubernetes`,
},
{
source: `/${redirectBase}learn/create-your-first-connector-with-ballerina`,
destination: `/${redirectBase}learn/resources/featured-scenarios/create-your-first-connector-with-ballerina`,
},
{
source: `/${redirectBase}learn/manage-data-persistence-with-bal-persist`,
destination: `/${redirectBase}learn/resources/featured-scenarios/manage-data-persistence-with-bal-persist`,
},
{
source: `/${redirectBase}learn/work-with-data-using-queries-in-ballerina`,
destination: `/${redirectBase}learn/resources/featured-scenarios/work-with-data-using-queries-in-ballerina`,
},
{
source: `/${redirectBase}learn/write-a-graphql-api-with-ballerina`,
destination: `/${redirectBase}learn/resources/featured-scenarios/write-a-graphql-api-with-ballerina`,
},
{
source: `/${redirectBase}learn/write-a-grpc-service-with-ballerina`,
destination: `/${redirectBase}learn/resources/featured-scenarios/write-a-grpc-service-with-ballerina`,
},
{
source: `/${redirectBase}learn/write-a-restful-api-with-ballerina`,
destination: `/${redirectBase}learn/resources/featured-scenarios/write-a-restful-api-with-ballerina`,
},
{
source: `/${redirectBase}learn/get-started`,
destination: `/${redirectBase}learn/integration/get-started`,
},
{
source: `/${redirectBase}learn/vs-code-extension/get-started`,
destination: `/${redirectBase}learn/vs-code-extension/get-started`,
},
{
source: `/${redirectBase}learn/ballerina-specifications`,
destination: `/${redirectBase}learn/references/ballerina-specifications`,
},
{
source: `/${redirectBase}learn/language-basics`,
destination: `/${redirectBase}learn/resources/learn-the-language/language-basics`,
},
{
source: `/${redirectBase}learn/language-walkthrough`,
destination: `/${redirectBase}learn/resources/learn-the-language/language-walkthrough`,
},
{
source: `/${redirectBase}learn/network-interaction`,
destination: `/${redirectBase}learn/resources/learn-the-language/network-interaction`,
},
{
source: `/${redirectBase}learn/concurrency`,
destination: `/${redirectBase}learn/resources/learn-the-language/concurrency`,
},
{
source: `/${redirectBase}learn/advanced-general-purpose-language-features`,
destination: `/${redirectBase}learn/resources/learn-the-language/advanced-general-purpose-language-features`,
},
{
source: `/${redirectBase}learn/data`,
destination: `/${redirectBase}learn/resources/learn-the-language/data`,
},
{
source: `/${redirectBase}learn/installation-options`,
destination: `/${redirectBase}learn/get-started/installation-options`,
},
{
source: "/learn",
destination: "/learn/get-started/install-ballerina/set-up-ballerina",
},
{
source: `/${redirectBase}learn/openapi-tool`,
destination: `/${redirectBase}learn/integration-tools/openapi-tool`,
},
{
source: `/${redirectBase}learn/graphql-tool`,
destination: `/${redirectBase}learn/integration-tools/graphql-tool`,
},
{
source: `/${redirectBase}learn/asyncapi-tool`,
destination: `/${redirectBase}learn/integration-tools/asyncapi-tool`,
},
{
source: `/${redirectBase}learn/grpc-tool`,
destination: `/${redirectBase}learn/integration-tools/grpc-tool`,
},
{
source: `/${redirectBase}learn/strand-dump-tool`,
destination: `/${redirectBase}learn/development-tutorials/troubleshoot-the-runtime/strand-dump-tool`,
},
{
source: `/${redirectBase}learn/ballerina-profiler`,
destination: `/${redirectBase}learn/development-tutorials/troubleshoot-the-runtime/ballerina-profiler`,
},
{
source: `/${redirectBase}learn/edi-tool`,
destination: `/${redirectBase}learn/integration-tools/edi-tool`,
},
{
source: `/${redirectBase}learn/health-tool`,
destination: `/${redirectBase}learn/integration-tools/health-tool`,
},
{
source: `/${redirectBase}learn/bal-persist-overview`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/bal-persist-overview`,
},
{
source: `/${redirectBase}learn/persist-cli-tool`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/persist-cli-tool`,
},
{
source: `/${redirectBase}learn/persist-model`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/persist-model`,
},
{
source: `/${redirectBase}learn/persist-client-api`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/persist-client-api`,
},
{
source: `/${redirectBase}learn/persist-introspection`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/persist-introspection`,
},
{
source: `/${redirectBase}learn/supported-data-stores`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-persist/supported-data-stores`,
},
{
source: `/${redirectBase}learn/call-java-code-from-ballerina`,
destination: `/${redirectBase}learn/development-tutorials/java-interoperability/call-java-code-from-ballerina`,
},
{
source: `/${redirectBase}learn/the-bindgen-tool`,
destination: `/${redirectBase}learn/development-tutorials/java-interoperability/the-bindgen-tool`,
},
{
source: `/${redirectBase}learn/ballerina-ffi`,
destination: `/${redirectBase}learn/development-tutorials/java-interoperability/ballerina-ffi`,
},
{
source: `/${redirectBase}learn/debug-ballerina-programs`,
destination: `/${redirectBase}learn/development-tutorials/test-document-the-code/debug-ballerina-programs`,
},
{
source: `/${redirectBase}learn/generate-code-documentation`,
destination: `/${redirectBase}learn/development-tutorials/test-document-the-code/generate-code-documentation`,
},
{
source: `/${redirectBase}learn/manage-dependencies`,
destination: `/${redirectBase}learn/development-tutorials/source-code-dependencies/manage-dependencies`,
},
{
source: `/${redirectBase}learn/configure-a-sample-ballerina-service`,
destination: `/${redirectBase}learn/development-tutorials/configurability/configure-a-sample-ballerina-service`,
},
{
source: `/${redirectBase}learn/configure-values`,
destination: `/${redirectBase}learn/development-tutorials/configurability/configure-values`,
},
{
source: `/${redirectBase}learn/provide-values-to-configurable-variables`,
destination: `/${redirectBase}learn/development-tutorials/configurability/provide-values-to-configurable-variables`,
},
{
source: `/${redirectBase}learn/observe-ballerina-programs`,
destination: `/${redirectBase}learn/development-tutorials/observability/observe-ballerina-programs`,
},
{
source: `/${redirectBase}learn/observe-logs`,
destination: `/${redirectBase}learn/development-tutorials/observability/observe-logs`,
},
{
source: `/${redirectBase}learn/observe-metrics`,
destination: `/${redirectBase}learn/development-tutorials/observability/observe-metrics`,
},
{
source: `/${redirectBase}learn/observe-tracing`,
destination: `/${redirectBase}learn/development-tutorials/observability/observe-tracing`,
},
{
source: `/${redirectBase}learn/organize-ballerina-code`,
destination: `/${redirectBase}learn/development-tutorials/source-code-dependencies/organize-ballerina-code`,
},
{
source: `/${redirectBase}learn/publish-packages-to-ballerina-central`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-central/publish-packages-to-ballerina-central`,
},
{
source: `/${redirectBase}learn/configure-a-network-proxy`,
destination: `/${redirectBase}learn/development-tutorials/ballerina-central/configure-a-network-proxy`,
},
{
source: `/${redirectBase}learn/code-to-cloud-deployment`,
destination: `/${redirectBase}learn/development-tutorials/run-in-the-cloud/code-to-cloud-deployment`,
},
{
source: `/${redirectBase}learn/azure-functions`,
destination: `/${redirectBase}learn/development-tutorials/run-in-the-cloud/azure-functions`,
},
{
source: `/${redirectBase}learn/aws-lambda`,
destination: `/${redirectBase}learn/development-tutorials/run-in-the-cloud/aws-lambda`,
},
{
source: `/${redirectBase}learn/test-ballerina-code/:slug`,
destination: `/${redirectBase}learn/development-tutorials/test-document-the-code/test-ballerina-code/:slug`,
},
{
source: `/${redirectBase}learn/package-references`,
destination: `/${redirectBase}learn/development-tutorials/source-code-dependencies/package-references`,
},
{
source: `/${redirectBase}learn/customize-formatting`,
destination: `/${redirectBase}learn/development-tutorials/source-code-dependencies/customize-formatting`,
},
{
source: `/${redirectBase}learn/cli-commands/`,
destination: `/${redirectBase}learn/development-tutorials/build-and-run/cli-commands/`,
},
{
source: `/${redirectBase}learn/update-tool/`,
destination: `/${redirectBase}learn/development-tutorials/build-and-run/update-tool/`,
},
{
source: `/${redirectBase}learn/ballerina-shell/`,
destination: `/${redirectBase}learn/development-tutorials/build-and-run/ballerina-shell/`,
},
{
source: `/${redirectBase}learn/style-guide/:slug`,
destination: `/${redirectBase}learn/development-tutorials/source-code-dependencies/style-guide/:slug`,
},
{
source: `/${redirectBase}learn/style-guide/coding-conventions/:slug`,
destination: `/${redirectBase}learn/references/style-guide/coding-conventions/:slug`,
},
{
source: `/${redirectBase}learn/graalvm-executable-overview`,
destination: `/${redirectBase}learn/development-tutorials/build-a-graalvm-executable/graalvm-executable-overview`,
},
{
source: `/${redirectBase}learn/build-the-executable-locally`,
destination: `/${redirectBase}learn/development-tutorials/build-a-graalvm-executable/build-the-executable-locally`,
},
{
source: `/${redirectBase}learn/build-the-executable-in-a-container`,
destination: `/${redirectBase}learn/development-tutorials/build-a-graalvm-executable/build-the-executable-in-a-container`,
},
{
source: `/${redirectBase}downloads/swan-lake-release-notes`,
destination: `/${redirectBase}downloads/swan-lake-release-notes/2201.0.2`,
},
{
source: `/${redirectBase}1.2/learn/`,
destination: `/${redirectBase}1.2/learn/index.html`,
},
{
source: `/${redirectBase}1.2/learn/api-docs/ballerina/`,
destination: `/${redirectBase}1.2/learn/api-docs/ballerina/index.html`,
},
{
source: `/${redirectBase}1.1/learn/`,
destination: `/${redirectBase}1.1/learn/index.html`,
},
{
source: `/${redirectBase}1.1/learn/api-docs/ballerina/`,
destination: `/${redirectBase}1.1/learn/api-docs/ballerina/index.html`,
},
{
source: `/${redirectBase}1.0/learn/`,
destination: `/${redirectBase}1.0/learn/index.html`,
},
{
source: `/${redirectBase}1.0/learn/api-docs/ballerina/`,
destination: `/${redirectBase}1.0/learn/api-docs/ballerina/index.html`,
},
{
source: `/${redirectBase}0.990/learn/api-docs/ballerina/`,
destination: `/${redirectBase}0.990/learn/api-docs/ballerina/index.html`,
},
{
source: `/cookie-policy`,
destination: `/${redirectBase}policies/cookie-policy`,
},
{
source: `/license-of-site`,
destination: `/${redirectBase}policies/license-of-site`,
},
{
source: `/terms-of-service`,
destination: `/${redirectBase}policies/terms-of-service`,
},
{
source: `/privacy-policy`,
destination: `/${redirectBase}policies/privacy-policy`,
},
{
source: `/security-policy`,
destination: `/${redirectBase}policies/security-policy`,
},
{
source: `/trademark-usage-policy`,
destination: `/${redirectBase}policies/trademark-usage-policy`,
},
{
source: `/code-of-conduct`,
destination: `/${redirectBase}policies/code-of-conduct`,
},
{
source: `/CODEOWNERS`,
destination: `/${redirectBase}policies/CODEOWNERS`,
},
{
source: `/spec/lang/2022R2/`,
destination: `/spec/lang/2022R2/index.html`,
},
{
source: `/spec/lang/2022R1/`,
destination: `/spec/lang/2022R1/index.html`,
},
{
source: `/spec/lang/2021R1/`,
destination: `/spec/lang/2021R1/index.html`,
},
{
source: `/spec/lang/2020R1/`,
destination: `/spec/lang/2020R1/index.html`,
},
{
source: `/spec/lang/2019R3/`,
destination: `/spec/lang/2019R3/index.html`,
},
{
source: `/spec/lang/2019R2/`,
destination: `/spec/lang/2019R2/index.html`,
},
{
source: `/spec/lang/2019R1/`,
destination: `/spec/lang/2019R1/index.html`,
},
{
source: `/learn/supported-data-formats`,
destination: `/learn/integration/supported-data-formats`,
},
{
source: `/learn/supported-network-protocols`,
destination: `/learn/integration/supported-network-protocols`,
},
{
source: `/learn/pre-built-integrations`,
destination: `/learn/integration/pre-built-integrations`,
},
{
source: `/learn/pre-built-integrations/google-sheets-to-salesforce-integration`,
destination: `/learn/integration/pre-built-integrations/google-sheets-to-salesforce-integration`,
},
{
source: `/learn/pre-built-integrations/kafka-to-salesforce-integration`,
destination: `/learn/integration/pre-built-integrations/kafka-to-salesforce-integration`,
},
{
source: `/learn/pre-built-integrations/mysql-to-salesforce-integration`,
destination: `/learn/integration/pre-built-integrations/mysql-to-salesforce-integration`,
},
{
source: `/learn/pre-built-integrations/gmail-to-salesforce-integration`,
destination: `/learn/integration/pre-built-integrations/gmail-to-salesforce-integration`,
},
{
source: `/learn/pre-built-integrations/salesforce-to-twilio-integration`,
destination: `/learn/integration/pre-built-integrations/salesforce-to-twilio-integration`,
},
{
source: `/learn/pre-built-integrations/news-api-to-email-integration`,
destination: `/learn/integration/pre-built-integrations/news-api-to-email-integration`,
},
{
source: `/learn/pre-built-integrations/github-to-email-integration`,
destination: `/learn/integration/pre-built-integrations/github-to-email-integration`,
},
{
source: `/learn/pre-built-integrations/shopify-to-outlook-integration`,
destination: `/learn/integration/pre-built-integrations/shopify-to-outlook-integration`,
},
{
source: `/learn/pre-built-integrations/google-drive-to-onedrive-integration`,
destination: `/learn/integration/pre-built-integrations/google-drive-to-onedrive-integration`,
},
{
source: `/learn/pre-built-integrations/hubspot-contacts-to-google-contacts-integration`,
destination: `/learn/integration/pre-built-integrations/hubspot-contacts-to-google-contacts-integration`,
},
{
source: `/learn/pre-built-integrations/ftp-edi-message-to-salesforce-opportunity`,
destination: `/learn/integration/pre-built-integrations/ftp-edi-message-to-salesforce-opportunity`,
},
{
source: `/learn/integration-tutorials`,
destination: `/learn/integration/integration-tutorials`,
},
{
source: `/learn/integration-tutorials/:slug`,
destination: `/learn/integration/integration-tutorials/:slug`,
}
];
},
trailingSlash: true,
resolve: [{ path: false, fs: false }],
experimental: {
scrollRestoration: true,
}
};
module.exports = nextConfig;