@farm.js/core 0.1.38 → 0.1.39

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.
Files changed (151) hide show
  1. package/dist/{agent-mcp-BwKlpnc7.d.mts → agent-mcp-BhneNPb4.d.mts} +1 -1
  2. package/dist/{agent-mcp-De1imoMS.d.ts → agent-mcp-HcTYQmNX.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -3
  4. package/dist/agent-runtime.d.mts +1 -1
  5. package/dist/agent-runtime.d.ts +1 -1
  6. package/dist/agent-runtime.mjs +2 -2
  7. package/dist/api/route-manager.d.mts +3 -3
  8. package/dist/api/route-manager.d.ts +3 -3
  9. package/dist/api/runtime.d.mts +2 -2
  10. package/dist/api/runtime.d.ts +2 -2
  11. package/dist/api.d.mts +3 -3
  12. package/dist/api.d.ts +3 -3
  13. package/dist/{app-kT_QXTdx.d.ts → app-CMkoghtp.d.ts} +3 -3
  14. package/dist/{app-CFZt-srr.d.mts → app-DVzmmbNO.d.mts} +3 -3
  15. package/dist/app-markdown.d.mts +2 -2
  16. package/dist/app-markdown.d.ts +2 -2
  17. package/dist/{chunk-4E5QXOCL.cjs → chunk-5ULKUBIA.cjs} +6 -6
  18. package/dist/{chunk-TYMMBFN2.mjs → chunk-677THUVP.mjs} +1 -1
  19. package/dist/{chunk-CXEN47J3.mjs → chunk-73WX6PRY.mjs} +25 -0
  20. package/dist/{chunk-ZJD2PN6Z.mjs → chunk-75HN5IZ3.mjs} +12 -2
  21. package/dist/{chunk-L4DD7ODZ.cjs → chunk-A657YSP4.cjs} +2 -2
  22. package/dist/{chunk-YR2VBEMO.cjs → chunk-AS2VPMEE.cjs} +96 -96
  23. package/dist/{chunk-IBUQWVYA.mjs → chunk-ATSDUUFK.mjs} +11 -1
  24. package/dist/{chunk-TYJALEHQ.cjs → chunk-B5J2YVG7.cjs} +14 -14
  25. package/dist/{chunk-FWE7LEQC.cjs → chunk-BD3D7EZV.cjs} +4 -4
  26. package/dist/{chunk-7FPTZLKH.mjs → chunk-BFJTHYTN.mjs} +1 -1
  27. package/dist/{chunk-VU6AAZVY.cjs → chunk-BWIQR4DH.cjs} +13 -3
  28. package/dist/{chunk-XKVVMZP5.cjs → chunk-BXDJXFQG.cjs} +4 -4
  29. package/dist/{chunk-4IE345DM.cjs → chunk-CIOT4HGT.cjs} +2 -2
  30. package/dist/{chunk-DRLKAXDM.mjs → chunk-EGCTIS5F.mjs} +2 -2
  31. package/dist/{chunk-B6G5CKMC.mjs → chunk-GKBWWRBG.mjs} +3 -3
  32. package/dist/{chunk-Q3NXS4MU.cjs → chunk-HRETEZ2Z.cjs} +13 -3
  33. package/dist/{chunk-EMO6K4YY.cjs → chunk-HRSAQ23K.cjs} +7 -7
  34. package/dist/{chunk-TUBTR2OP.mjs → chunk-HYTZYOW2.mjs} +6 -6
  35. package/dist/{chunk-EKF7KDFD.mjs → chunk-KTSUBU2E.mjs} +2 -2
  36. package/dist/{chunk-KCQBAKIY.cjs → chunk-LMPAPBUA.cjs} +10 -10
  37. package/dist/{chunk-EK4QAEFZ.cjs → chunk-LZESP4IR.cjs} +25 -0
  38. package/dist/{chunk-HZFM2LWQ.mjs → chunk-P3PLW4FR.mjs} +34 -2
  39. package/dist/{chunk-KHKLMNI5.mjs → chunk-PVZE2JGJ.mjs} +1 -1
  40. package/dist/{chunk-N32CC42M.cjs → chunk-QG775BRV.cjs} +12 -12
  41. package/dist/{chunk-KKSTAEMY.cjs → chunk-QUCXCDE2.cjs} +1 -1
  42. package/dist/{chunk-JCKYH4LG.mjs → chunk-QYMZOOC5.mjs} +1 -1
  43. package/dist/{chunk-2DD4JMQC.cjs → chunk-RVXFINNS.cjs} +12 -12
  44. package/dist/{chunk-LI2F57NI.mjs → chunk-SOP2EAA6.mjs} +1 -1
  45. package/dist/{chunk-ND2CWPOD.mjs → chunk-TS4JHGUJ.mjs} +1 -1
  46. package/dist/{chunk-4GWRFP22.cjs → chunk-UPJLHLJU.cjs} +35 -3
  47. package/dist/{chunk-7PEP3BUT.mjs → chunk-VWBHM3F6.mjs} +1 -1
  48. package/dist/{chunk-TGFQVLLF.cjs → chunk-YFYUYWL7.cjs} +95 -95
  49. package/dist/{chunk-A3EAIURZ.mjs → chunk-YKZRDB5Z.mjs} +1 -1
  50. package/dist/{chunk-OCIEZME4.mjs → chunk-ZUPXLIGB.mjs} +8 -8
  51. package/dist/{client-plugins-DUrIYX9B.d.mts → client-plugins-CsCuCLBz.d.mts} +18 -0
  52. package/dist/{client-plugins-BvlNhGEB.d.ts → client-plugins-D0ke-Hc8.d.ts} +18 -0
  53. package/dist/client-plugins.d.mts +1 -1
  54. package/dist/client-plugins.d.ts +1 -1
  55. package/dist/client.cjs +4 -4
  56. package/dist/client.d.mts +5 -5
  57. package/dist/client.d.ts +5 -5
  58. package/dist/client.mjs +3 -3
  59. package/dist/config.d.mts +1 -1
  60. package/dist/config.d.ts +1 -1
  61. package/dist/{devtools-JYJNOLPQ.mjs → devtools-5AFIPVUJ.mjs} +3 -3
  62. package/dist/{devtools-VQWJANJV.cjs → devtools-LW4QQ5J3.cjs} +4 -4
  63. package/dist/docs.cjs +5 -5
  64. package/dist/docs.d.mts +2 -2
  65. package/dist/docs.d.ts +2 -2
  66. package/dist/docs.mjs +4 -4
  67. package/dist/index.cjs +18 -18
  68. package/dist/index.d.mts +13 -13
  69. package/dist/index.d.ts +13 -13
  70. package/dist/index.mjs +17 -17
  71. package/dist/integrations.cjs +3 -3
  72. package/dist/integrations.d.mts +1 -1
  73. package/dist/integrations.d.ts +1 -1
  74. package/dist/integrations.mjs +2 -2
  75. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  76. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  77. package/dist/internal/build-runtime.cjs +12 -12
  78. package/dist/internal/build-runtime.d.mts +3 -3
  79. package/dist/internal/build-runtime.d.ts +3 -3
  80. package/dist/internal/build-runtime.mjs +11 -11
  81. package/dist/internal/cli-runtime.cjs +5 -5
  82. package/dist/internal/cli-runtime.mjs +4 -4
  83. package/dist/internal/client-error-overlay.cjs +4 -4
  84. package/dist/internal/client-error-overlay.mjs +1 -1
  85. package/dist/internal/compression-runtime.d.mts +1 -1
  86. package/dist/internal/compression-runtime.d.ts +1 -1
  87. package/dist/internal/config-runtime.cjs +4 -4
  88. package/dist/internal/config-runtime.d.mts +2 -2
  89. package/dist/internal/config-runtime.d.ts +2 -2
  90. package/dist/internal/config-runtime.mjs +3 -3
  91. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  92. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  93. package/dist/internal/production-runtime.cjs +10 -8
  94. package/dist/internal/production-runtime.d.mts +9 -9
  95. package/dist/internal/production-runtime.d.ts +9 -9
  96. package/dist/internal/production-runtime.mjs +9 -7
  97. package/dist/markdown.d.mts +1 -1
  98. package/dist/markdown.d.ts +1 -1
  99. package/dist/middleware.cjs +5 -5
  100. package/dist/middleware.d.mts +3 -3
  101. package/dist/middleware.d.ts +3 -3
  102. package/dist/middleware.mjs +4 -4
  103. package/dist/navigation.cjs +5 -5
  104. package/dist/navigation.d.mts +4 -4
  105. package/dist/navigation.d.ts +4 -4
  106. package/dist/navigation.mjs +4 -4
  107. package/dist/plugin.cjs +8 -8
  108. package/dist/plugin.d.mts +1 -1
  109. package/dist/plugin.d.ts +1 -1
  110. package/dist/plugin.mjs +7 -7
  111. package/dist/{production-runtime-D2aMyzjr.d.ts → production-runtime-BaI3WHnV.d.ts} +1 -1
  112. package/dist/{production-runtime-BQ4_WLwQ.d.mts → production-runtime-DfRP0cV0.d.mts} +1 -1
  113. package/dist/query/client.cjs +6 -6
  114. package/dist/query/client.mjs +2 -2
  115. package/dist/{render-plan-25p4hrj4.d.ts → render-plan-CfIdJKAf.d.ts} +1 -1
  116. package/dist/{render-plan-DtkXMN8D.d.mts → render-plan-Dg8RBYFa.d.mts} +1 -1
  117. package/dist/renderer-client.cjs +5 -5
  118. package/dist/renderer-client.d.mts +3 -3
  119. package/dist/renderer-client.d.ts +3 -3
  120. package/dist/renderer-client.mjs +2 -2
  121. package/dist/{request-jF4jwx8f.d.ts → request-CEbHIIl4.d.ts} +1 -1
  122. package/dist/{request-DgCkIdcn.d.mts → request-DfE02G_A.d.mts} +1 -1
  123. package/dist/request.d.mts +2 -2
  124. package/dist/request.d.ts +2 -2
  125. package/dist/{route-rendering-CSBF78Ya.d.mts → route-rendering-BHyOfXjD.d.mts} +1 -1
  126. package/dist/{route-rendering-Bji6S6a_.d.ts → route-rendering-C4oHbv6C.d.ts} +1 -1
  127. package/dist/{router-B09Ui3Qm.d.mts → router-DwhA61SB.d.mts} +1 -1
  128. package/dist/{router-CPB9cXtG.d.ts → router-uRN_29Em.d.ts} +1 -1
  129. package/dist/routes.d.mts +1 -1
  130. package/dist/routes.d.ts +1 -1
  131. package/dist/{runtime-CM6E6yuI.d.mts → runtime-BEdHhN4C.d.mts} +1 -1
  132. package/dist/{runtime-EDMwLdjv.d.ts → runtime-COk03hmx.d.ts} +1 -1
  133. package/dist/server-plugins.d.mts +2 -2
  134. package/dist/server-plugins.d.ts +2 -2
  135. package/dist/server.cjs +25 -25
  136. package/dist/server.d.mts +7 -7
  137. package/dist/server.d.ts +7 -7
  138. package/dist/server.mjs +8 -8
  139. package/dist/{spa-router-B_N8XgVu.d.ts → spa-router-DrVOBVGg.d.ts} +2 -2
  140. package/dist/{spa-router-Cgimzfbi.d.mts → spa-router-w4aFOuyn.d.mts} +2 -2
  141. package/dist/testing.d.mts +1 -1
  142. package/dist/testing.d.ts +1 -1
  143. package/dist/{utils-DZciYXYl.d.mts → utils-BtYehqeU.d.mts} +1 -1
  144. package/dist/{utils-BNxAKAuT.d.ts → utils-Dhuqwmd2.d.ts} +1 -1
  145. package/dist/version.cjs +2 -2
  146. package/dist/version.mjs +1 -1
  147. package/dist/vite.cjs +8 -8
  148. package/dist/vite.d.mts +1 -1
  149. package/dist/vite.d.ts +1 -1
  150. package/dist/vite.mjs +7 -7
  151. package/package.json +1 -1
@@ -2,9 +2,10 @@ import {
2
2
  defineSchema
3
3
  } from "./chunk-44SYJEG3.mjs";
4
4
  import {
5
+ assertSupportedMiddlewareMatcher,
5
6
  compileMiddlewareConfig,
6
7
  matchesCompiledMiddlewareConfig
7
- } from "./chunk-HZFM2LWQ.mjs";
8
+ } from "./chunk-P3PLW4FR.mjs";
8
9
  import {
9
10
  bufferFarmRequestBody,
10
11
  clearRequestContext,
@@ -285,6 +286,15 @@ function resolveIntegrationPlugins(integrations) {
285
286
  if (!integration || !isFarmIntegration(integration)) {
286
287
  continue;
287
288
  }
289
+ for (const entry of integration.middleware || []) {
290
+ if (!entry.matcher) continue;
291
+ const matchers = Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher];
292
+ try {
293
+ matchers.forEach(assertSupportedMiddlewareMatcher);
294
+ } catch (error) {
295
+ throw new Error(`Integration "${key}": ${error.message}`);
296
+ }
297
+ }
288
298
  const owner = createIntegrationPluginOwner(key, integration, "lifecycle");
289
299
  plugins.push(withIntegrationPluginOwner(createIntegrationPlugin(key, integration), owner));
290
300
  plugins.push(...resolveIntegrationPluginContributions(key, integration));
@@ -7,7 +7,7 @@ var _chunkSU7MH53Pcjs = require('./chunk-SU7MH53P.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkFWE7LEQCcjs = require('./chunk-FWE7LEQC.cjs');
10
+ var _chunkBD3D7EZVcjs = require('./chunk-BD3D7EZV.cjs');
11
11
 
12
12
 
13
13
  var _chunkS6FJO323cjs = require('./chunk-S6FJO323.cjs');
@@ -52,7 +52,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, shouldBlockUnload, "shouldBlockUnload");
52
52
  function navigateViaRouter(href, basePath, replace, options = {}) {
53
53
  if (typeof window === "undefined") return;
54
54
  const url = _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href, basePath);
55
- const spaRouter = _chunkFWE7LEQCcjs.getInstalledFarmSPARouter.call(void 0, );
55
+ const spaRouter = _chunkBD3D7EZVcjs.getInstalledFarmSPARouter.call(void 0, );
56
56
  if (spaRouter) {
57
57
  void spaRouter.navigate(url, {
58
58
  replace,
@@ -65,7 +65,7 @@ function navigateViaRouter(href, basePath, replace, options = {}) {
65
65
  } else {
66
66
  window.history.pushState(null, "", url);
67
67
  }
68
- _chunkFWE7LEQCcjs.notifyHistoryChange.call(void 0, "url-search");
68
+ _chunkBD3D7EZVcjs.notifyHistoryChange.call(void 0, "url-search");
69
69
  }
70
70
  _chunkS3JO3N4Hcjs.__name.call(void 0, navigateViaRouter, "navigateViaRouter");
71
71
  function useRouter(options = {}) {
@@ -85,7 +85,7 @@ function useRouter(options = {}) {
85
85
  setState(readRouterState(basePath, routeMatcher));
86
86
  }, "handlePopState");
87
87
  handlePopState();
88
- const unsubscribe = _chunkFWE7LEQCcjs.subscribeHistoryChange.call(void 0, handlePopState);
88
+ const unsubscribe = _chunkBD3D7EZVcjs.subscribeHistoryChange.call(void 0, handlePopState);
89
89
  return unsubscribe;
90
90
  }, [basePath, routeMatcher]);
91
91
  const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
@@ -96,11 +96,11 @@ function useRouter(options = {}) {
96
96
  }, "replace");
97
97
  const pushState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
98
98
  if (typeof window === "undefined") return;
99
- _chunkFWE7LEQCcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
99
+ _chunkBD3D7EZVcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
100
100
  }, "pushState");
101
101
  const replaceState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
102
102
  if (typeof window === "undefined") return;
103
- _chunkFWE7LEQCcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
103
+ _chunkBD3D7EZVcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
104
104
  }, "replaceState");
105
105
  const back = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
106
106
  if (typeof window !== "undefined") {
@@ -124,25 +124,25 @@ function useRouter(options = {}) {
124
124
  }
125
125
  _chunkS3JO3N4Hcjs.__name.call(void 0, useRouter, "useRouter");
126
126
  function usePageState() {
127
- const [state, setState] = _react.useState.call(void 0, () => _chunkFWE7LEQCcjs.readPageState.call(void 0, ));
127
+ const [state, setState] = _react.useState.call(void 0, () => _chunkBD3D7EZVcjs.readPageState.call(void 0, ));
128
128
  _react.useEffect.call(void 0, () => {
129
129
  if (typeof window === "undefined") return;
130
130
  const handlePopState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
131
- setState(_chunkFWE7LEQCcjs.readPageState.call(void 0, ));
131
+ setState(_chunkBD3D7EZVcjs.readPageState.call(void 0, ));
132
132
  }, "handlePopState");
133
133
  handlePopState();
134
- return _chunkFWE7LEQCcjs.subscribeHistoryChange.call(void 0, handlePopState);
134
+ return _chunkBD3D7EZVcjs.subscribeHistoryChange.call(void 0, handlePopState);
135
135
  }, []);
136
136
  return state;
137
137
  }
138
138
  _chunkS3JO3N4Hcjs.__name.call(void 0, usePageState, "usePageState");
139
139
  function useNavigation() {
140
140
  const [state, setState] = _react.useState.call(void 0,
141
- () => _chunkFWE7LEQCcjs.getRouter.call(void 0, ).getNavigationState()
141
+ () => _chunkBD3D7EZVcjs.getRouter.call(void 0, ).getNavigationState()
142
142
  );
143
143
  _react.useEffect.call(void 0, () => {
144
144
  if (typeof window === "undefined") return;
145
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
145
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
146
146
  }, []);
147
147
  return state;
148
148
  }
@@ -155,7 +155,7 @@ function useBlocker(options) {
155
155
  if (typeof window === "undefined" || !active) {
156
156
  return;
157
157
  }
158
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).addBlocker(
158
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).addBlocker(
159
159
  async (context) => {
160
160
  const current = optionsRef.current;
161
161
  const when = typeof current.when === "function" ? current.when(context) : current.when;
@@ -179,7 +179,7 @@ function useScrollRestoration(key) {
179
179
  _react.useEffect.call(void 0, () => {
180
180
  const element = ref.current;
181
181
  if (!element) return;
182
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
182
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
183
183
  }, [key]);
184
184
  return ref;
185
185
  }
@@ -201,7 +201,7 @@ function readRouterState(basePath, routeMatcher) {
201
201
  pathname,
202
202
  searchParams: url.searchParams,
203
203
  params: _optionalChain([routeMatcher, 'optionalAccess', _5 => _5.match, 'call', _6 => _6(routePathname), 'optionalAccess', _7 => _7.params]) || {},
204
- pageState: typeof window === "undefined" ? null : _chunkFWE7LEQCcjs.readPageState.call(void 0, )
204
+ pageState: typeof window === "undefined" ? null : _chunkBD3D7EZVcjs.readPageState.call(void 0, )
205
205
  };
206
206
  }
207
207
  _chunkS3JO3N4Hcjs.__name.call(void 0, readRouterState, "readRouterState");
@@ -17,7 +17,7 @@ var _chunkJ7FSKED3cjs = require('./chunk-J7FSKED3.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkEK4QAEFZcjs = require('./chunk-EK4QAEFZ.cjs');
20
+ var _chunkLZESP4IRcjs = require('./chunk-LZESP4IR.cjs');
21
21
 
22
22
 
23
23
 
@@ -31,7 +31,7 @@ var _chunkQBK2AA4Ucjs = require('./chunk-QBK2AA4U.cjs');
31
31
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
32
32
 
33
33
  // src/client/metadata-reconciler.ts
34
- var MANAGED_ATTRIBUTE = _chunkEK4QAEFZcjs.FARM_METADATA_ATTRIBUTE;
34
+ var MANAGED_ATTRIBUTE = _chunkLZESP4IRcjs.FARM_METADATA_ATTRIBUTE;
35
35
  var OWNED_SELECTORS = [
36
36
  'meta[name="description"]',
37
37
  'meta[name="keywords"]',
@@ -66,8 +66,8 @@ function removeAll(selector) {
66
66
  }
67
67
  _chunkS3JO3N4Hcjs.__name.call(void 0, removeAll, "removeAll");
68
68
  function applyFarmMetadataToDocument(metadata, pathname) {
69
- document.title = _chunkEK4QAEFZcjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
70
- const rendered = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, metadata, { pathname });
69
+ document.title = _chunkLZESP4IRcjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
70
+ const rendered = _chunkLZESP4IRcjs.renderMetadataHead.call(void 0, metadata, { pathname });
71
71
  const template = document.createElement("template");
72
72
  template.innerHTML = rendered.tags;
73
73
  const viewport = document.createElement("template");
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ZMSZZXOR.mjs";
28
28
  import {
29
29
  getIntegrationSchemas
30
- } from "./chunk-IBUQWVYA.mjs";
30
+ } from "./chunk-ATSDUUFK.mjs";
31
31
  import {
32
32
  __name
33
33
  } from "./chunk-LPEX4YW6.mjs";
@@ -4,7 +4,8 @@ var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
7
+
8
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
8
9
 
9
10
 
10
11
 
@@ -285,6 +286,15 @@ function resolveIntegrationPlugins(integrations) {
285
286
  if (!integration || !isFarmIntegration(integration)) {
286
287
  continue;
287
288
  }
289
+ for (const entry of integration.middleware || []) {
290
+ if (!entry.matcher) continue;
291
+ const matchers = Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher];
292
+ try {
293
+ matchers.forEach(_chunkUPJLHLJUcjs.assertSupportedMiddlewareMatcher);
294
+ } catch (error) {
295
+ throw new Error(`Integration "${key}": ${error.message}`);
296
+ }
297
+ }
288
298
  const owner = createIntegrationPluginOwner(key, integration, "lifecycle");
289
299
  plugins.push(withIntegrationPluginOwner(createIntegrationPlugin(key, integration), owner));
290
300
  plugins.push(...resolveIntegrationPluginContributions(key, integration));
@@ -2021,13 +2031,13 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2021
2031
  }
2022
2032
  let compiled = compiledIntegrationGuards.get(entry);
2023
2033
  if (!compiled) {
2024
- compiled = _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, {
2034
+ compiled = _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, {
2025
2035
  matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
2026
2036
  });
2027
2037
  compiledIntegrationGuards.set(entry, compiled);
2028
2038
  }
2029
2039
  for (const candidate of candidates) {
2030
- const result = _chunk4GWRFP22cjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2040
+ const result = _chunkUPJLHLJUcjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2031
2041
  if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
2032
2042
  }
2033
2043
  return null;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkKCQBAKIYcjs = require('./chunk-KCQBAKIY.cjs');
3
+ var _chunkLMPAPBUAcjs = require('./chunk-LMPAPBUA.cjs');
4
4
 
5
5
 
6
- var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
6
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
7
7
 
8
8
 
9
9
  var _chunkHLJ6MBUZcjs = require('./chunk-HLJ6MBUZ.cjs');
@@ -213,7 +213,7 @@ var _MiddlewareChainImpl = class _MiddlewareChainImpl {
213
213
  */
214
214
  when(condition, fn) {
215
215
  const conditionalMiddleware = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (ctx, next) => {
216
- const shouldRun = typeof condition === "function" ? _chunk4GWRFP22cjs.matchesMiddlewarePredicate.call(void 0, condition, ctx) : condition;
216
+ const shouldRun = typeof condition === "function" ? _chunkUPJLHLJUcjs.matchesMiddlewarePredicate.call(void 0, condition, ctx) : condition;
217
217
  if (!shouldRun) {
218
218
  return next();
219
219
  }
@@ -418,7 +418,7 @@ function farmMiddlewarePlugin(options = {}) {
418
418
  mode: server.config.mode === "production" ? "production" : "development",
419
419
  basePath: _nullishCoalesce(options.basePath, () => ( "/"))
420
420
  });
421
- manager = new (0, _chunkKCQBAKIYcjs.MiddlewareManager)(
421
+ manager = new (0, _chunkLMPAPBUAcjs.MiddlewareManager)(
422
422
  getMiddlewareAppDirectory(server.config.root, srcDir),
423
423
  server,
424
424
  options.middleware,
@@ -11,7 +11,7 @@ var _chunkPGZDEPTMcjs = require('./chunk-PGZDEPTM.cjs');
11
11
  var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
12
12
 
13
13
 
14
- var _chunkQ3NXS4MUcjs = require('./chunk-Q3NXS4MU.cjs');
14
+ var _chunkHRETEZ2Zcjs = require('./chunk-HRETEZ2Z.cjs');
15
15
 
16
16
 
17
17
 
@@ -564,7 +564,7 @@ async function resolveAPIContext(options) {
564
564
  config: options.config,
565
565
  configPath: options.configPath
566
566
  }));
567
- const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkQ3NXS4MUcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
567
+ const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkHRETEZ2Zcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
568
568
  const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _20 => _20.guardedPaths]), () => ( [])));
569
569
  return {
570
570
  root,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-7PEP3BUT.mjs";
3
+ } from "./chunk-VWBHM3F6.mjs";
4
4
  import {
5
5
  getRouter
6
- } from "./chunk-ND2CWPOD.mjs";
6
+ } from "./chunk-TS4JHGUJ.mjs";
7
7
  import {
8
8
  applyFarmBasePath
9
9
  } from "./chunk-4RB44K6Z.mjs";
@@ -18,12 +18,12 @@ import {
18
18
  } from "./chunk-AELACLOB.mjs";
19
19
  import {
20
20
  integrationMiddlewareMayHandlePath
21
- } from "./chunk-IBUQWVYA.mjs";
21
+ } from "./chunk-ATSDUUFK.mjs";
22
22
  import {
23
23
  compileMiddlewareConfig,
24
24
  matchesCompiledMiddlewareConfig,
25
25
  matchesMiddlewareRoute
26
- } from "./chunk-HZFM2LWQ.mjs";
26
+ } from "./chunk-P3PLW4FR.mjs";
27
27
  import {
28
28
  omitFarmResponseBody
29
29
  } from "./chunk-5WI2S4CO.mjs";
@@ -42,7 +42,7 @@ import {
42
42
  } from "./chunk-BTHHUD7Q.mjs";
43
43
  import {
44
44
  FARM_VERSION
45
- } from "./chunk-LI2F57NI.mjs";
45
+ } from "./chunk-SOP2EAA6.mjs";
46
46
  import {
47
47
  localizeFarmPathname
48
48
  } from "./chunk-L3KT7IXV.mjs";
@@ -65,7 +65,10 @@ var _chunkSDOTRX3Vcjs = require('./chunk-SDOTRX3V.cjs');
65
65
  var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
66
66
 
67
67
 
68
- var _chunkVU6AAZVYcjs = require('./chunk-VU6AAZVY.cjs');
68
+ var _chunkBWIQR4DHcjs = require('./chunk-BWIQR4DH.cjs');
69
+
70
+
71
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
69
72
 
70
73
 
71
74
  var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
@@ -659,6 +662,13 @@ function validateRedirectConfigs(redirects, field) {
659
662
  return redirects;
660
663
  }
661
664
  _chunkS3JO3N4Hcjs.__name.call(void 0, validateRedirectConfigs, "validateRedirectConfigs");
665
+ function validateMiddlewareConfig(middleware) {
666
+ for (const entry of Array.isArray(middleware) ? middleware : middleware ? [middleware] : []) {
667
+ _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, { matcher: entry.matcher, exclude: entry.exclude });
668
+ }
669
+ return middleware;
670
+ }
671
+ _chunkS3JO3N4Hcjs.__name.call(void 0, validateMiddlewareConfig, "validateMiddlewareConfig");
662
672
  function validateConfigRouteSources(routes, field) {
663
673
  for (const [index, route] of routes.entries()) {
664
674
  _chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, route.source, `${field}[${index}].source`);
@@ -787,7 +797,7 @@ async function resolveConfig(userConfig, mode) {
787
797
  },
788
798
  agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
789
799
  plugins: [
790
- ..._chunkVU6AAZVYcjs.resolveIntegrationPlugins.call(void 0, integrations),
800
+ ..._chunkBWIQR4DHcjs.resolveIntegrationPlugins.call(void 0, integrations),
791
801
  ...nativeMCPPlugin ? [nativeMCPPlugin] : [],
792
802
  ...userConfig.plugins || []
793
803
  ],
@@ -807,7 +817,7 @@ async function resolveConfig(userConfig, mode) {
807
817
  publicDir: userConfig.publicDir || "public",
808
818
  i18n: _chunkHLJ6MBUZcjs.resolveFarmI18nConfig.call(void 0, userConfig.i18n, { root, mode, basePath }),
809
819
  openapi,
810
- middleware: userConfig.middleware || {},
820
+ middleware: validateMiddlewareConfig(userConfig.middleware) || {},
811
821
  notFound: userConfig.notFound || {},
812
822
  context: userConfig.context || (() => void 0),
813
823
  server: _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, userConfig.server),
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkTYJALEHQcjs = require('./chunk-TYJALEHQ.cjs');
3
+ var _chunkB5J2YVG7cjs = require('./chunk-B5J2YVG7.cjs');
4
4
 
5
5
 
6
- var _chunkFWE7LEQCcjs = require('./chunk-FWE7LEQC.cjs');
6
+ var _chunkBD3D7EZVcjs = require('./chunk-BD3D7EZV.cjs');
7
7
 
8
8
 
9
9
  var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
@@ -13,7 +13,7 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
13
13
 
14
14
  // src/navigation.ts
15
15
  function useRouter2() {
16
- const router = _chunkTYJALEHQcjs.useRouter.call(void 0, );
16
+ const router = _chunkB5J2YVG7cjs.useRouter.call(void 0, );
17
17
  return {
18
18
  push: router.push,
19
19
  replace: router.replace,
@@ -21,21 +21,21 @@ function useRouter2() {
21
21
  forward: router.forward,
22
22
  refresh() {
23
23
  if (typeof window === "undefined") return Promise.resolve();
24
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).refresh();
24
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).refresh();
25
25
  },
26
26
  prefetch(href) {
27
27
  if (typeof window === "undefined") return Promise.resolve();
28
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
28
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
29
29
  }
30
30
  };
31
31
  }
32
32
  _chunkS3JO3N4Hcjs.__name.call(void 0, useRouter2, "useRouter");
33
33
  function usePathname() {
34
- return _chunkTYJALEHQcjs.useRouter.call(void 0, ).pathname;
34
+ return _chunkB5J2YVG7cjs.useRouter.call(void 0, ).pathname;
35
35
  }
36
36
  _chunkS3JO3N4Hcjs.__name.call(void 0, usePathname, "usePathname");
37
37
  function useSearchParams() {
38
- return _chunkTYJALEHQcjs.useRouter.call(void 0, ).searchParams;
38
+ return _chunkB5J2YVG7cjs.useRouter.call(void 0, ).searchParams;
39
39
  }
40
40
  _chunkS3JO3N4Hcjs.__name.call(void 0, useSearchParams, "useSearchParams");
41
41
 
@@ -44,7 +44,7 @@ import {
44
44
  resolveFarmAppManifestInput,
45
45
  routeBoundaryCoversDirectory,
46
46
  stripRouteGroups
47
- } from "./chunk-B6G5CKMC.mjs";
47
+ } from "./chunk-GKBWWRBG.mjs";
48
48
  import {
49
49
  FARM_DEFAULT_MCP_PATH,
50
50
  collectFarmDefaultMCPPages,
@@ -203,10 +203,10 @@ import {
203
203
  getRegisteredIntegrationAPIManifest,
204
204
  isFarmIntegrationProviderComponentReference,
205
205
  matchIntegrationRoute
206
- } from "./chunk-IBUQWVYA.mjs";
206
+ } from "./chunk-ATSDUUFK.mjs";
207
207
  import {
208
208
  MiddlewareManager
209
- } from "./chunk-JCKYH4LG.mjs";
209
+ } from "./chunk-QYMZOOC5.mjs";
210
210
  import {
211
211
  createRouteSlotContainerId,
212
212
  parseRouteSlotFile
@@ -332,7 +332,7 @@ import {
332
332
  } from "./chunk-BTHHUD7Q.mjs";
333
333
  import {
334
334
  FARM_VERSION
335
- } from "./chunk-LI2F57NI.mjs";
335
+ } from "./chunk-SOP2EAA6.mjs";
336
336
  import {
337
337
  resolveFarmTrailingSlashRedirect,
338
338
  setFarmTrailingSlashPreference
@@ -353,7 +353,7 @@ import {
353
353
  renderMetadataHead,
354
354
  renderViewportHead,
355
355
  resolveFarmNotFoundMetadata
356
- } from "./chunk-CXEN47J3.mjs";
356
+ } from "./chunk-73WX6PRY.mjs";
357
357
  import {
358
358
  FARM_DEPLOYMENT_ID_HEADER,
359
359
  createFarmDeploymentCookie,
@@ -10261,7 +10261,7 @@ function loadFarmWorkflowsDevRuntime() {
10261
10261
  }
10262
10262
  __name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
10263
10263
  function loadFarmDevtoolsSnapshotRuntime() {
10264
- return import("./devtools-JYJNOLPQ.mjs");
10264
+ return import("./devtools-5AFIPVUJ.mjs");
10265
10265
  }
10266
10266
  __name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
10267
10267
  function loadFarmDevtoolsUIRuntime() {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  MiddlewareManager
3
- } from "./chunk-JCKYH4LG.mjs";
3
+ } from "./chunk-QYMZOOC5.mjs";
4
4
  import {
5
5
  matchesMiddlewarePredicate
6
- } from "./chunk-HZFM2LWQ.mjs";
6
+ } from "./chunk-P3PLW4FR.mjs";
7
7
  import {
8
8
  resolveFarmI18nConfig
9
9
  } from "./chunk-BCMSYSN2.mjs";
@@ -14,7 +14,7 @@ var _chunkZXH4TS3Fcjs = require('./chunk-ZXH4TS3F.cjs');
14
14
 
15
15
 
16
16
 
17
- var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
17
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
18
18
 
19
19
 
20
20
  var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
@@ -106,7 +106,7 @@ function createContext(req, res, viteServer, parent, server, toRoutePathname) {
106
106
  response: res,
107
107
  url,
108
108
  pathname: url.pathname,
109
- routePathname: _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, url.pathname, toRoutePathname),
109
+ routePathname: _chunkUPJLHLJUcjs.toMiddlewareRoutePathname.call(void 0, url.pathname, toRoutePathname),
110
110
  searchParams: url.searchParams,
111
111
  method: req.method || "GET",
112
112
  params: {},
@@ -142,7 +142,7 @@ function createContext(req, res, viteServer, parent, server, toRoutePathname) {
142
142
  const newUrl = new URL(rewriteUrl, ctx.url);
143
143
  ctx.url = newUrl;
144
144
  ctx.pathname = newUrl.pathname;
145
- ctx.routePathname = _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, newUrl.pathname, toRoutePathname);
145
+ ctx.routePathname = _chunkUPJLHLJUcjs.toMiddlewareRoutePathname.call(void 0, newUrl.pathname, toRoutePathname);
146
146
  ctx.searchParams = newUrl.searchParams;
147
147
  ctx.route = newUrl.pathname;
148
148
  req.url = rewriteUrl;
@@ -249,7 +249,7 @@ var _MiddlewareManager = class _MiddlewareManager {
249
249
  for (const [index, entry] of entries.entries()) {
250
250
  const handlers = this.getConfigHandlers(entry);
251
251
  const middlewareConfig = this.toMiddlewareConfig(entry);
252
- _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
252
+ _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
253
253
  if (handlers.length === 0) {
254
254
  this.globalConfig = middlewareConfig;
255
255
  continue;
@@ -272,7 +272,7 @@ var _MiddlewareManager = class _MiddlewareManager {
272
272
  const discovered = [];
273
273
  await this.discoverInDirectory(appDir, "/", "", discovered);
274
274
  for (const entry of discovered) {
275
- _chunk4GWRFP22cjs.compileMiddlewareRoute.call(void 0, entry.middleware);
275
+ _chunkUPJLHLJUcjs.compileMiddlewareRoute.call(void 0, entry.middleware);
276
276
  middlewareByDirectory.set(entry.location.directory, entry);
277
277
  }
278
278
  }
@@ -342,7 +342,7 @@ var _MiddlewareManager = class _MiddlewareManager {
342
342
  throw new Error("must export a default handler or a named middleware handler");
343
343
  }
344
344
  if (normalized.config) {
345
- _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, normalized.config);
345
+ _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, normalized.config);
346
346
  }
347
347
  return {
348
348
  path: routePath,
@@ -381,7 +381,7 @@ var _MiddlewareManager = class _MiddlewareManager {
381
381
  ...this.configMiddleware.map((mw) => ({ mw, routeMatch: { matched: true } })),
382
382
  ...this.middleware.map((mw) => ({
383
383
  mw,
384
- routeMatch: _chunk4GWRFP22cjs.matchesMiddlewareRouteAt.call(void 0, toMiddlewarePathnames(routePathname), mw)
384
+ routeMatch: _chunkUPJLHLJUcjs.matchesMiddlewareRouteAt.call(void 0, toMiddlewarePathnames(routePathname), mw)
385
385
  })).filter((entry) => entry.routeMatch.matched)
386
386
  ];
387
387
  if (applicable.length === 0) {
@@ -412,12 +412,12 @@ var _MiddlewareManager = class _MiddlewareManager {
412
412
  if (rewrittenPathname === passPathname) return;
413
413
  passPathname = rewrittenPathname;
414
414
  const passPathnames = toMiddlewarePathnames(passPathname);
415
- if (globalConfig && !_chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, passPathnames, globalConfig, ctx).matched) {
415
+ if (globalConfig && !_chunkUPJLHLJUcjs.matchesMiddlewareConfigAt.call(void 0, passPathnames, globalConfig, ctx).matched) {
416
416
  return;
417
417
  }
418
418
  pass = allMiddleware.filter((mw) => !ran.has(mw)).map((mw) => ({
419
419
  mw,
420
- routeMatch: mw.source === "config" ? { matched: true } : _chunk4GWRFP22cjs.matchesMiddlewareRouteAt.call(void 0, passPathnames, mw)
420
+ routeMatch: mw.source === "config" ? { matched: true } : _chunkUPJLHLJUcjs.matchesMiddlewareRouteAt.call(void 0, passPathnames, mw)
421
421
  })).filter((entry) => entry.routeMatch.matched);
422
422
  }
423
423
  }
@@ -528,7 +528,7 @@ var _MiddlewareManager = class _MiddlewareManager {
528
528
  * Check if pathname matches middleware config
529
529
  */
530
530
  matchesConfig(pathname, config, ctx) {
531
- return _chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, this.toMiddlewarePathnames(pathname), config, ctx);
531
+ return _chunkUPJLHLJUcjs.matchesMiddlewareConfigAt.call(void 0, this.toMiddlewarePathnames(pathname), config, ctx);
532
532
  }
533
533
  /**
534
534
  * Reload middleware (for HMR)
@@ -304,6 +304,13 @@ function appendOpenGraph(tags, input, metadataBase, page) {
304
304
  appendMetaProperty(tags, "og:image:alt", image.alt);
305
305
  appendMetaProperty(tags, "og:image:type", image.type);
306
306
  }
307
+ for (const video of normalizeMetadataVideos(openGraph.videos, metadataBase)) {
308
+ appendMetaProperty(tags, "og:video", video.url);
309
+ appendMetaProperty(tags, "og:video:secure_url", video.secureUrl);
310
+ appendMetaProperty(tags, "og:video:type", video.type);
311
+ appendMetaProperty(tags, "og:video:width", video.width);
312
+ appendMetaProperty(tags, "og:video:height", video.height);
313
+ }
307
314
  if (openGraph.type === "article") {
308
315
  appendMetaProperty(tags, "article:published_time", normalizeDate(openGraph.publishedTime));
309
316
  appendMetaProperty(tags, "article:modified_time", normalizeDate(openGraph.modifiedTime));
@@ -432,6 +439,24 @@ function normalizeMetadataImages(value, metadataBase) {
432
439
  }).filter((item) => item !== null);
433
440
  }
434
441
  _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMetadataImages, "normalizeMetadataImages");
442
+ function normalizeMetadataVideos(value, metadataBase) {
443
+ return normalizeArray(value).map((item) => {
444
+ if (typeof item === "string") {
445
+ return { url: resolveMetadataUrl(item, metadataBase) || item };
446
+ }
447
+ if (!isRecord(item)) return null;
448
+ const url = resolveMetadataUrl(item.url, metadataBase);
449
+ if (!url) return null;
450
+ return {
451
+ url,
452
+ secureUrl: resolveMetadataUrl(item.secureUrl, metadataBase) || void 0,
453
+ width: normalizeNumber(item.width),
454
+ height: normalizeNumber(item.height),
455
+ type: typeof item.type === "string" ? item.type : void 0
456
+ };
457
+ }).filter((item) => item !== null);
458
+ }
459
+ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMetadataVideos, "normalizeMetadataVideos");
435
460
  function normalizeArray(value) {
436
461
  if (value == null) return [];
437
462
  return Array.isArray(value) ? value : [value];
@@ -66,6 +66,37 @@ function parseColonParam(segment) {
66
66
  };
67
67
  }
68
68
  __name(parseColonParam, "parseColonParam");
69
+ var MATCHER_PARAM_NAME = /^[\p{L}\p{N}_$-]+$/u;
70
+ var MATCHER_REGEX_SYNTAX = /[()[\]|\\{}^$?]/;
71
+ var MATCHER_BRACKET_PARAM = /^\[\[\.\.\.(.+)\]\]$|^\[\.\.\.(.+)\]$|^\[(.+)\]$/;
72
+ function isSupportedMatcherSegment(segment) {
73
+ if (segment === "*" || segment === "**") return true;
74
+ if (segment.startsWith(":")) return MATCHER_PARAM_NAME.test(parseColonParam(segment).name);
75
+ const bracket = MATCHER_BRACKET_PARAM.exec(segment);
76
+ if (bracket) return MATCHER_PARAM_NAME.test(bracket[1] ?? bracket[2] ?? bracket[3]);
77
+ return !MATCHER_REGEX_SYNTAX.test(segment);
78
+ }
79
+ __name(isSupportedMatcherSegment, "isSupportedMatcherSegment");
80
+ function isLiteralMatcherSegment(segment) {
81
+ return !MATCHER_REGEX_SYNTAX.test(segment) && !segment.includes("*") && !segment.startsWith(":");
82
+ }
83
+ __name(isLiteralMatcherSegment, "isLiteralMatcherSegment");
84
+ function assertSupportedMiddlewareMatcher(pattern) {
85
+ if (pattern === "*" || pattern === "/(.*)") return;
86
+ const subtree = pattern.endsWith("(.*)");
87
+ const path = subtree ? pattern.slice(0, -4) : pattern;
88
+ const segments = path.split("/").filter(Boolean);
89
+ if (segments.every(subtree ? isLiteralMatcherSegment : isSupportedMatcherSegment)) return;
90
+ throw new Error(
91
+ `Middleware matcher "${pattern}" is not a supported string pattern, so it would never match a request and the middleware would not run. String matchers do not accept regular-expression syntax such as groups, alternation, character classes, or lookaheads. Pass a RegExp instead, for example \`matcher: /^\\/(?!api|_next).*/\`, or use the supported forms: /path/:param, /path/:param*, /path/[param], /path/[...param], /path/*, /path/**, or a trailing (.*) such as /path(.*).`
92
+ );
93
+ }
94
+ __name(assertSupportedMiddlewareMatcher, "assertSupportedMiddlewareMatcher");
95
+ function compileConfigPattern(pattern, compile) {
96
+ if (typeof pattern === "string") assertSupportedMiddlewareMatcher(pattern);
97
+ return compile(pattern);
98
+ }
99
+ __name(compileConfigPattern, "compileConfigPattern");
69
100
  function compilePathPattern(pattern, trailingSlash = false) {
70
101
  const params = [];
71
102
  const segments = pattern.split("/").filter(Boolean);
@@ -140,9 +171,9 @@ __name(compilePattern, "compilePattern");
140
171
  function compileMiddlewareConfig(config) {
141
172
  const compiled = {
142
173
  matcher: config.matcher ? toMatcherList(config.matcher).map(
143
- (matcher) => typeof matcher === "function" ? matcher : compileMatcherPattern(matcher)
174
+ (matcher) => typeof matcher === "function" ? matcher : compileConfigPattern(matcher, compileMatcherPattern)
144
175
  ) : void 0,
145
- exclude: config.exclude?.map(compilePattern)
176
+ exclude: config.exclude?.map((pattern) => compileConfigPattern(pattern, compilePattern))
146
177
  };
147
178
  compiledConfigCache.set(config, {
148
179
  compiled,
@@ -250,6 +281,7 @@ export {
250
281
  compileMiddlewareRoute,
251
282
  matchesMiddlewareRoute,
252
283
  matchesMiddlewareRouteAt,
284
+ assertSupportedMiddlewareMatcher,
253
285
  compileMiddlewareConfig,
254
286
  matchesMiddlewarePredicate,
255
287
  toMiddlewareRoutePathname,
@@ -11,7 +11,7 @@ import {
11
11
  matchesMiddlewareConfigAt,
12
12
  matchesMiddlewareRouteAt,
13
13
  toMiddlewareRoutePathname
14
- } from "./chunk-HZFM2LWQ.mjs";
14
+ } from "./chunk-P3PLW4FR.mjs";
15
15
  import {
16
16
  emitFarmEvent
17
17
  } from "./chunk-FUZEBRP3.mjs";