main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import { RouteMatcher } from "./route-matcher";
export class AppPageRouteMatcher extends RouteMatcher {
get identity() {
return `${this.definition.pathname}?__nextPage=${this.definition.page}`;
}
}
//# sourceMappingURL=app-page-route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/app-page-route-matcher.ts"],"names":["RouteMatcher","AppPageRouteMatcher","identity","definition","pathname","page"],"mappings":"AAAA,SAASA,YAAY,QAAQ,kBAAiB;AAG9C,OAAO,MAAMC,4BAA4BD;IACvC,IAAWE,WAAmB;QAC5B,OAAO,CAAC,EAAE,IAAI,CAACC,UAAU,CAACC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAACD,UAAU,CAACE,IAAI,CAAC,CAAC;IACzE;AACF"}

View File

@@ -0,0 +1,5 @@
import { RouteMatcher } from "./route-matcher";
export class AppRouteRouteMatcher extends RouteMatcher {
}
//# sourceMappingURL=app-route-route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/app-route-route-matcher.ts"],"names":["RouteMatcher","AppRouteRouteMatcher"],"mappings":"AAAA,SAASA,YAAY,QAAQ,kBAAiB;AAG9C,OAAO,MAAMC,6BAA6BD;AAAuC"}

View File

@@ -0,0 +1,58 @@
import { RouteMatcher } from "./route-matcher";
export class LocaleRouteMatcher extends RouteMatcher {
/**
* Identity returns the identity part of the matcher. This is used to compare
* a unique matcher to another. This is also used when sorting dynamic routes,
* so it must contain the pathname part as well.
*/ get identity() {
var _this_definition_i18n;
return `${this.definition.pathname}?__nextLocale=${(_this_definition_i18n = this.definition.i18n) == null ? void 0 : _this_definition_i18n.locale}`;
}
/**
* Match will attempt to match the given pathname against this route while
* also taking into account the locale information.
*
* @param pathname The pathname to match against.
* @param options The options to use when matching.
* @returns The match result, or `null` if there was no match.
*/ match(pathname, options) {
var // If the options have a detected locale, then use that, otherwise use
// the route's locale.
_options_i18n, _this_definition_i18n;
// This is like the parent `match` method but instead this injects the
// additional `options` into the
const result = this.test(pathname, options);
if (!result) return null;
return {
definition: this.definition,
params: result.params,
detectedLocale: (options == null ? void 0 : (_options_i18n = options.i18n) == null ? void 0 : _options_i18n.detectedLocale) ?? ((_this_definition_i18n = this.definition.i18n) == null ? void 0 : _this_definition_i18n.locale)
};
}
/**
* Test will attempt to match the given pathname against this route while
* also taking into account the locale information.
*
* @param pathname The pathname to match against.
* @param options The options to use when matching.
* @returns The match result, or `null` if there was no match.
*/ test(pathname, options) {
// If this route has locale information and we have detected a locale, then
// we need to compare the detected locale to the route's locale.
if (this.definition.i18n && (options == null ? void 0 : options.i18n)) {
// If we have detected a locale and it does not match this route's locale,
// then this isn't a match!
if (this.definition.i18n.locale && options.i18n.detectedLocale && this.definition.i18n.locale !== options.i18n.detectedLocale) {
return null;
}
// Perform regular matching against the locale stripped pathname now, the
// locale information matches!
return super.test(options.i18n.pathname);
}
// If we don't have locale information, then we can just perform regular
// matching.
return super.test(pathname);
}
}
//# sourceMappingURL=locale-route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/locale-route-matcher.ts"],"names":["RouteMatcher","LocaleRouteMatcher","identity","definition","pathname","i18n","locale","match","options","result","test","params","detectedLocale"],"mappings":"AAGA,SAASA,YAAY,QAAQ,kBAAiB;AAW9C,OAAO,MAAMC,2BAEHD;IACR;;;;GAIC,GACD,IAAWE,WAAmB;YACuB;QAAnD,OAAO,CAAC,EAAE,IAAI,CAACC,UAAU,CAACC,QAAQ,CAAC,cAAc,GAAE,wBAAA,IAAI,CAACD,UAAU,CAACE,IAAI,qBAApB,sBAAsBC,MAAM,CAAC,CAAC;IACnF;IAEA;;;;;;;GAOC,GACD,AAAOC,MACLH,QAAgB,EAChBI,OAAmC,EACP;YAUxB,sEAAsE;QACtE,sBAAsB;QACtBA,eAAiC;QAXrC,sEAAsE;QACtE,gCAAgC;QAChC,MAAMC,SAAS,IAAI,CAACC,IAAI,CAACN,UAAUI;QACnC,IAAI,CAACC,QAAQ,OAAO;QAEpB,OAAO;YACLN,YAAY,IAAI,CAACA,UAAU;YAC3BQ,QAAQF,OAAOE,MAAM;YACrBC,gBAGEJ,CAAAA,4BAAAA,gBAAAA,QAASH,IAAI,qBAAbG,cAAeI,cAAc,OAAI,wBAAA,IAAI,CAACT,UAAU,CAACE,IAAI,qBAApB,sBAAsBC,MAAM;QACjE;IACF;IAEA;;;;;;;GAOC,GACD,AAAOI,KAAKN,QAAgB,EAAEI,OAAmC,EAAE;QACjE,2EAA2E;QAC3E,gEAAgE;QAChE,IAAI,IAAI,CAACL,UAAU,CAACE,IAAI,KAAIG,2BAAAA,QAASH,IAAI,GAAE;YACzC,0EAA0E;YAC1E,2BAA2B;YAC3B,IACE,IAAI,CAACF,UAAU,CAACE,IAAI,CAACC,MAAM,IAC3BE,QAAQH,IAAI,CAACO,cAAc,IAC3B,IAAI,CAACT,UAAU,CAACE,IAAI,CAACC,MAAM,KAAKE,QAAQH,IAAI,CAACO,cAAc,EAC3D;gBACA,OAAO;YACT;YAEA,yEAAyE;YACzE,8BAA8B;YAC9B,OAAO,KAAK,CAACF,KAAKF,QAAQH,IAAI,CAACD,QAAQ;QACzC;QAEA,wEAAwE;QACxE,YAAY;QACZ,OAAO,KAAK,CAACM,KAAKN;IACpB;AACF"}

View File

@@ -0,0 +1,8 @@
import { LocaleRouteMatcher } from "./locale-route-matcher";
import { RouteMatcher } from "./route-matcher";
export class PagesAPIRouteMatcher extends RouteMatcher {
}
export class PagesAPILocaleRouteMatcher extends LocaleRouteMatcher {
}
//# sourceMappingURL=pages-api-route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/pages-api-route-matcher.ts"],"names":["LocaleRouteMatcher","RouteMatcher","PagesAPIRouteMatcher","PagesAPILocaleRouteMatcher"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,YAAY,QAAQ,kBAAiB;AAE9C,OAAO,MAAMC,6BAA6BD;AAAuC;AAEjF,OAAO,MAAME,mCAAmCH;AAA6C"}

View File

@@ -0,0 +1,8 @@
import { LocaleRouteMatcher } from "./locale-route-matcher";
import { RouteMatcher } from "./route-matcher";
export class PagesRouteMatcher extends RouteMatcher {
}
export class PagesLocaleRouteMatcher extends LocaleRouteMatcher {
}
//# sourceMappingURL=pages-route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/pages-route-matcher.ts"],"names":["LocaleRouteMatcher","RouteMatcher","PagesRouteMatcher","PagesLocaleRouteMatcher"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,YAAY,QAAQ,kBAAiB;AAE9C,OAAO,MAAMC,0BAA0BD;AAAoC;AAE3E,OAAO,MAAME,gCAAgCH;AAA0C"}

View File

@@ -0,0 +1,44 @@
import { isDynamicRoute } from "../../../shared/lib/router/utils";
import { getRouteMatcher } from "../../../shared/lib/router/utils/route-matcher";
import { getRouteRegex } from "../../../shared/lib/router/utils/route-regex";
export class RouteMatcher {
constructor(definition){
this.definition = definition;
if (isDynamicRoute(definition.pathname)) {
this.dynamic = getRouteMatcher(getRouteRegex(definition.pathname));
}
}
/**
* Identity returns the identity part of the matcher. This is used to compare
* a unique matcher to another. This is also used when sorting dynamic routes,
* so it must contain the pathname part.
*/ get identity() {
return this.definition.pathname;
}
get isDynamic() {
return this.dynamic !== undefined;
}
match(pathname) {
const result = this.test(pathname);
if (!result) return null;
return {
definition: this.definition,
params: result.params
};
}
test(pathname) {
if (this.dynamic) {
const params = this.dynamic(pathname);
if (!params) return null;
return {
params
};
}
if (pathname === this.definition.pathname) {
return {};
}
return null;
}
}
//# sourceMappingURL=route-matcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/future/route-matchers/route-matcher.ts"],"names":["isDynamicRoute","getRouteMatcher","getRouteRegex","RouteMatcher","constructor","definition","pathname","dynamic","identity","isDynamic","undefined","match","result","test","params"],"mappings":"AAGA,SAASA,cAAc,QAAQ,mCAAkC;AACjE,SACEC,eAAe,QAEV,iDAAgD;AACvD,SAASC,aAAa,QAAQ,+CAA8C;AAM5E,OAAO,MAAMC;IAUXC,YAA4BC,WAAe;0BAAfA;QAC1B,IAAIL,eAAeK,WAAWC,QAAQ,GAAG;YACvC,IAAI,CAACC,OAAO,GAAGN,gBAAgBC,cAAcG,WAAWC,QAAQ;QAClE;IACF;IAEA;;;;GAIC,GACD,IAAWE,WAAmB;QAC5B,OAAO,IAAI,CAACH,UAAU,CAACC,QAAQ;IACjC;IAEA,IAAWG,YAAY;QACrB,OAAO,IAAI,CAACF,OAAO,KAAKG;IAC1B;IAEOC,MAAML,QAAgB,EAAwB;QACnD,MAAMM,SAAS,IAAI,CAACC,IAAI,CAACP;QACzB,IAAI,CAACM,QAAQ,OAAO;QAEpB,OAAO;YAAEP,YAAY,IAAI,CAACA,UAAU;YAAES,QAAQF,OAAOE,MAAM;QAAC;IAC9D;IAEOD,KAAKP,QAAgB,EAA2B;QACrD,IAAI,IAAI,CAACC,OAAO,EAAE;YAChB,MAAMO,SAAS,IAAI,CAACP,OAAO,CAACD;YAC5B,IAAI,CAACQ,QAAQ,OAAO;YAEpB,OAAO;gBAAEA;YAAO;QAClB;QAEA,IAAIR,aAAa,IAAI,CAACD,UAAU,CAACC,QAAQ,EAAE;YACzC,OAAO,CAAC;QACV;QAEA,OAAO;IACT;AACF"}