Extract anyclip

This commit is contained in:
2026-01-20 14:34:18 +08:00
commit d4fe4800e6
1014 changed files with 97445 additions and 0 deletions

395
vendor/node_modules/next/dist/lib/constants.js generated vendored Normal file
View File

@@ -0,0 +1,395 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ACTION_SUFFIX: null,
APP_DIR_ALIAS: null,
CACHE_ONE_YEAR: null,
DOT_NEXT_ALIAS: null,
ESLINT_DEFAULT_DIRS: null,
GSP_NO_RETURNED_VALUE: null,
GSSP_COMPONENT_MEMBER_ERROR: null,
GSSP_NO_RETURNED_VALUE: null,
HTML_CONTENT_TYPE_HEADER: null,
INFINITE_CACHE: null,
INSTRUMENTATION_HOOK_FILENAME: null,
JSON_CONTENT_TYPE_HEADER: null,
MATCHED_PATH_HEADER: null,
MIDDLEWARE_FILENAME: null,
MIDDLEWARE_LOCATION_REGEXP: null,
NEXT_BODY_SUFFIX: null,
NEXT_CACHE_IMPLICIT_TAG_ID: null,
NEXT_CACHE_REVALIDATED_TAGS_HEADER: null,
NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: null,
NEXT_CACHE_SOFT_TAG_MAX_LENGTH: null,
NEXT_CACHE_TAGS_HEADER: null,
NEXT_CACHE_TAG_MAX_ITEMS: null,
NEXT_CACHE_TAG_MAX_LENGTH: null,
NEXT_DATA_SUFFIX: null,
NEXT_INTERCEPTION_MARKER_PREFIX: null,
NEXT_META_SUFFIX: null,
NEXT_QUERY_PARAM_PREFIX: null,
NEXT_RESUME_HEADER: null,
NON_STANDARD_NODE_ENV: null,
PAGES_DIR_ALIAS: null,
PRERENDER_REVALIDATE_HEADER: null,
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: null,
PUBLIC_DIR_MIDDLEWARE_CONFLICT: null,
ROOT_DIR_ALIAS: null,
RSC_ACTION_CLIENT_WRAPPER_ALIAS: null,
RSC_ACTION_ENCRYPTION_ALIAS: null,
RSC_ACTION_PROXY_ALIAS: null,
RSC_ACTION_VALIDATE_ALIAS: null,
RSC_CACHE_WRAPPER_ALIAS: null,
RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: null,
RSC_MOD_REF_PROXY_ALIAS: null,
RSC_PREFETCH_SUFFIX: null,
RSC_SEGMENTS_DIR_SUFFIX: null,
RSC_SEGMENT_SUFFIX: null,
RSC_SUFFIX: null,
SERVER_PROPS_EXPORT_ERROR: null,
SERVER_PROPS_GET_INIT_PROPS_CONFLICT: null,
SERVER_PROPS_SSG_CONFLICT: null,
SERVER_RUNTIME: null,
SSG_FALLBACK_EXPORT_ERROR: null,
SSG_GET_INITIAL_PROPS_CONFLICT: null,
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: null,
TEXT_PLAIN_CONTENT_TYPE_HEADER: null,
UNSTABLE_REVALIDATE_RENAME_ERROR: null,
WEBPACK_LAYERS: null,
WEBPACK_RESOURCE_QUERIES: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ACTION_SUFFIX: function() {
return ACTION_SUFFIX;
},
APP_DIR_ALIAS: function() {
return APP_DIR_ALIAS;
},
CACHE_ONE_YEAR: function() {
return CACHE_ONE_YEAR;
},
DOT_NEXT_ALIAS: function() {
return DOT_NEXT_ALIAS;
},
ESLINT_DEFAULT_DIRS: function() {
return ESLINT_DEFAULT_DIRS;
},
GSP_NO_RETURNED_VALUE: function() {
return GSP_NO_RETURNED_VALUE;
},
GSSP_COMPONENT_MEMBER_ERROR: function() {
return GSSP_COMPONENT_MEMBER_ERROR;
},
GSSP_NO_RETURNED_VALUE: function() {
return GSSP_NO_RETURNED_VALUE;
},
HTML_CONTENT_TYPE_HEADER: function() {
return HTML_CONTENT_TYPE_HEADER;
},
INFINITE_CACHE: function() {
return INFINITE_CACHE;
},
INSTRUMENTATION_HOOK_FILENAME: function() {
return INSTRUMENTATION_HOOK_FILENAME;
},
JSON_CONTENT_TYPE_HEADER: function() {
return JSON_CONTENT_TYPE_HEADER;
},
MATCHED_PATH_HEADER: function() {
return MATCHED_PATH_HEADER;
},
MIDDLEWARE_FILENAME: function() {
return MIDDLEWARE_FILENAME;
},
MIDDLEWARE_LOCATION_REGEXP: function() {
return MIDDLEWARE_LOCATION_REGEXP;
},
NEXT_BODY_SUFFIX: function() {
return NEXT_BODY_SUFFIX;
},
NEXT_CACHE_IMPLICIT_TAG_ID: function() {
return NEXT_CACHE_IMPLICIT_TAG_ID;
},
NEXT_CACHE_REVALIDATED_TAGS_HEADER: function() {
return NEXT_CACHE_REVALIDATED_TAGS_HEADER;
},
NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: function() {
return NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER;
},
NEXT_CACHE_SOFT_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_SOFT_TAG_MAX_LENGTH;
},
NEXT_CACHE_TAGS_HEADER: function() {
return NEXT_CACHE_TAGS_HEADER;
},
NEXT_CACHE_TAG_MAX_ITEMS: function() {
return NEXT_CACHE_TAG_MAX_ITEMS;
},
NEXT_CACHE_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_TAG_MAX_LENGTH;
},
NEXT_DATA_SUFFIX: function() {
return NEXT_DATA_SUFFIX;
},
NEXT_INTERCEPTION_MARKER_PREFIX: function() {
return NEXT_INTERCEPTION_MARKER_PREFIX;
},
NEXT_META_SUFFIX: function() {
return NEXT_META_SUFFIX;
},
NEXT_QUERY_PARAM_PREFIX: function() {
return NEXT_QUERY_PARAM_PREFIX;
},
NEXT_RESUME_HEADER: function() {
return NEXT_RESUME_HEADER;
},
NON_STANDARD_NODE_ENV: function() {
return NON_STANDARD_NODE_ENV;
},
PAGES_DIR_ALIAS: function() {
return PAGES_DIR_ALIAS;
},
PRERENDER_REVALIDATE_HEADER: function() {
return PRERENDER_REVALIDATE_HEADER;
},
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: function() {
return PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER;
},
PUBLIC_DIR_MIDDLEWARE_CONFLICT: function() {
return PUBLIC_DIR_MIDDLEWARE_CONFLICT;
},
ROOT_DIR_ALIAS: function() {
return ROOT_DIR_ALIAS;
},
RSC_ACTION_CLIENT_WRAPPER_ALIAS: function() {
return RSC_ACTION_CLIENT_WRAPPER_ALIAS;
},
RSC_ACTION_ENCRYPTION_ALIAS: function() {
return RSC_ACTION_ENCRYPTION_ALIAS;
},
RSC_ACTION_PROXY_ALIAS: function() {
return RSC_ACTION_PROXY_ALIAS;
},
RSC_ACTION_VALIDATE_ALIAS: function() {
return RSC_ACTION_VALIDATE_ALIAS;
},
RSC_CACHE_WRAPPER_ALIAS: function() {
return RSC_CACHE_WRAPPER_ALIAS;
},
RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: function() {
return RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS;
},
RSC_MOD_REF_PROXY_ALIAS: function() {
return RSC_MOD_REF_PROXY_ALIAS;
},
RSC_PREFETCH_SUFFIX: function() {
return RSC_PREFETCH_SUFFIX;
},
RSC_SEGMENTS_DIR_SUFFIX: function() {
return RSC_SEGMENTS_DIR_SUFFIX;
},
RSC_SEGMENT_SUFFIX: function() {
return RSC_SEGMENT_SUFFIX;
},
RSC_SUFFIX: function() {
return RSC_SUFFIX;
},
SERVER_PROPS_EXPORT_ERROR: function() {
return SERVER_PROPS_EXPORT_ERROR;
},
SERVER_PROPS_GET_INIT_PROPS_CONFLICT: function() {
return SERVER_PROPS_GET_INIT_PROPS_CONFLICT;
},
SERVER_PROPS_SSG_CONFLICT: function() {
return SERVER_PROPS_SSG_CONFLICT;
},
SERVER_RUNTIME: function() {
return SERVER_RUNTIME;
},
SSG_FALLBACK_EXPORT_ERROR: function() {
return SSG_FALLBACK_EXPORT_ERROR;
},
SSG_GET_INITIAL_PROPS_CONFLICT: function() {
return SSG_GET_INITIAL_PROPS_CONFLICT;
},
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: function() {
return STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR;
},
TEXT_PLAIN_CONTENT_TYPE_HEADER: function() {
return TEXT_PLAIN_CONTENT_TYPE_HEADER;
},
UNSTABLE_REVALIDATE_RENAME_ERROR: function() {
return UNSTABLE_REVALIDATE_RENAME_ERROR;
},
WEBPACK_LAYERS: function() {
return WEBPACK_LAYERS;
},
WEBPACK_RESOURCE_QUERIES: function() {
return WEBPACK_RESOURCE_QUERIES;
}
});
const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain';
const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8';
const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8';
const NEXT_QUERY_PARAM_PREFIX = 'nxtP';
const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI';
const MATCHED_PATH_HEADER = 'x-matched-path';
const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate';
const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = 'x-prerender-revalidate-if-generated';
const RSC_PREFETCH_SUFFIX = '.prefetch.rsc';
const RSC_SEGMENTS_DIR_SUFFIX = '.segments';
const RSC_SEGMENT_SUFFIX = '.segment.rsc';
const RSC_SUFFIX = '.rsc';
const ACTION_SUFFIX = '.action';
const NEXT_DATA_SUFFIX = '.json';
const NEXT_META_SUFFIX = '.meta';
const NEXT_BODY_SUFFIX = '.body';
const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags';
const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags';
const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = 'x-next-revalidate-tag-token';
const NEXT_RESUME_HEADER = 'next-resume';
const NEXT_CACHE_TAG_MAX_ITEMS = 128;
const NEXT_CACHE_TAG_MAX_LENGTH = 256;
const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024;
const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_';
const CACHE_ONE_YEAR = 31536000;
const INFINITE_CACHE = 0xfffffffe;
const MIDDLEWARE_FILENAME = 'middleware';
const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`;
const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation';
const PAGES_DIR_ALIAS = 'private-next-pages';
const DOT_NEXT_ALIAS = 'private-dot-next';
const ROOT_DIR_ALIAS = 'private-next-root-dir';
const APP_DIR_ALIAS = 'private-next-app-dir';
const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy';
const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate';
const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference';
const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper';
const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = 'private-next-rsc-track-dynamic-import';
const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption';
const RSC_ACTION_CLIENT_WRAPPER_ALIAS = 'private-next-rsc-action-client-wrapper';
const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`;
const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`;
const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`;
const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`;
const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`;
const SERVER_PROPS_EXPORT_ERROR = `pages with \`getServerSideProps\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`;
const GSP_NO_RETURNED_VALUE = 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?';
const GSSP_NO_RETURNED_VALUE = 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?';
const UNSTABLE_REVALIDATE_RENAME_ERROR = 'The `unstable_revalidate` property is available for general use.\n' + 'Please use `revalidate` instead.';
const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`;
const NON_STANDARD_NODE_ENV = `You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`;
const SSG_FALLBACK_EXPORT_ERROR = `Pages with \`fallback\` enabled in \`getStaticPaths\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`;
const ESLINT_DEFAULT_DIRS = [
'app',
'pages',
'components',
'lib',
'src'
];
const SERVER_RUNTIME = {
edge: 'edge',
experimentalEdge: 'experimental-edge',
nodejs: 'nodejs'
};
/**
* The names of the webpack layers. These layers are the primitives for the
* webpack chunks.
*/ const WEBPACK_LAYERS_NAMES = {
/**
* The layer for the shared code between the client and server bundles.
*/ shared: 'shared',
/**
* The layer for server-only runtime and picking up `react-server` export conditions.
* Including app router RSC pages and app router custom routes and metadata routes.
*/ reactServerComponents: 'rsc',
/**
* Server Side Rendering layer for app (ssr).
*/ serverSideRendering: 'ssr',
/**
* The browser client bundle layer for actions.
*/ actionBrowser: 'action-browser',
/**
* The Node.js bundle layer for the API routes.
*/ apiNode: 'api-node',
/**
* The Edge Lite bundle layer for the API routes.
*/ apiEdge: 'api-edge',
/**
* The layer for the middleware code.
*/ middleware: 'middleware',
/**
* The layer for the instrumentation hooks.
*/ instrument: 'instrument',
/**
* The layer for assets on the edge.
*/ edgeAsset: 'edge-asset',
/**
* The browser client bundle layer for App directory.
*/ appPagesBrowser: 'app-pages-browser',
/**
* The browser client bundle layer for Pages directory.
*/ pagesDirBrowser: 'pages-dir-browser',
/**
* The Edge Lite bundle layer for Pages directory.
*/ pagesDirEdge: 'pages-dir-edge',
/**
* The Node.js bundle layer for Pages directory.
*/ pagesDirNode: 'pages-dir-node'
};
const WEBPACK_LAYERS = {
...WEBPACK_LAYERS_NAMES,
GROUP: {
builtinReact: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser
],
serverOnly: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
neutralTarget: [
// pages api
WEBPACK_LAYERS_NAMES.apiNode,
WEBPACK_LAYERS_NAMES.apiEdge
],
clientOnly: [
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser
],
bundled: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.shared,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
appPages: [
// app router pages and layouts
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.actionBrowser
]
}
};
const WEBPACK_RESOURCE_QUERIES = {
edgeSSREntry: '__next_edge_ssr_entry__',
metadata: '__next_metadata__',
metadataRoute: '__next_metadata_route__',
metadataImageMeta: '__next_metadata_image_meta__'
};
//# sourceMappingURL=constants.js.map

15
vendor/node_modules/next/dist/lib/is-api-route.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isAPIRoute", {
enumerable: true,
get: function() {
return isAPIRoute;
}
});
function isAPIRoute(value) {
return value === '/api' || Boolean(value == null ? void 0 : value.startsWith('/api/'));
}
//# sourceMappingURL=is-api-route.js.map

72
vendor/node_modules/next/dist/lib/is-error.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
getProperError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
/**
* Checks whether the given value is a NextError.
* This can be used to print a more detailed error message with properties like `code` & `digest`.
*/ default: function() {
return isError;
},
getProperError: function() {
return getProperError;
}
});
const _isplainobject = require("../shared/lib/is-plain-object");
function isError(err) {
return typeof err === 'object' && err !== null && 'name' in err && 'message' in err;
}
function safeStringify(obj) {
const seen = new WeakSet();
return JSON.stringify(obj, (_key, value)=>{
// If value is an object and already seen, replace with "[Circular]"
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return '[Circular]';
}
seen.add(value);
}
return value;
});
}
function getProperError(err) {
if (isError(err)) {
return err;
}
if (process.env.NODE_ENV === 'development') {
// provide better error for case where `throw undefined`
// is called in development
if (typeof err === 'undefined') {
return Object.defineProperty(new Error('An undefined error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E98",
enumerable: false,
configurable: true
});
}
if (err === null) {
return Object.defineProperty(new Error('A null error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E336",
enumerable: false,
configurable: true
});
}
}
return Object.defineProperty(new Error((0, _isplainobject.isPlainObject)(err) ? safeStringify(err) : err + ''), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
//# sourceMappingURL=is-error.js.map

View File

@@ -0,0 +1,26 @@
/**
* This module imports the client instrumentation hook from the project root.
*
* The `private-next-instrumentation-client` module is automatically aliased to
* the `instrumentation-client.ts` file in the project root by webpack or turbopack.
*/ "use strict";
if (process.env.NODE_ENV === 'development') {
const measureName = 'Client Instrumentation Hook';
const startTime = performance.now();
// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
module.exports = require('private-next-instrumentation-client');
const endTime = performance.now();
const duration = endTime - startTime;
// Using 16ms threshold as it represents one frame (1000ms/60fps)
// This helps identify if the instrumentation hook initialization
// could potentially cause frame drops during development.
const THRESHOLD = 16;
if (duration > THRESHOLD) {
console.log(`[${measureName}] Slow execution detected: ${duration.toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`);
}
} else {
// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
module.exports = require('private-next-instrumentation-client');
}
//# sourceMappingURL=require-instrumentation-client.js.map

View File

@@ -0,0 +1,104 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
hasAdjacentParameterIssues: null,
normalizeAdjacentParameters: null,
normalizeTokensForRegexp: null,
stripParameterSeparators: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
hasAdjacentParameterIssues: function() {
return hasAdjacentParameterIssues;
},
normalizeAdjacentParameters: function() {
return normalizeAdjacentParameters;
},
normalizeTokensForRegexp: function() {
return normalizeTokensForRegexp;
},
stripParameterSeparators: function() {
return stripParameterSeparators;
}
});
/**
* Route pattern normalization utilities for path-to-regexp compatibility.
*
* path-to-regexp 6.3.0+ introduced stricter validation that rejects certain
* patterns commonly used in Next.js interception routes. This module provides
* normalization functions to make Next.js route patterns compatible with the
* updated library while preserving all functionality.
*/ /**
* Internal separator used to normalize adjacent parameter patterns.
* This unique marker is inserted between adjacent parameters and stripped out
* during parameter extraction to avoid conflicts with real URL content.
*/ const PARAM_SEPARATOR = '_NEXTSEP_';
function hasAdjacentParameterIssues(route) {
if (typeof route !== 'string') return false;
// Check for interception route markers followed immediately by parameters
// Pattern: /(.):param, /(..):param, /(...):param, /(.)(.):param etc.
// These patterns cause "Must have text between two parameters" errors
if (/\/\(\.{1,3}\):[^/\s]+/.test(route)) {
return true;
}
// Check for basic adjacent parameters without separators
// Pattern: :param1:param2 (but not :param* or other URL patterns)
if (/:[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*/.test(route)) {
return true;
}
return false;
}
function normalizeAdjacentParameters(route) {
let normalized = route;
// Handle interception route patterns: (.):param -> (.)_NEXTSEP_:param
normalized = normalized.replace(/(\([^)]*\)):([^/\s]+)/g, `$1${PARAM_SEPARATOR}:$2`);
// Handle other adjacent parameter patterns: :param1:param2 -> :param1_NEXTSEP_:param2
normalized = normalized.replace(/:([^:/\s)]+)(?=:)/g, `:$1${PARAM_SEPARATOR}`);
return normalized;
}
function normalizeTokensForRegexp(tokens) {
return tokens.map((token)=>{
// Token union type: Token = string | TokenObject
// Literal path segments are strings, parameters/wildcards are objects
if (typeof token === 'object' && token !== null && // Not all token objects have 'modifier' property (e.g., simple text tokens)
'modifier' in token && // Only repeating modifiers (* or +) cause the validation error
// Other modifiers like '?' (optional) are fine
(token.modifier === '*' || token.modifier === '+') && // Token objects can have different shapes depending on route pattern
'prefix' in token && 'suffix' in token && // Both prefix and suffix must be empty strings
// This is what causes the validation error in path-to-regexp
token.prefix === '' && token.suffix === '') {
// Add minimal prefix to satisfy path-to-regexp validation
// We use '/' as it's the most common path delimiter and won't break route matching
// The prefix gets used in regex generation but doesn't affect parameter extraction
return {
...token,
prefix: '/'
};
}
return token;
});
}
function stripParameterSeparators(params) {
const cleaned = {};
for (const [key, value] of Object.entries(params)){
if (typeof value === 'string') {
// Remove the separator if it appears at the start of parameter values
cleaned[key] = value.replace(new RegExp(`^${PARAM_SEPARATOR}`), '');
} else if (Array.isArray(value)) {
// Handle array parameters (from repeated route segments)
cleaned[key] = value.map((item)=>typeof item === 'string' ? item.replace(new RegExp(`^${PARAM_SEPARATOR}`), '') : item);
} else {
cleaned[key] = value;
}
}
return cleaned;
}
//# sourceMappingURL=route-pattern-normalizer.js.map