internal-utils.js 968 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.stripInternalQueries = stripInternalQueries;
  6. exports.stripInternalSearchParams = stripInternalSearchParams;
  7. const INTERNAL_QUERY_NAMES = [
  8. "__nextFallback",
  9. "__nextLocale",
  10. "__nextDefaultLocale",
  11. "__nextIsNotFound",
  12. // RSC
  13. "__flight__",
  14. // Routing
  15. "__flight_router_state_tree__",
  16. "__flight_prefetch__",
  17. ];
  18. const EXTENDED_INTERNAL_QUERY_NAMES = [
  19. "__nextDataReq"
  20. ];
  21. function stripInternalQueries(query) {
  22. for (const name of INTERNAL_QUERY_NAMES){
  23. delete query[name];
  24. }
  25. }
  26. function stripInternalSearchParams(searchParams, extended) {
  27. for (const name of INTERNAL_QUERY_NAMES){
  28. searchParams.delete(name);
  29. }
  30. if (extended) {
  31. for (const name of EXTENDED_INTERNAL_QUERY_NAMES){
  32. searchParams.delete(name);
  33. }
  34. }
  35. return searchParams;
  36. }
  37. //# sourceMappingURL=internal-utils.js.map