Merge branch 'dev' into jajaja

# Conflicts:
#	package.json
#	pnpm-lock.yaml
This commit is contained in:
Mike Cao 2025-05-09 21:56:07 -07:00
commit 94b4b66a3d
122 changed files with 41347 additions and 2747 deletions

View file

@ -10,8 +10,10 @@ const routesManifestPath = path.resolve(process.cwd(), '.next/routes-manifest.js
const originalPath = path.resolve(process.cwd(), '.next/routes-manifest-orig.json');
const originalManifest = require(originalPath);
const API_PATH = '/api/:path*';
const TRACKER_SCRIPT = '/script.js';
const basePath = originalManifest.basePath;
const API_PATH = basePath + '/api/:path*';
const TRACKER_SCRIPT = basePath + '/script.js';
const collectApiEndpoint = process.env.COLLECT_API_ENDPOINT;
const trackerScriptName = process.env.TRACKER_SCRIPT_NAME;
@ -23,14 +25,16 @@ if (collectApiEndpoint) {
const apiRoute = originalManifest.headers.find(route => route.source === API_PATH);
const routeRegex = new RegExp(apiRoute.regex);
const normalizedSource = basePath + collectApiEndpoint;
rewrites.push({
source: collectApiEndpoint,
destination: '/api/send',
source: normalizedSource,
destination: basePath + '/api/send',
});
if (!routeRegex.test(collectApiEndpoint)) {
if (!routeRegex.test(normalizedSource)) {
headers.push({
source: collectApiEndpoint,
source: normalizedSource,
headers: apiRoute.headers,
});
}
@ -43,7 +47,7 @@ if (trackerScriptName) {
if (names) {
names.forEach(name => {
const normalizedSource = `/${name.replace(/^\/+/, '')}`;
const normalizedSource = `${basePath}/${name.replace(/^\/+/, '')}`;
rewrites.push({
source: normalizedSource,