@berachain/config 0.2.7 → 0.2.8-beta.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/dist/bepolia.cjs +7 -1
- package/dist/bepolia.mjs +7 -1
- package/dist/chunk-4AMLYLHZ.cjs +144 -0
- package/dist/chunk-4DGMTEOQ.mjs +144 -0
- package/dist/chunk-AU3LYJAB.cjs +75 -0
- package/dist/chunk-B2BTOQVP.cjs +25 -0
- package/dist/chunk-EYYJ2UZT.cjs +10 -0
- package/dist/chunk-F5UIDRP6.mjs +77 -0
- package/dist/chunk-G446M2AV.cjs +135 -0
- package/dist/chunk-GFHZDTK3.mjs +135 -0
- package/dist/chunk-KJXYSGNH.mjs +10 -0
- package/dist/chunk-LALEUPWL.mjs +8 -0
- package/dist/chunk-MNIORAK3.cjs +148 -0
- package/dist/chunk-NF5WIUL6.cjs +77 -0
- package/dist/chunk-OWAB24JG.mjs +25 -0
- package/dist/chunk-UKXTPLZ5.mjs +148 -0
- package/dist/chunk-VWRKCGMU.mjs +75 -0
- package/dist/chunk-XA5DMTFW.mjs +75 -0
- package/dist/chunk-YT7WZDGI.cjs +8 -0
- package/dist/chunk-ZTYHPIUW.cjs +75 -0
- package/dist/index.cjs +10 -1
- package/dist/index.mjs +10 -1
- package/dist/internal/header-sources.cjs +409 -13
- package/dist/internal/header-sources.mjs +409 -13
- package/dist/internal/index.cjs +37 -1
- package/dist/internal/index.mjs +37 -1
- package/dist/internal/maintenance.cjs +24 -1
- package/dist/internal/maintenance.mjs +24 -1
- package/dist/internal/nextjs/index.cjs +83 -1
- package/dist/internal/nextjs/index.mjs +83 -1
- package/dist/internal/nextjs/utils/index.cjs +40 -1
- package/dist/internal/nextjs/utils/index.mjs +40 -1
- package/dist/internal/sentry/index.cjs +10 -1
- package/dist/internal/sentry/index.mjs +10 -1
- package/dist/internal/sentry/sentry.client.config.cjs +65 -1
- package/dist/internal/sentry/sentry.client.config.mjs +65 -1
- package/dist/internal/tailwind/config.d.ts +1 -1
- package/dist/internal/tailwind/index.cjs +237 -1
- package/dist/internal/tailwind/index.d.ts +1 -1
- package/dist/internal/tailwind/index.mjs +237 -1
- package/dist/internal/wagmi/index.cjs +57 -1
- package/dist/internal/wagmi/index.mjs +57 -1
- package/dist/mainnet.cjs +8 -1
- package/dist/mainnet.mjs +8 -1
- package/dist/sentry.edge.config-3Y5ABKSB.cjs +22 -0
- package/dist/sentry.edge.config-SIWSKDGR.mjs +22 -0
- package/dist/sentry.server.config-HY6I2WQ5.mjs +22 -0
- package/dist/sentry.server.config-ZXGUVYT6.cjs +22 -0
- package/package.json +1 -1
- package/dist/chunk-2GCBWNKH.mjs +0 -1
- package/dist/chunk-2OLL4MUY.cjs +0 -1
- package/dist/chunk-2RLHVELA.mjs +0 -2
- package/dist/chunk-5YLBFOPA.mjs +0 -1
- package/dist/chunk-6CZTBBJT.cjs +0 -2
- package/dist/chunk-DUO7UEQD.cjs +0 -1
- package/dist/chunk-HJ25KNL4.cjs +0 -1
- package/dist/chunk-HLFO7V5I.cjs +0 -1
- package/dist/chunk-ITASDGG4.cjs +0 -1
- package/dist/chunk-MS6UGFXI.mjs +0 -1
- package/dist/chunk-MW34QRNX.cjs +0 -1
- package/dist/chunk-N45AQAIZ.mjs +0 -1
- package/dist/chunk-O243TIHY.mjs +0 -1
- package/dist/chunk-QHBQ2EN5.mjs +0 -1
- package/dist/chunk-QYM6VRYU.mjs +0 -1
- package/dist/chunk-WMZLZQ6E.mjs +0 -1
- package/dist/chunk-X5MTSC5T.cjs +0 -1
- package/dist/chunk-YLWSSHG6.cjs +0 -1
- package/dist/sentry.edge.config-AU3IBVBN.cjs +0 -1
- package/dist/sentry.edge.config-PXSVFOH6.mjs +0 -1
- package/dist/sentry.server.config-IOCQ5KDF.cjs +0 -1
- package/dist/sentry.server.config-NEPRXZ2E.mjs +0 -1
|
@@ -1,16 +1,412 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
sentryEnvironment,
|
|
3
|
+
sentryRelease
|
|
4
|
+
} from "../chunk-OWAB24JG.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getUriFromLink
|
|
7
|
+
} from "../chunk-LALEUPWL.mjs";
|
|
8
|
+
import {
|
|
9
|
+
chainConfigs
|
|
10
|
+
} from "../chunk-GFHZDTK3.mjs";
|
|
11
|
+
import "../chunk-UKXTPLZ5.mjs";
|
|
12
|
+
import "../chunk-4DGMTEOQ.mjs";
|
|
13
|
+
import {
|
|
14
|
+
alchemyJsonRpcUrl,
|
|
15
|
+
defaultChainId,
|
|
16
|
+
goldskyBaseUrl,
|
|
17
|
+
imageBaseUrl,
|
|
18
|
+
isProduction,
|
|
19
|
+
jsonRpcUrl,
|
|
20
|
+
publicJsonRpcUrl
|
|
21
|
+
} from "../chunk-VWRKCGMU.mjs";
|
|
22
|
+
import "../chunk-KJXYSGNH.mjs";
|
|
23
|
+
|
|
24
|
+
// src/internal/dedupeCspSources.ts
|
|
25
|
+
function parseSource(raw) {
|
|
26
|
+
const schemeSplit = raw.indexOf("://");
|
|
27
|
+
if (schemeSplit === -1) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
const scheme = raw.slice(0, schemeSplit).toLowerCase();
|
|
31
|
+
const rest = raw.slice(schemeSplit + 3);
|
|
32
|
+
const pathStart = rest.indexOf("/");
|
|
33
|
+
const host = (pathStart === -1 ? rest : rest.slice(0, pathStart)).toLowerCase();
|
|
34
|
+
const path = pathStart === -1 ? "/" : rest.slice(pathStart);
|
|
35
|
+
if (!host) {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
return { raw, scheme, host, path };
|
|
39
|
+
}
|
|
40
|
+
function hostMatches(patternHost, targetHost) {
|
|
41
|
+
if (!patternHost.startsWith("*.")) {
|
|
42
|
+
return patternHost === targetHost;
|
|
43
|
+
}
|
|
44
|
+
const suffix = patternHost.slice(1);
|
|
45
|
+
return targetHost.endsWith(suffix) && targetHost.length > suffix.length;
|
|
46
|
+
}
|
|
47
|
+
function covers(pattern, target) {
|
|
48
|
+
if (pattern.scheme !== target.scheme) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (!hostMatches(pattern.host, target.host)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (pattern.path.endsWith("/")) {
|
|
55
|
+
return target.path.startsWith(pattern.path);
|
|
56
|
+
}
|
|
57
|
+
return target.path === pattern.path;
|
|
58
|
+
}
|
|
59
|
+
function dedupeCspSources(sources) {
|
|
60
|
+
const parsed = sources.map((raw) => ({ raw, parsed: parseSource(raw) }));
|
|
61
|
+
return parsed.filter(({ parsed: target }, i) => {
|
|
62
|
+
if (!target) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return !parsed.some(({ parsed: pattern }, j) => {
|
|
66
|
+
if (i === j || !pattern) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (!covers(pattern, target)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (covers(target, pattern)) {
|
|
73
|
+
return j < i;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
});
|
|
77
|
+
}).map(({ raw }) => raw);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/internal/sentry/getSentryKeys.ts
|
|
81
|
+
function getSentryKeys({
|
|
82
|
+
dsn = process.env.NEXT_PUBLIC_SENTRY_DSN
|
|
83
|
+
} = {}) {
|
|
84
|
+
if (!dsn) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
const re = /^(?:https:\/\/)([A-z0-9]{32})(?::{0,1})([A-z0-9]*)(?:@)(o[a-z0-9]+)(?:\.ingest\.us\.sentry\.io)\/([0-9]{16})/i;
|
|
88
|
+
const match = dsn?.match(re);
|
|
89
|
+
if (!match) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
const [
|
|
93
|
+
,
|
|
94
|
+
key,
|
|
95
|
+
// this is a secret stored in a deprecated dns format
|
|
96
|
+
deprecatedSecret,
|
|
97
|
+
org,
|
|
98
|
+
projectId
|
|
99
|
+
] = match;
|
|
100
|
+
const cspEndpoint = new URL(
|
|
101
|
+
`https://${org}.ingest.us.sentry.io/api/${projectId}/security/?sentry_key=${key}`
|
|
102
|
+
);
|
|
103
|
+
cspEndpoint.searchParams.set("sentry_key", key);
|
|
104
|
+
cspEndpoint.searchParams.set("sentry_env", sentryEnvironment);
|
|
105
|
+
cspEndpoint.searchParams.set("sentry_release", sentryRelease);
|
|
106
|
+
return {
|
|
107
|
+
dsn: match[0],
|
|
108
|
+
projectId,
|
|
109
|
+
deprecatedSecret: deprecatedSecret || void 0,
|
|
110
|
+
cspEndpoint,
|
|
111
|
+
org,
|
|
112
|
+
publicKey: match[1]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/internal/header-sources.ts
|
|
117
|
+
var config = chainConfigs[defaultChainId];
|
|
118
|
+
var modules = {
|
|
119
|
+
berachain: {
|
|
120
|
+
connect: [
|
|
121
|
+
"https://*.berachain.com/",
|
|
122
|
+
// staging hosts are only reachable outside production
|
|
123
|
+
isProduction ? null : "https://*.berachain-staging.com/",
|
|
124
|
+
"https://raw.githubusercontent.com/berachain/metadata/",
|
|
125
|
+
`${imageBaseUrl}/`,
|
|
126
|
+
"https://*.quiknode.pro",
|
|
127
|
+
// Subgraph queries are served by same-origin typed REST endpoints under
|
|
128
|
+
// /api/honey/* and /api/pol/* (covered by 'self'), not direct browser
|
|
129
|
+
// requests to the upstream URLs.
|
|
130
|
+
config.pol.bribeBoostApi,
|
|
131
|
+
getUriFromLink(config.beep),
|
|
132
|
+
getUriFromLink(config.api),
|
|
133
|
+
jsonRpcUrl,
|
|
134
|
+
publicJsonRpcUrl,
|
|
135
|
+
alchemyJsonRpcUrl,
|
|
136
|
+
"https://api.routescan.io/v2/network/"
|
|
137
|
+
],
|
|
138
|
+
img: [
|
|
139
|
+
// trailing slash so sub-paths (e.g. /bend-curators/x.png/public) match;
|
|
140
|
+
// CSP path-matches exactly without it
|
|
141
|
+
`${imageBaseUrl}/`,
|
|
142
|
+
"https://raw.githubusercontent.com/berachain/metadata/"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
beranames: {
|
|
146
|
+
connect: [
|
|
147
|
+
// avatars
|
|
148
|
+
"https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
|
|
149
|
+
],
|
|
150
|
+
img: [
|
|
151
|
+
"https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
swapAggregators: {
|
|
155
|
+
connect: [
|
|
156
|
+
// empty on chains without a proxy — omit rather than emit a bare "/"
|
|
157
|
+
config.bex.aggregatorsProxyUrl ? `${config.bex.aggregatorsProxyUrl}/` : null,
|
|
158
|
+
"https://open-api.openocean.finance/",
|
|
159
|
+
"https://api.haiku.trade/",
|
|
160
|
+
"https://api.fly.trade/",
|
|
161
|
+
"https://api.enso.finance/",
|
|
162
|
+
"https://api.enso.build/",
|
|
163
|
+
// zaps
|
|
164
|
+
"https://api.relay.link/"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
walletConnect: {
|
|
168
|
+
connect: [
|
|
169
|
+
"wss://relay.walletconnect.com/",
|
|
170
|
+
"wss://relay.walletconnect.org/",
|
|
171
|
+
"https://verify.walletconnect.org/v3/public-key"
|
|
172
|
+
],
|
|
173
|
+
frame: [
|
|
174
|
+
"https://verify.walletconnect.com/",
|
|
175
|
+
"https://verify.walletconnect.org/"
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
coinbaseWallet: {
|
|
179
|
+
connect: [
|
|
180
|
+
"wss://www.walletlink.org/rpc",
|
|
181
|
+
"https://www.walletlink.org/events",
|
|
182
|
+
"https://chain-proxy.wallet.coinbase.com/"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
metamask: {
|
|
186
|
+
connect: [
|
|
187
|
+
"wss://metamask-sdk.api.cx.metamask.io/socket.io/",
|
|
188
|
+
"https://metamask-sdk.api.cx.metamask.io"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
thirdweb: {
|
|
192
|
+
connect: ["https://*.thirdweb.com/"],
|
|
193
|
+
// export pk iframe
|
|
194
|
+
frame: ["https://embedded-wallet.thirdweb.com/"]
|
|
195
|
+
},
|
|
196
|
+
dynamic: {
|
|
197
|
+
connect: ["https://app.dynamicauth.com/api"]
|
|
198
|
+
},
|
|
199
|
+
binance: {
|
|
200
|
+
connect: ["https://wallet.binance.com/tonbridge/"]
|
|
201
|
+
},
|
|
202
|
+
tron: {
|
|
203
|
+
connect: ["https://api.trongrid.io/"]
|
|
204
|
+
},
|
|
205
|
+
layerZero: {
|
|
206
|
+
connect: [
|
|
207
|
+
"https://*.layerzero-scan.com/",
|
|
208
|
+
"https://scan.layerzero-api.com/"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
pelagus: {
|
|
212
|
+
img: ["https://pelaguswallet.io/docs/img"]
|
|
213
|
+
},
|
|
214
|
+
externalRpcs: {
|
|
215
|
+
// non-Berachain chains read by wallets/bridges
|
|
216
|
+
connect: [
|
|
217
|
+
"https://api.avax.network/ext/bc/C/rpc",
|
|
218
|
+
"https://polygon-rpc.com",
|
|
219
|
+
"https://mainnet.optimism.io/",
|
|
220
|
+
"https://arb1.arbitrum.io/rpc",
|
|
221
|
+
"https://mainnet.base.org/",
|
|
222
|
+
"https://eth.merkle.io"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
tokenIcons: {
|
|
226
|
+
img: [
|
|
227
|
+
"https://assets.coingecko.com/coins/images/",
|
|
228
|
+
"https://coin-images.coingecko.com/coins/images/",
|
|
229
|
+
"https://icons.llama.fi/",
|
|
230
|
+
"https://icons.llamao.fi/",
|
|
231
|
+
"https://static.debank.com/",
|
|
232
|
+
"https://raw.githubusercontent.com/trustwallet/assets/"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
bend: {
|
|
236
|
+
img: ["https://cdn.morpho.org/"]
|
|
237
|
+
},
|
|
238
|
+
pyth: {
|
|
239
|
+
connect: ["https://hermes.pyth.network/v2/"]
|
|
240
|
+
},
|
|
241
|
+
fonts: {
|
|
242
|
+
font: [
|
|
243
|
+
"https://cdn.jsdelivr.net/npm/@fontsource/",
|
|
244
|
+
// collected by sentry (needed by browser extensions)
|
|
245
|
+
"https://fonts.gstatic.com",
|
|
246
|
+
"https://use.typekit.net/"
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
sentry: {
|
|
250
|
+
// csp reporting
|
|
251
|
+
connect: ["https://*.sentry.io/"]
|
|
252
|
+
},
|
|
253
|
+
posthog: {
|
|
254
|
+
// toolbar + heatmaps
|
|
255
|
+
connect: ["https://*.posthog.com"],
|
|
256
|
+
img: ["https://*.posthog.com"],
|
|
257
|
+
frame: ["https://*.posthog.com"],
|
|
258
|
+
font: ["https://*.posthog.com"],
|
|
259
|
+
style: ["https://*.posthog.com"],
|
|
260
|
+
media: ["https://*.posthog.com"]
|
|
261
|
+
},
|
|
262
|
+
vercel: {
|
|
263
|
+
// toolbar + live comments
|
|
264
|
+
connect: ["https://vercel.live", "wss://ws-us3.pusher.com"],
|
|
265
|
+
img: ["https://vercel.live", "https://vercel.com"],
|
|
266
|
+
frame: ["https://vercel.live/"],
|
|
267
|
+
font: ["https://vercel.live", "https://assets.vercel.com"],
|
|
268
|
+
style: ["https://vercel.live"]
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var headerSourceModules = modules;
|
|
272
|
+
function getContentSecurityPolicy({
|
|
273
|
+
isDevelopment,
|
|
274
|
+
cspReporting,
|
|
275
|
+
dynamicScriptCsp = {},
|
|
276
|
+
modules: enabledModules = {},
|
|
277
|
+
...args
|
|
278
|
+
}) {
|
|
279
|
+
const defaultSrc = [];
|
|
280
|
+
function collect(directive) {
|
|
281
|
+
return Object.entries(headerSourceModules).filter(
|
|
282
|
+
([module]) => enabledModules[module] !== false
|
|
283
|
+
).flatMap(([, sources]) => sources[directive] ?? []).filter((url) => Boolean(url?.trim()));
|
|
284
|
+
}
|
|
285
|
+
const connectionSources = dedupeCspSources(
|
|
286
|
+
collect("connect").concat(args.connectionSources ?? []).filter((link) => {
|
|
287
|
+
const url = getUriFromLink(link);
|
|
288
|
+
if (!url || url.trim() === "") {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
if (url.startsWith(goldskyBaseUrl) && url !== goldskyBaseUrl) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
const pictureSources = dedupeCspSources(
|
|
298
|
+
collect("img").concat(args.pictureSources ?? [])
|
|
299
|
+
);
|
|
300
|
+
const frameSources = dedupeCspSources(
|
|
301
|
+
collect("frame").concat(args.frameSources ?? [])
|
|
302
|
+
);
|
|
303
|
+
const fontSources = dedupeCspSources(
|
|
304
|
+
collect("font").concat(args.fontSources ?? [])
|
|
305
|
+
);
|
|
306
|
+
const styleSources = dedupeCspSources(
|
|
307
|
+
collect("style").concat(args.styleSources ?? [])
|
|
308
|
+
);
|
|
309
|
+
const workerSources = dedupeCspSources(
|
|
310
|
+
collect("worker").concat(args.workerSources ?? [])
|
|
311
|
+
);
|
|
312
|
+
const mediaSources = dedupeCspSources(
|
|
313
|
+
collect("media").concat(args.mediaSources ?? [])
|
|
314
|
+
);
|
|
315
|
+
const scriptSources = dynamicScriptCsp === "disabled" ? dedupeCspSources(collect("script").concat(args.scriptSources ?? [])) : dedupeCspSources(
|
|
316
|
+
[
|
|
317
|
+
dynamicScriptCsp.nonce ? `'nonce-${dynamicScriptCsp.nonce}'` : "",
|
|
318
|
+
"'strict-dynamic'",
|
|
319
|
+
"'sha256-k2HGvaYkGyYZxOwKGxgE1mr06tZEDcEXNZ5mdcldK0o='",
|
|
320
|
+
...dynamicScriptCsp.sha ?? []
|
|
321
|
+
].filter((source) => source !== "")
|
|
322
|
+
);
|
|
323
|
+
let cspHeader = `
|
|
324
|
+
default-src 'self' ${defaultSrc.join(" ")};
|
|
3
325
|
base-uri 'self';
|
|
4
|
-
frame-src 'self' ${
|
|
326
|
+
frame-src 'self' ${frameSources.join(" ")};
|
|
5
327
|
frame-ancestors 'self' https://*.posthog.com;
|
|
6
|
-
script-src 'self' ${
|
|
7
|
-
worker-src 'self' blob: data: ${
|
|
8
|
-
font-src 'self' ${
|
|
9
|
-
style-src 'self' ${
|
|
10
|
-
img-src 'self' data: ${
|
|
11
|
-
connect-src 'self' ${
|
|
12
|
-
media-src 'self' ${
|
|
13
|
-
`;
|
|
14
|
-
|
|
328
|
+
script-src 'self' ${scriptSources.concat([isDevelopment ? "'unsafe-eval'" : ""]).join(" ")};
|
|
329
|
+
worker-src 'self' blob: data: ${workerSources.join(" ")};
|
|
330
|
+
font-src 'self' ${fontSources.join(" ")};
|
|
331
|
+
style-src 'self' ${styleSources.join(" ")} 'unsafe-inline';
|
|
332
|
+
img-src 'self' data: ${pictureSources.join(" ")};
|
|
333
|
+
connect-src 'self' ${connectionSources.join(" ")};
|
|
334
|
+
media-src 'self' ${mediaSources.join(" ")};
|
|
335
|
+
`;
|
|
336
|
+
if (cspReporting) {
|
|
337
|
+
cspHeader += `
|
|
338
|
+
report-uri ${cspReporting};
|
|
15
339
|
report-to csp-endpoint;
|
|
16
|
-
|
|
340
|
+
`;
|
|
341
|
+
}
|
|
342
|
+
return cspHeader.replace(/\s{2,}/g, " ").trim();
|
|
343
|
+
}
|
|
344
|
+
var staticPictureSources = [
|
|
345
|
+
// Only add image delivery URL if it exists and can be processed
|
|
346
|
+
`${imageBaseUrl}/`,
|
|
347
|
+
"https://raw.githubusercontent.com/berachain/metadata/",
|
|
348
|
+
"https://assets.coingecko.com/coins/images/",
|
|
349
|
+
"https://berachain.ghost.io/content/images/"
|
|
350
|
+
].filter((url) => {
|
|
351
|
+
if (!url || url.trim() === "") {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
return true;
|
|
355
|
+
});
|
|
356
|
+
function cspMiddleware({
|
|
357
|
+
response,
|
|
358
|
+
csp
|
|
359
|
+
}) {
|
|
360
|
+
const sentryCspEndpoint = getSentryKeys()?.cspEndpoint;
|
|
361
|
+
const nonce = csp?.dynamicScriptCsp !== "disabled" ? csp?.dynamicScriptCsp?.nonce ?? Buffer.from(crypto.randomUUID()).toString("base64") : void 0;
|
|
362
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
363
|
+
const headers = [
|
|
364
|
+
{
|
|
365
|
+
key: "Content-Security-Policy",
|
|
366
|
+
value: getContentSecurityPolicy({
|
|
367
|
+
...csp,
|
|
368
|
+
dynamicScriptCsp: csp?.dynamicScriptCsp === "disabled" ? csp.dynamicScriptCsp : {
|
|
369
|
+
...csp?.dynamicScriptCsp,
|
|
370
|
+
nonce
|
|
371
|
+
},
|
|
372
|
+
isDevelopment,
|
|
373
|
+
cspReporting: sentryCspEndpoint?.toString()
|
|
374
|
+
})
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
key: "X-Frame-Options",
|
|
378
|
+
value: "DENY"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
key: "X-Content-Type-Options",
|
|
382
|
+
value: "nosniff"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
key: "X-Nonce",
|
|
386
|
+
value: nonce
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
if (sentryCspEndpoint) {
|
|
390
|
+
headers.push({
|
|
391
|
+
key: "Reporting-To",
|
|
392
|
+
value: `{"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"${sentryCspEndpoint}"}],"include_subdomains":true}"`
|
|
393
|
+
});
|
|
394
|
+
headers.push({
|
|
395
|
+
key: "Reporting-Endpoints",
|
|
396
|
+
value: `csp-endpoint="${sentryCspEndpoint}"`
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
for (const header of headers) {
|
|
400
|
+
if (!header.value) {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
response.headers.set(header.key, header.value);
|
|
404
|
+
}
|
|
405
|
+
return response;
|
|
406
|
+
}
|
|
407
|
+
export {
|
|
408
|
+
cspMiddleware,
|
|
409
|
+
getContentSecurityPolicy,
|
|
410
|
+
headerSourceModules,
|
|
411
|
+
staticPictureSources
|
|
412
|
+
};
|
package/dist/internal/index.cjs
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkG446M2AVcjs = require('../chunk-G446M2AV.cjs');
|
|
6
|
+
require('../chunk-MNIORAK3.cjs');
|
|
7
|
+
require('../chunk-4AMLYLHZ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkAU3LYJABcjs = require('../chunk-AU3LYJAB.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkEYYJ2UZTcjs = require('../chunk-EYYJ2UZT.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.ChainId = _chunkEYYJ2UZTcjs.ChainId; exports.alchemyJsonRpcUrl = _chunkAU3LYJABcjs.alchemyJsonRpcUrl; exports.appConfig = _chunkG446M2AVcjs.appConfig; exports.chainConfigs = _chunkG446M2AVcjs.chainConfigs; exports.chainId = _chunkAU3LYJABcjs.defaultChainId; exports.config = _chunkG446M2AVcjs.config; exports.currentDapp = _chunkAU3LYJABcjs.currentDapp; exports.defaultChainId = _chunkAU3LYJABcjs.defaultChainId; exports.getRpcUrls = _chunkAU3LYJABcjs.getRpcUrls; exports.goldskyBaseUrl = _chunkAU3LYJABcjs.goldskyBaseUrl; exports.imageBaseUrl = _chunkAU3LYJABcjs.imageBaseUrl; exports.jsonRpcUrl = _chunkAU3LYJABcjs.jsonRpcUrl; exports.privateRcpUrl = _chunkAU3LYJABcjs.privateRcpUrl; exports.publicJsonRpcUrl = _chunkAU3LYJABcjs.publicJsonRpcUrl;
|
package/dist/internal/index.mjs
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
appConfig,
|
|
3
|
+
chainConfigs,
|
|
4
|
+
config
|
|
5
|
+
} from "../chunk-GFHZDTK3.mjs";
|
|
6
|
+
import "../chunk-UKXTPLZ5.mjs";
|
|
7
|
+
import "../chunk-4DGMTEOQ.mjs";
|
|
8
|
+
import {
|
|
9
|
+
alchemyJsonRpcUrl,
|
|
10
|
+
currentDapp,
|
|
11
|
+
defaultChainId,
|
|
12
|
+
getRpcUrls,
|
|
13
|
+
goldskyBaseUrl,
|
|
14
|
+
imageBaseUrl,
|
|
15
|
+
jsonRpcUrl,
|
|
16
|
+
privateRcpUrl,
|
|
17
|
+
publicJsonRpcUrl
|
|
18
|
+
} from "../chunk-VWRKCGMU.mjs";
|
|
19
|
+
import {
|
|
20
|
+
ChainId
|
|
21
|
+
} from "../chunk-KJXYSGNH.mjs";
|
|
22
|
+
export {
|
|
23
|
+
ChainId,
|
|
24
|
+
alchemyJsonRpcUrl,
|
|
25
|
+
appConfig,
|
|
26
|
+
chainConfigs,
|
|
27
|
+
defaultChainId as chainId,
|
|
28
|
+
config,
|
|
29
|
+
currentDapp,
|
|
30
|
+
defaultChainId,
|
|
31
|
+
getRpcUrls,
|
|
32
|
+
goldskyBaseUrl,
|
|
33
|
+
imageBaseUrl,
|
|
34
|
+
jsonRpcUrl,
|
|
35
|
+
privateRcpUrl,
|
|
36
|
+
publicJsonRpcUrl
|
|
37
|
+
};
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internal/maintenance.ts
|
|
2
|
+
var _server = require('next/server');
|
|
3
|
+
var DEFAULT_MAINTENANCE_EXEMPT_PATHS = [
|
|
4
|
+
"/maintenance",
|
|
5
|
+
"/_next",
|
|
6
|
+
"/api"
|
|
7
|
+
];
|
|
8
|
+
function checkMaintenanceMode(req, config) {
|
|
9
|
+
const {
|
|
10
|
+
isMaintenance,
|
|
11
|
+
exemptPaths = DEFAULT_MAINTENANCE_EXEMPT_PATHS,
|
|
12
|
+
maintenancePath = "/maintenance"
|
|
13
|
+
} = config;
|
|
14
|
+
if (isMaintenance && !exemptPaths.some((path) => req.nextUrl.pathname.startsWith(path))) {
|
|
15
|
+
return _server.NextResponse.redirect(new URL(maintenancePath, req.url), {
|
|
16
|
+
status: 307
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.DEFAULT_MAINTENANCE_EXEMPT_PATHS = DEFAULT_MAINTENANCE_EXEMPT_PATHS; exports.checkMaintenanceMode = checkMaintenanceMode;
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/maintenance.ts
|
|
2
|
+
import { NextResponse } from "next/server";
|
|
3
|
+
var DEFAULT_MAINTENANCE_EXEMPT_PATHS = [
|
|
4
|
+
"/maintenance",
|
|
5
|
+
"/_next",
|
|
6
|
+
"/api"
|
|
7
|
+
];
|
|
8
|
+
function checkMaintenanceMode(req, config) {
|
|
9
|
+
const {
|
|
10
|
+
isMaintenance,
|
|
11
|
+
exemptPaths = DEFAULT_MAINTENANCE_EXEMPT_PATHS,
|
|
12
|
+
maintenancePath = "/maintenance"
|
|
13
|
+
} = config;
|
|
14
|
+
if (isMaintenance && !exemptPaths.some((path) => req.nextUrl.pathname.startsWith(path))) {
|
|
15
|
+
return NextResponse.redirect(new URL(maintenancePath, req.url), {
|
|
16
|
+
status: 307
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
DEFAULT_MAINTENANCE_EXEMPT_PATHS,
|
|
23
|
+
checkMaintenanceMode
|
|
24
|
+
};
|
|
@@ -1 +1,83 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkNF5WIUL6cjs = require('../../chunk-NF5WIUL6.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkG446M2AVcjs = require('../../chunk-G446M2AV.cjs');
|
|
7
|
+
require('../../chunk-MNIORAK3.cjs');
|
|
8
|
+
require('../../chunk-4AMLYLHZ.cjs');
|
|
9
|
+
require('../../chunk-AU3LYJAB.cjs');
|
|
10
|
+
require('../../chunk-EYYJ2UZT.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkZTYHPIUWcjs = require('../../chunk-ZTYHPIUW.cjs');
|
|
14
|
+
|
|
15
|
+
// src/internal/nextjs/index.ts
|
|
16
|
+
var _dotenv = require('dotenv'); var _dotenv2 = _interopRequireDefault(_dotenv);
|
|
17
|
+
_dotenv2.default.config({ path: ["../../.env.local", "../../.env"] });
|
|
18
|
+
function withBeraConfig(config, {
|
|
19
|
+
withSentry = true,
|
|
20
|
+
withPostHogReverseProxy = true,
|
|
21
|
+
appName
|
|
22
|
+
}) {
|
|
23
|
+
const nextConfig = {
|
|
24
|
+
reactStrictMode: true,
|
|
25
|
+
trailingSlash: true,
|
|
26
|
+
pageExtensions: ["ts", "tsx"],
|
|
27
|
+
env: {
|
|
28
|
+
// this is used to check if component is running in nextjs inside the package folder
|
|
29
|
+
NEXT_PUBLIC_IS_NEXTJS: "true",
|
|
30
|
+
NEXT_PUBLIC_BERA_APP_NAME: appName
|
|
31
|
+
},
|
|
32
|
+
turbopack: {
|
|
33
|
+
rules: {
|
|
34
|
+
"*.svg": {
|
|
35
|
+
as: "*.js",
|
|
36
|
+
loaders: ["@svgr/webpack"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
experimental: {
|
|
41
|
+
webpackBuildWorker: true
|
|
42
|
+
// optimizePackageImports: [
|
|
43
|
+
// "@berachain/ui",
|
|
44
|
+
// "@berachain/shared-ui",
|
|
45
|
+
// "@berachain/berajs",
|
|
46
|
+
// "@berachain/wagmi",
|
|
47
|
+
// "@berachain/config",
|
|
48
|
+
// "@berachain/graphql",
|
|
49
|
+
// ],
|
|
50
|
+
},
|
|
51
|
+
/** We already do linting and typechecking as separate tasks in CI */
|
|
52
|
+
typescript: { ignoreBuildErrors: true },
|
|
53
|
+
...config,
|
|
54
|
+
images: {
|
|
55
|
+
...config.images,
|
|
56
|
+
remotePatterns: [..._chunkNF5WIUL6cjs.IMAGE_REMOTE_PATTERNS]
|
|
57
|
+
},
|
|
58
|
+
async rewrites() {
|
|
59
|
+
if (!withPostHogReverseProxy) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
source: "/ph/static/:path*",
|
|
65
|
+
destination: `https://${_chunkG446M2AVcjs.appConfig.urls.postHog.region}-assets.i.posthog.com/static/:path*`
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
source: "/ph/:path*",
|
|
69
|
+
destination: `https://${_chunkG446M2AVcjs.appConfig.urls.postHog.region}.i.posthog.com/:path*`
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
if (withPostHogReverseProxy) {
|
|
75
|
+
nextConfig.env.NEXT_PUBLIC_PH_REVERSE_PROXY_PATH = "/ph";
|
|
76
|
+
nextConfig.skipTrailingSlashRedirect = true;
|
|
77
|
+
}
|
|
78
|
+
if (withSentry) return _chunkZTYHPIUWcjs.withSentryConfig.call(void 0, nextConfig);
|
|
79
|
+
return nextConfig;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
exports.withBeraConfig = withBeraConfig;
|