@farm.js/core 0.2.3 → 0.2.4
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.
- package/dist/{agent-mcp.d-gI3ahrF6.d.mts → agent-mcp.d-CaJJsAVy.d.mts} +1 -1
- package/dist/{agent-mcp.d-DuZjglYX.d.ts → agent-mcp.d-klsG_XKS.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/{analyzer-7TNBOI3J.mjs → analyzer-CY7BS4GB.mjs} +2 -2
- package/dist/analyzer-KHCOL6JF.cjs +17 -0
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-bHK9EGPI.d.mts → app-manifest.d-BIdn8Whr.d.mts} +1 -1
- package/dist/{app-manifest.d-B3h89j6a.d.ts → app-manifest.d-DkIbmExG.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app.d-C3uyET_L.d.ts → app.d-DhZ61V9X.d.ts} +8 -5
- package/dist/{app.d-Cr7fXGvJ.d.mts → app.d-DnqxbvCI.d.mts} +8 -5
- package/dist/{chunk-JJUHUPRB.cjs → chunk-6UBGXEIH.cjs} +2 -2
- package/dist/{chunk-TAXZQNFZ.cjs → chunk-76ES7BCO.cjs} +64 -59
- package/dist/{chunk-HOBCEE5J.mjs → chunk-7FNKBP3J.mjs} +185 -28
- package/dist/{chunk-CIRC2LRP.mjs → chunk-7IM2MKRK.mjs} +1 -1
- package/dist/{chunk-YPPAYYSX.cjs → chunk-7Q6KUXH6.cjs} +54 -23
- package/dist/{chunk-WFL7CD5C.cjs → chunk-AMSX2U4D.cjs} +304 -7
- package/dist/{chunk-CTHQE7DO.mjs → chunk-AOSZIHL7.mjs} +1 -1
- package/dist/chunk-APVJJCMB.mjs +547 -0
- package/dist/{chunk-IPKL7L6B.mjs → chunk-BCIUG6EQ.mjs} +2 -2
- package/dist/{chunk-KJMRW3IP.mjs → chunk-BUIZTM3Q.mjs} +1 -1
- package/dist/{chunk-GWFNJLDN.cjs → chunk-BY5VQ57W.cjs} +6 -6
- package/dist/{chunk-VZRY3CL5.mjs → chunk-CQ5LVPBL.mjs} +1 -1
- package/dist/{chunk-2FKGY2ZS.mjs → chunk-CV7C75LN.mjs} +1 -1
- package/dist/{chunk-RS4QZOFK.mjs → chunk-D4DAL7KK.mjs} +34 -3
- package/dist/{chunk-XGBDRC5B.mjs → chunk-DR65XXXD.mjs} +1 -1
- package/dist/{chunk-C2J5LMH6.cjs → chunk-EZRB5N6S.cjs} +1 -1
- package/dist/{chunk-K7RXZ77U.cjs → chunk-JEJXSTYR.cjs} +2 -2
- package/dist/{chunk-6QWBZGGP.cjs → chunk-JRPCCBGL.cjs} +447 -289
- package/dist/{chunk-A4WDDASS.cjs → chunk-KHTDVXXR.cjs} +2 -2
- package/dist/{chunk-XLJ2REOI.cjs → chunk-LJZZDRD5.cjs} +138 -131
- package/dist/{chunk-SO4USIKL.cjs → chunk-PVR63WHW.cjs} +4 -4
- package/dist/{chunk-H7DAFRYR.cjs → chunk-T2VXOAC3.cjs} +4 -4
- package/dist/{chunk-IQQ3SWH6.mjs → chunk-UIBCPZFO.mjs} +16 -9
- package/dist/{chunk-ERY4VYUH.mjs → chunk-XEOIZ4QC.mjs} +1 -1
- package/dist/{chunk-F6JSVP5C.cjs → chunk-Y7FLPQSL.cjs} +3 -3
- package/dist/{chunk-6YOMQ4GX.mjs → chunk-YR7ZI57S.mjs} +14 -9
- package/dist/{client-component.d-BavTzqsn.d.ts → client-component.d-BHE9Ns8s.d.ts} +1 -1
- package/dist/{client-component.d-X3j9FOZ2.d.mts → client-component.d-uya-qDZu.d.mts} +1 -1
- package/dist/{client-plugins.d-DnnAopKG.d.mts → client-plugins.d-CqFAvu-W.d.mts} +38 -1
- package/dist/{client-plugins.d-CqTr5IrQ.d.ts → client-plugins.d-Dp89a9Gf.d.ts} +38 -1
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-VPFBH6I2.mjs → devtools-CRZCFRRL.mjs} +1 -1
- package/dist/{devtools-YTND2OWT.cjs → devtools-ZHYYPMZ3.cjs} +2 -2
- package/dist/docs.cjs +3 -3
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +2 -2
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{handler.d-BSlpYCDB.d.mts → handler.d-BgJGywnq.d.mts} +1 -1
- package/dist/{handler.d-DgX7gPO6.d.ts → handler.d-DHxaRQr7.d.ts} +1 -1
- package/dist/{headers.d-CmxW42R2.d.ts → headers.d-DVm2BMtR.d.ts} +1 -1
- package/dist/{headers.d-Cf8l5LMo.d.mts → headers.d-QrzpChrN.d.mts} +1 -1
- package/dist/index.cjs +13 -13
- package/dist/{index.d-BZZt7kxO.d.ts → index.d-B8lXhfTs.d.ts} +1 -1
- package/dist/{index.d-7xoJqKRZ.d.mts → index.d-Bpu1TV0-.d.mts} +1 -1
- package/dist/index.d.mts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.mjs +12 -12
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +14 -14
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +13 -13
- package/dist/internal/cli-runtime.cjs +3 -3
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +2 -2
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +4 -4
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-CD-xVBu7.d.ts → mount.d-Cw_75kb9.d.ts} +1 -1
- package/dist/{mount.d-Dd0xeRMl.d.mts → mount.d-CyfNKOHK.d.mts} +1 -1
- package/dist/{navigation-delegate.d-Bses_F-y.d.ts → navigation-delegate.d--imR0rY7.d.ts} +1 -1
- package/dist/{navigation-delegate.d-dBNg976E.d.mts → navigation-delegate.d-DVEtyGYw.d.mts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +9 -9
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +8 -8
- package/dist/{render-plan.d-vOdZHHLI.d.mts → render-plan.d-CTehM6y8.d.mts} +1 -1
- package/dist/{render-plan.d-DaIwnRK2.d.ts → render-plan.d-DpxLd_1i.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-CgXp3EEc.d.ts → request.d-BFXzOr32.d.ts} +1 -1
- package/dist/{request.d-B8U4pVFP.d.mts → request.d-BmQzlKtT.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-Di0AxFix.d.ts → route-rendering.d-bEil1VkF.d.ts} +1 -1
- package/dist/{route-rendering.d-BQvNYQqu.d.mts → route-rendering.d-geg68qd0.d.mts} +1 -1
- package/dist/{router.d-BJVGhSAJ.d.ts → router.d-4OCT2ak5.d.ts} +1 -1
- package/dist/{router.d-hNedVdoB.d.mts → router.d-CQjEcNih.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-2JSNRVIL.mjs → rsc-pipeline-JISGZS6G.mjs} +2 -2
- package/dist/{rsc-pipeline-WTKDMTE2.cjs → rsc-pipeline-R5W3PAAL.cjs} +3 -3
- package/dist/{runtime-I4GV4CDP.cjs → runtime-HSTND4FF.cjs} +4 -4
- package/dist/{runtime-RNSTQY27.mjs → runtime-I2SBIB2Q.mjs} +2 -2
- package/dist/{runtime.d-0R8nHCM6.d.ts → runtime.d-BKoa6J55.d.ts} +1 -1
- package/dist/{runtime.d-DpeuF_T-.d.mts → runtime.d-DjYo5E1n.d.mts} +1 -1
- package/dist/{schema-dependencies.d-_Wyey4Wv.d.mts → schema-dependencies.d-CGNgsyKS.d.mts} +1 -1
- package/dist/{schema-dependencies.d-tkUHREqz.d.ts → schema-dependencies.d-CRoN2Q9N.d.ts} +1 -1
- package/dist/{server-components-status.d-sN7ju-ie.d.mts → server-components-status.d-Crl3IonP.d.mts} +1 -1
- package/dist/{server-components-status.d-B2Z5WvO5.d.ts → server-components-status.d-CwfcQD6n.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +30 -30
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +10 -10
- package/dist/{spa-router.d-MjT6sGb9.d.ts → spa-router.d-Bv-r3AAK.d.ts} +2 -2
- package/dist/{spa-router.d-D3AtR2Bc.d.mts → spa-router.d-DhO_PJHP.d.mts} +2 -2
- package/dist/{ssg.d-C1SNuPz5.d.ts → ssg.d-CzFOAkqy.d.mts} +13 -2
- package/dist/{ssg.d-B32Cp_XW.d.mts → ssg.d-SfEQfMsA.d.ts} +13 -2
- package/dist/{store-core.d-BZ3YXs70.d.ts → store-core.d-Ch0N8dni.d.ts} +2 -2
- package/dist/{store-core.d-BbVdaoA0.d.mts → store-core.d-pKJCUdTR.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-Bjbm44fP.d.ts → utils.d-BaLODLrK.d.ts} +1 -1
- package/dist/{utils.d-CoLozp7-.d.mts → utils.d-TPjb_Q7w.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +9 -9
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +8 -8
- package/package.json +2 -2
- package/dist/analyzer-5RSMYPWD.cjs +0 -17
- package/dist/chunk-4WCEWA22.mjs +0 -251
- /package/dist/{chunk-MVNIAD6O.mjs → chunk-3QC2XTCN.mjs} +0 -0
- /package/dist/{chunk-2LGM5WIK.cjs → chunk-GDKJGL7D.cjs} +0 -0
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
collectFarmNativeServerFns,
|
|
34
34
|
findFarmNativeScreenFiles
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CQ5LVPBL.mjs";
|
|
36
36
|
import {
|
|
37
37
|
assertFarmDocsAdapterServesNoGuardedPages,
|
|
38
38
|
compileFarmDocsAdapterEdgeManifest,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
listFarmDocsAdapterPages,
|
|
42
42
|
listFarmDocsAdapterRoutes,
|
|
43
43
|
listFarmDocsPagePaths
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-BUIZTM3Q.mjs";
|
|
45
45
|
import {
|
|
46
46
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
47
47
|
createFarmDocsHandler,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
getDeployTargetForPreset,
|
|
72
72
|
hasCustomFarmRouteContext,
|
|
73
73
|
resolveDeployOutputPath
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-3QC2XTCN.mjs";
|
|
75
75
|
import {
|
|
76
76
|
resolveFarmInstrumentationFile
|
|
77
77
|
} from "./chunk-QRNYSISP.mjs";
|
|
@@ -117,7 +117,7 @@ import {
|
|
|
117
117
|
resolveFarmNotFoundComponentPath,
|
|
118
118
|
resolveFarmRouteRootStrategy,
|
|
119
119
|
toBakedMarkdownSourcePath
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-YR7ZI57S.mjs";
|
|
121
121
|
import {
|
|
122
122
|
TAILWIND_CSS_BROWSER_TARGET,
|
|
123
123
|
generateFarmClientPluginEntryCode,
|
|
@@ -133,11 +133,11 @@ import {
|
|
|
133
133
|
readRouteRenderingDirectiveFromFile,
|
|
134
134
|
resolveRouteRenderingConfig,
|
|
135
135
|
resolveRouteRenderingConfigFromFile
|
|
136
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-D4DAL7KK.mjs";
|
|
137
137
|
import {
|
|
138
138
|
FARM_PRERENDER_ENV,
|
|
139
139
|
_farmWebMCPReportsEnabled
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-7IM2MKRK.mjs";
|
|
141
141
|
import {
|
|
142
142
|
HOISTED_HEAD_ELEMENT,
|
|
143
143
|
appMiddlewareMayHandlePath,
|
|
@@ -165,7 +165,7 @@ import {
|
|
|
165
165
|
listFarmBuiltInRoutePaths,
|
|
166
166
|
resolveFarmApiCatalogInput,
|
|
167
167
|
resolveFarmAppManifestInput
|
|
168
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-BCIUG6EQ.mjs";
|
|
169
169
|
import {
|
|
170
170
|
FARM_DEFAULT_MCP_PATH,
|
|
171
171
|
createFarmDefaultMCPServer,
|
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
} from "./chunk-WABOJXAA.mjs";
|
|
174
174
|
import {
|
|
175
175
|
isFarmPreviewDeploymentEnvironment
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-AOSZIHL7.mjs";
|
|
177
177
|
import {
|
|
178
178
|
FARM_NATIVE_SERVER_FN_PLUGIN
|
|
179
179
|
} from "./chunk-L4RTTTVE.mjs";
|
|
@@ -194,7 +194,7 @@ import {
|
|
|
194
194
|
withFarmSourceSnapshot,
|
|
195
195
|
withFarmSourceSnapshotOf,
|
|
196
196
|
withPackageClientBoundaryCache
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-DR65XXXD.mjs";
|
|
198
198
|
import {
|
|
199
199
|
generateFarmDocsAdapterClientRuntime,
|
|
200
200
|
getFarmDocsAdapterConfigModule
|
|
@@ -320,7 +320,7 @@ import {
|
|
|
320
320
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
321
321
|
import {
|
|
322
322
|
FARM_VERSION
|
|
323
|
-
} from "./chunk-
|
|
323
|
+
} from "./chunk-CV7C75LN.mjs";
|
|
324
324
|
import {
|
|
325
325
|
FARM_VIDEO_PLAYER_PATH
|
|
326
326
|
} from "./chunk-23NBOP43.mjs";
|
|
@@ -1563,6 +1563,29 @@ function escapeRegExp3(value) {
|
|
|
1563
1563
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1564
1564
|
}
|
|
1565
1565
|
|
|
1566
|
+
// src/nitro/static-pages.ts
|
|
1567
|
+
var FARM_STATIC_PAGE_REFUSAL_TYPE = "application/x-farm-static-page-refusal";
|
|
1568
|
+
function resolveFarmStaticPagesMode(value) {
|
|
1569
|
+
if (value === void 0 || value === "off") return "off";
|
|
1570
|
+
if (value === "analyze" || value === "enabled") return value;
|
|
1571
|
+
throw new TypeError(
|
|
1572
|
+
`\`experimental.staticPages\` must be "off", "analyze" or "enabled", got ${JSON.stringify(
|
|
1573
|
+
value
|
|
1574
|
+
)}. Use "analyze" to see which pages would be written as files.`
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
function getFarmStaticPageRefusal(route) {
|
|
1578
|
+
if (route.error) {
|
|
1579
|
+
return route.error.status ? `its build-time render answered ${route.error.status}` : `its build-time render failed: ${route.error.message ?? "unknown error"}`;
|
|
1580
|
+
}
|
|
1581
|
+
const contentType = route.contentType?.toLowerCase() ?? "";
|
|
1582
|
+
if (contentType.includes(FARM_STATIC_PAGE_REFUSAL_TYPE)) {
|
|
1583
|
+
return route.contents || "its render read request state";
|
|
1584
|
+
}
|
|
1585
|
+
if (!contentType.includes("html")) return "it does not render HTML";
|
|
1586
|
+
return null;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1566
1589
|
// src/nitro/ssr-public-assets.ts
|
|
1567
1590
|
import path10 from "path";
|
|
1568
1591
|
var SERVER_FILE_URL_RE = /new\s+URL\(\s*(["'`])([^"'`\\]+)\1\s*,\s*import\.meta\.url\s*\)/g;
|
|
@@ -8445,6 +8468,7 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
8445
8468
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
8446
8469
|
const farmRendererDisabled = isFarmRendererDisabled(config.renderer);
|
|
8447
8470
|
const farmStaticNotFoundBuild = preset === "vercel" && config.experimental?.staticNotFound === true && !farmRendererDisabled;
|
|
8471
|
+
const farmStaticPagesBuild = resolveFarmStaticPagesMode(config.experimental?.staticPages) !== "off" && !farmRendererDisabled;
|
|
8448
8472
|
const searchPreserveRoutes = pageRoutes.flatMap(
|
|
8449
8473
|
(route) => route.searchPreserve ? [route.searchPreserve] : []
|
|
8450
8474
|
);
|
|
@@ -9336,7 +9360,12 @@ function createFarmStaticNotFoundRefusal(reason) {
|
|
|
9336
9360
|
status: 404,
|
|
9337
9361
|
headers: { "Content-Type": ${JSON.stringify(FARM_STATIC_NOT_FOUND_REFUSAL_TYPE)} },
|
|
9338
9362
|
});
|
|
9339
|
-
}` : ""}
|
|
9363
|
+
}` : ""}${farmStaticPagesBuild ? `
|
|
9364
|
+
|
|
9365
|
+
// experimental.staticPages: set while the build prerenders, never for a visitor. Read once: Nitro's
|
|
9366
|
+
// prerender worker sets the variable before it loads the server.
|
|
9367
|
+
const farmStaticPagesPrerendering =
|
|
9368
|
+
typeof process !== "undefined" && process.env?.${FARM_PRERENDER_ENV} === "1";` : ""}
|
|
9340
9369
|
${nativeMCP.registerSource}
|
|
9341
9370
|
// Config middleware from layers is appended in layer order ahead of the
|
|
9342
9371
|
// project's, the same merge development applies (mergeFarmLayerConfig).
|
|
@@ -11467,18 +11496,23 @@ function matchRouteSlots(pathname, interceptFrom) {
|
|
|
11467
11496
|
}
|
|
11468
11497
|
return matched;
|
|
11469
11498
|
}` : ""}
|
|
11499
|
+
const normalizedFrom =
|
|
11500
|
+
typeof interceptFrom === "string" && interceptFrom.startsWith("/")
|
|
11501
|
+
? new URL(interceptFrom, "http://farm.local").pathname
|
|
11502
|
+
: null;
|
|
11470
11503
|
for (const slot of routeSlots) {
|
|
11471
|
-
if (
|
|
11504
|
+
if (
|
|
11505
|
+
!${sharedSlotOwners.size > 0 ? "matchesSlotOwner(slot.ownerPattern)" : "matchesRoutePrefix(pathname, slot.ownerPattern)"} &&
|
|
11506
|
+
!(slot.interception && normalizedFrom && matchesRoutePrefix(normalizedFrom, slot.ownerPattern))
|
|
11507
|
+
) {
|
|
11508
|
+
continue;
|
|
11509
|
+
}
|
|
11472
11510
|
const key = slot.ownerPattern + ":" + slot.name;
|
|
11473
11511
|
const entries = groups.get(key) || [];
|
|
11474
11512
|
entries.push(slot);
|
|
11475
11513
|
groups.set(key, entries);
|
|
11476
11514
|
}
|
|
11477
11515
|
|
|
11478
|
-
const normalizedFrom =
|
|
11479
|
-
typeof interceptFrom === "string" && interceptFrom.startsWith("/")
|
|
11480
|
-
? new URL(interceptFrom, "http://farm.local").pathname
|
|
11481
|
-
: null;
|
|
11482
11516
|
const matches = [];
|
|
11483
11517
|
// Leave empty, fallback-only and ineligible requests unparsed.
|
|
11484
11518
|
let pathnameSegments;
|
|
@@ -13204,7 +13238,28 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
13204
13238
|
hasConfiguredRouteContext ||
|
|
13205
13239
|
middlewareData?.size ||
|
|
13206
13240
|
middlewareContext?.size
|
|
13207
|
-
)
|
|
13241
|
+
);${farmStaticPagesBuild ? `
|
|
13242
|
+
// experimental.staticPages: the build prerenders a page that sets no rendering mode (any
|
|
13243
|
+
// prerendered page without static config is one) and writes it only if this render read
|
|
13244
|
+
// nothing of the request. Otherwise it answers why, in a type only the build reads.
|
|
13245
|
+
if (farmStaticPagesPrerendering && !resolveRouteRenderingView(route).ssg) {
|
|
13246
|
+
const farmStaticPageRefusal = pageStatus >= 400
|
|
13247
|
+
? "it answered " + pageStatus
|
|
13248
|
+
: renderReadRequest
|
|
13249
|
+
? "the render read the request's headers or cookies"
|
|
13250
|
+
: renderReadCookies()
|
|
13251
|
+
? "the render read cookies through a helper, such as an auth or api client"
|
|
13252
|
+
: middlewareData?.size || middlewareContext?.size
|
|
13253
|
+
? "middleware passed it data"
|
|
13254
|
+
: hasConfiguredRouteContext
|
|
13255
|
+
? "the app defines a route context"
|
|
13256
|
+
: "";
|
|
13257
|
+
if (farmStaticPageRefusal) {
|
|
13258
|
+
return new Response(farmStaticPageRefusal, {
|
|
13259
|
+
headers: { "Content-Type": ${JSON.stringify(FARM_STATIC_PAGE_REFUSAL_TYPE)} },
|
|
13260
|
+
});
|
|
13261
|
+
}
|
|
13262
|
+
}` : ""}
|
|
13208
13263
|
if (farmRouteRuleCached && (renderedPage.stream || hasRequestScopedRender)) {
|
|
13209
13264
|
// The route rule's cache refuses a private page: say why it renders on every request.
|
|
13210
13265
|
emitFarmEvent({
|
|
@@ -14278,6 +14333,34 @@ function prerenderWouldChangePageUrl(pathname) {
|
|
|
14278
14333
|
return true;
|
|
14279
14334
|
}
|
|
14280
14335
|
}
|
|
14336
|
+
var comparePathnames = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
14337
|
+
function reportFarmStaticPages(mode, candidates, verdicts, bypasses) {
|
|
14338
|
+
const written = candidates.filter((pathname) => verdicts.get(pathname) === null);
|
|
14339
|
+
if (mode === "enabled") {
|
|
14340
|
+
if (written.length > 0) {
|
|
14341
|
+
logger.info(
|
|
14342
|
+
`\u{1F4C4} Prerendered ${written.length} page(s) that read no request state (experimental.staticPages)`
|
|
14343
|
+
);
|
|
14344
|
+
}
|
|
14345
|
+
return;
|
|
14346
|
+
}
|
|
14347
|
+
const kept = [
|
|
14348
|
+
...bypasses,
|
|
14349
|
+
...candidates.flatMap((pathname) => {
|
|
14350
|
+
const reason = verdicts.get(pathname);
|
|
14351
|
+
return reason ? [{ pathname, reason }] : [];
|
|
14352
|
+
})
|
|
14353
|
+
].sort((a, b) => comparePathnames(a.pathname, b.pathname));
|
|
14354
|
+
written.sort(comparePathnames);
|
|
14355
|
+
const lines = [
|
|
14356
|
+
`experimental.staticPages ("analyze") wrote no files. With "enabled":`,
|
|
14357
|
+
` ${written.length} page(s) would be written as files${written.length ? ":" : ""}`,
|
|
14358
|
+
...written.map((pathname) => ` ${pathname}`),
|
|
14359
|
+
` ${kept.length} page(s) would stay server-handled${kept.length ? ":" : ""}`,
|
|
14360
|
+
...kept.map(({ pathname, reason }) => ` ${pathname} (${reason})`)
|
|
14361
|
+
];
|
|
14362
|
+
logger.info(lines.join("\n"));
|
|
14363
|
+
}
|
|
14281
14364
|
function getPhysicalPrerenderBypassReason(options) {
|
|
14282
14365
|
const {
|
|
14283
14366
|
config,
|
|
@@ -14285,7 +14368,8 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
14285
14368
|
routeRuntimeManifest,
|
|
14286
14369
|
redirectSources,
|
|
14287
14370
|
rewriteSources,
|
|
14288
|
-
pathname
|
|
14371
|
+
pathname,
|
|
14372
|
+
renderingDecidedByBuild
|
|
14289
14373
|
} = options;
|
|
14290
14374
|
if (prerenderWouldChangePageUrl(pathname)) return "an escaped character in its URL";
|
|
14291
14375
|
if (config.i18n.enabled) return "request-sensitive i18n";
|
|
@@ -14300,7 +14384,9 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
14300
14384
|
if (hasCustomFarmRouteContext(config)) return "request context";
|
|
14301
14385
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
14302
14386
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
14303
|
-
if (manifestEntry?.rendering === "dynamic"
|
|
14387
|
+
if (manifestEntry?.rendering === "dynamic" && !renderingDecidedByBuild) {
|
|
14388
|
+
return "dynamic runtime manifest";
|
|
14389
|
+
}
|
|
14304
14390
|
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(manifestEntry.regions?.length) || manifestEntry.maxDuration !== void 0)) {
|
|
14305
14391
|
return "route runtime controls";
|
|
14306
14392
|
}
|
|
@@ -14592,14 +14678,17 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14592
14678
|
logger.info(`\u{1F4E6} Nitro output directory: ${outputDir}`);
|
|
14593
14679
|
logger.info(`\u{1F4E6} SSR entry file: ${ssrEntryFile}`);
|
|
14594
14680
|
logger.info(`\u{1F4E6} Preset: ${preset}`);
|
|
14595
|
-
const
|
|
14681
|
+
const staticPagesMode = isFarmRendererDisabled(config.renderer) ? "off" : resolveFarmStaticPagesMode(config.experimental?.staticPages);
|
|
14682
|
+
const ssgCollectionPromise = routeManager.collectSSGPages(
|
|
14683
|
+
staticPagesMode === "off" ? {} : { staticCandidates: true }
|
|
14684
|
+
);
|
|
14596
14685
|
const middlewareRoutesPromise = discoverMiddlewareRoutes(getFarmAppDirectories(config));
|
|
14597
14686
|
const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
|
|
14598
14687
|
const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
|
|
14599
14688
|
const farmWorkflows = await prepareFarmWorkflowsForNitro(config);
|
|
14600
14689
|
const farmCron = await prepareFarmCronForNitro(config);
|
|
14601
14690
|
const [
|
|
14602
|
-
{ ssg: ssgPages },
|
|
14691
|
+
{ ssg: ssgPages, staticCandidates: staticPageCandidates = [] },
|
|
14603
14692
|
middlewareRoutes,
|
|
14604
14693
|
[configuredRedirects, configuredRewrites],
|
|
14605
14694
|
docsPrerenderPages
|
|
@@ -14616,7 +14705,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14616
14705
|
const rewriteSources = configuredRewrites.map((route) => route.source);
|
|
14617
14706
|
const prerenderRoutes = [];
|
|
14618
14707
|
const skippedPrerenderRoutes = [];
|
|
14619
|
-
const middlewareRoutesWithConfig = ssgPages.length > 0 || docsPrerenderPages.length > 0 ? await Promise.all(
|
|
14708
|
+
const middlewareRoutesWithConfig = ssgPages.length > 0 || docsPrerenderPages.length > 0 || staticPageCandidates.length > 0 ? await Promise.all(
|
|
14620
14709
|
middlewareRoutes.map(async (route) => ({
|
|
14621
14710
|
...route,
|
|
14622
14711
|
config: await readMiddlewareFileConfig(route.filePath)
|
|
@@ -14671,6 +14760,31 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14671
14760
|
for (const skipped of skippedPrerenderRoutes) {
|
|
14672
14761
|
logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
|
|
14673
14762
|
}
|
|
14763
|
+
const staticPageCandidatePaths = [];
|
|
14764
|
+
const staticPageBypasses = [];
|
|
14765
|
+
for (const page of staticPageCandidates) {
|
|
14766
|
+
if (prerenderRoutes.includes(page.urlPath)) continue;
|
|
14767
|
+
const reason = getPhysicalPrerenderBypassReason({
|
|
14768
|
+
config,
|
|
14769
|
+
middlewareRoutes: middlewareRoutesWithConfig,
|
|
14770
|
+
routeRuntimeManifest,
|
|
14771
|
+
redirectSources,
|
|
14772
|
+
rewriteSources,
|
|
14773
|
+
pathname: page.urlPath,
|
|
14774
|
+
renderingDecidedByBuild: true
|
|
14775
|
+
});
|
|
14776
|
+
if (reason) {
|
|
14777
|
+
staticPageBypasses.push({ pathname: page.urlPath, reason });
|
|
14778
|
+
continue;
|
|
14779
|
+
}
|
|
14780
|
+
addPrerenderRoute(page.urlPath);
|
|
14781
|
+
staticPageCandidatePaths.push(page.urlPath);
|
|
14782
|
+
}
|
|
14783
|
+
if (staticPagesMode === "enabled") {
|
|
14784
|
+
for (const bypass of staticPageBypasses) {
|
|
14785
|
+
logger.info(`\u21AA Keeping ${bypass.pathname} server-handled (${bypass.reason})`);
|
|
14786
|
+
}
|
|
14787
|
+
}
|
|
14674
14788
|
const staticNotFoundPlan = await resolveFarmStaticNotFoundPlan({
|
|
14675
14789
|
config,
|
|
14676
14790
|
root,
|
|
@@ -15329,14 +15443,40 @@ function toFarmNodeResponse(request, response) {
|
|
|
15329
15443
|
});
|
|
15330
15444
|
const prerenderPagePaths = new Set(prerenderRoutes.map(toPrerenderPublicPath));
|
|
15331
15445
|
let skippedNonHtmlPrerenderRoute = false;
|
|
15332
|
-
|
|
15333
|
-
if (route.error || !prerenderPagePaths.has(route.route)) return;
|
|
15334
|
-
if (route.contentType?.toLowerCase().includes("html")) return;
|
|
15446
|
+
const keepPrerenderRouteServerHandled = (route) => {
|
|
15335
15447
|
route.skip = true;
|
|
15336
15448
|
skippedNonHtmlPrerenderRoute = true;
|
|
15337
15449
|
const configuredRule = configuredNitroRouteRules[route.route];
|
|
15338
15450
|
if (configuredRule) nitroInstance.options.routeRules[route.route] = configuredRule;
|
|
15339
15451
|
else delete nitroInstance.options.routeRules[route.route];
|
|
15452
|
+
};
|
|
15453
|
+
const staticPageCandidatePublicPaths = new Map(
|
|
15454
|
+
staticPageCandidatePaths.map((pathname) => [toPrerenderPublicPath(pathname), pathname])
|
|
15455
|
+
);
|
|
15456
|
+
const staticPageVerdicts = /* @__PURE__ */ new Map();
|
|
15457
|
+
if (staticPageCandidatePublicPaths.size > 0) {
|
|
15458
|
+
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
15459
|
+
const pathname = staticPageCandidatePublicPaths.get(route.route);
|
|
15460
|
+
if (pathname === void 0) return;
|
|
15461
|
+
const refusal = getFarmStaticPageRefusal(route);
|
|
15462
|
+
staticPageVerdicts.set(pathname, refusal);
|
|
15463
|
+
if (route.error) {
|
|
15464
|
+
route.error = void 0;
|
|
15465
|
+
if (staticPagesMode === "enabled") {
|
|
15466
|
+
logger.warn(
|
|
15467
|
+
`\u21AA Keeping ${pathname} server-handled: ${refusal}. Fix the page, or export \`dynamic = "force-dynamic"\` to render it on each request.`
|
|
15468
|
+
);
|
|
15469
|
+
}
|
|
15470
|
+
} else if (refusal && staticPagesMode === "enabled") {
|
|
15471
|
+
logger.info(`\u21AA Keeping ${pathname} server-handled (${refusal})`);
|
|
15472
|
+
}
|
|
15473
|
+
if (refusal || staticPagesMode === "analyze") keepPrerenderRouteServerHandled(route);
|
|
15474
|
+
});
|
|
15475
|
+
}
|
|
15476
|
+
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
15477
|
+
if (route.error || route.skip || !prerenderPagePaths.has(route.route)) return;
|
|
15478
|
+
if (route.contentType?.toLowerCase().includes("html")) return;
|
|
15479
|
+
keepPrerenderRouteServerHandled(route);
|
|
15340
15480
|
logger.info(`\u21AA Keeping SSG route ${route.route} server-handled (it does not render HTML)`);
|
|
15341
15481
|
});
|
|
15342
15482
|
nitroInstance.hooks.hook("prerender:done", () => {
|
|
@@ -15484,8 +15624,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
15484
15624
|
});
|
|
15485
15625
|
}
|
|
15486
15626
|
if (prerenderRoutes.length > 0 || staticNotFoundPrerenderPath) {
|
|
15487
|
-
|
|
15488
|
-
|
|
15627
|
+
const ssgPageCount = prerenderRoutes.length - staticPageCandidatePaths.length;
|
|
15628
|
+
if (ssgPageCount > 0) {
|
|
15629
|
+
logger.info(`\u{1F4C4} Pre-rendering ${ssgPageCount} SSG page(s)`);
|
|
15630
|
+
}
|
|
15631
|
+
if (staticPageCandidatePaths.length > 0) {
|
|
15632
|
+
logger.info(
|
|
15633
|
+
`\u{1F4C4} Rendering ${staticPageCandidatePaths.length} page(s) that set no rendering mode (experimental.staticPages: "${staticPagesMode}")`
|
|
15634
|
+
);
|
|
15489
15635
|
}
|
|
15490
15636
|
const previousPrerender = process.env[FARM_PRERENDER_ENV];
|
|
15491
15637
|
process.env[FARM_PRERENDER_ENV] = "1";
|
|
@@ -15496,6 +15642,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
15496
15642
|
else process.env[FARM_PRERENDER_ENV] = previousPrerender;
|
|
15497
15643
|
}
|
|
15498
15644
|
}
|
|
15645
|
+
if (staticPagesMode !== "off") {
|
|
15646
|
+
reportFarmStaticPages(
|
|
15647
|
+
staticPagesMode,
|
|
15648
|
+
staticPageCandidatePaths,
|
|
15649
|
+
staticPageVerdicts,
|
|
15650
|
+
staticPageBypasses
|
|
15651
|
+
);
|
|
15652
|
+
}
|
|
15499
15653
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
|
|
15500
15654
|
const prebuiltSSRFilesPromise = canReusePrebuiltSSR ? prepareSSRBundleFiles(
|
|
15501
15655
|
ssrBundle,
|
|
@@ -15614,7 +15768,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
15614
15768
|
middlewareRoutes: edgeMiddlewareRoutes,
|
|
15615
15769
|
guardedPages: edgeGuardedPrerenderRoutes
|
|
15616
15770
|
},
|
|
15617
|
-
|
|
15771
|
+
// A candidate page the build kept on the server has no file to redirect to or negotiate.
|
|
15772
|
+
prerenderRoutes.filter(
|
|
15773
|
+
(pathname) => !staticPageVerdicts.has(pathname) || staticPagesMode === "enabled" && staticPageVerdicts.get(pathname) === null
|
|
15774
|
+
).map(toPrerenderPublicPath),
|
|
15618
15775
|
staticNotFoundRoutes
|
|
15619
15776
|
);
|
|
15620
15777
|
}
|
|
@@ -99,7 +99,10 @@ function analyzeStaticRouteCandidate(mod, source, options = {}) {
|
|
|
99
99
|
if (options.isDynamic && !listsStaticPaths(mod)) {
|
|
100
100
|
blockers.push("the route has dynamic path segments");
|
|
101
101
|
}
|
|
102
|
-
if (hasExplicitRenderingConfig(
|
|
102
|
+
if (hasExplicitRenderingConfig(
|
|
103
|
+
options.dynamicAutoIsUnset && _optionalChain([mod, 'optionalAccess', _ => _.dynamic]) === "auto" ? { ...mod, dynamic: void 0 } : mod,
|
|
104
|
+
source
|
|
105
|
+
)) {
|
|
103
106
|
blockers.push("the route already has explicit rendering config");
|
|
104
107
|
}
|
|
105
108
|
if (source) {
|
|
@@ -135,7 +138,7 @@ function findRequestBoundSourceBlockers(source) {
|
|
|
135
138
|
blockers.add(`the route reads ${label}`);
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
|
-
const propsName = _optionalChain([params, 'access',
|
|
141
|
+
const propsName = _optionalChain([params, 'access', _2 => _2.match, 'call', _3 => _3(/^\s*([A-Za-z_$][\w$]*)\s*(?::|,|$)/), 'optionalAccess', _4 => _4[1]]);
|
|
139
142
|
if (propsName) {
|
|
140
143
|
for (const [name, label] of ROUTE_PROP_LABELS) {
|
|
141
144
|
if (new RegExp(`\\b${escapeRegExp(propsName)}\\s*\\.\\s*${name}\\b`).test(code)) {
|
|
@@ -154,15 +157,15 @@ function findRequestBoundSourceBlockers(source) {
|
|
|
154
157
|
function readRequestApiImportBindings(source) {
|
|
155
158
|
const bindings = [];
|
|
156
159
|
for (const clause of readStaticImportClauses(source)) {
|
|
157
|
-
const namedGroup = _optionalChain([clause, 'access',
|
|
160
|
+
const namedGroup = _optionalChain([clause, 'access', _5 => _5.match, 'call', _6 => _6(/\{([\s\S]*?)\}/), 'optionalAccess', _7 => _7[1]]);
|
|
158
161
|
for (const rawSpecifier of (_nullishCoalesce(namedGroup, () => ( ""))).split(",")) {
|
|
159
162
|
const specifier = rawSpecifier.trim().replace(/^type\s+/, "");
|
|
160
163
|
const imported = specifier.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);
|
|
161
|
-
if (!_optionalChain([imported, 'optionalAccess',
|
|
164
|
+
if (!_optionalChain([imported, 'optionalAccess', _8 => _8[1]])) continue;
|
|
162
165
|
const label = REQUEST_API_LABELS.get(imported[1]);
|
|
163
166
|
if (label) bindings.push({ local: _nullishCoalesce(imported[2], () => ( imported[1])), label });
|
|
164
167
|
}
|
|
165
|
-
const local = _optionalChain([clause, 'access',
|
|
168
|
+
const local = _optionalChain([clause, 'access', _9 => _9.match, 'call', _10 => _10(/^\s*([A-Za-z_$][\w$]*)\s*(?:,|$)/), 'optionalAccess', _11 => _11[1]]);
|
|
166
169
|
if (local) {
|
|
167
170
|
const label = REQUEST_API_LABELS.get(local);
|
|
168
171
|
if (label) bindings.push({ local, label });
|
|
@@ -171,24 +174,24 @@ function readRequestApiImportBindings(source) {
|
|
|
171
174
|
return bindings;
|
|
172
175
|
}
|
|
173
176
|
function readNamespaceImportBindings(source) {
|
|
174
|
-
return readStaticImportClauses(source).map((clause) => _optionalChain([clause, 'access',
|
|
177
|
+
return readStaticImportClauses(source).map((clause) => _optionalChain([clause, 'access', _12 => _12.match, 'call', _13 => _13(/\*\s*as\s*([A-Za-z_$][\w$]*)/), 'optionalAccess', _14 => _14[1]])).filter((binding) => Boolean(binding));
|
|
175
178
|
}
|
|
176
179
|
function readStaticImportClauses(source) {
|
|
177
180
|
return [...source.matchAll(/\bimport\s+(?!\()([\s\S]*?)\s+from\s*["'][^"']+["']/g)].map((match) => match[1]).filter((clause) => Boolean(clause));
|
|
178
181
|
}
|
|
179
182
|
function readDefaultRouteParameters(code) {
|
|
180
|
-
const inlineParams = _nullishCoalesce(_optionalChain([code, 'access',
|
|
183
|
+
const inlineParams = _nullishCoalesce(_optionalChain([code, 'access', _15 => _15.match, 'call', _16 => _16(/\bexport\s+default\s+(?:async\s+)?function\b[^(]*\(([^)]*)\)/), 'optionalAccess', _17 => _17[1]]), () => ( _optionalChain([code, 'access', _18 => _18.match, 'call', _19 => _19(/\bexport\s+default\s+(?:async\s+)?\(([^)]*)\)\s*=>/), 'optionalAccess', _20 => _20[1]])));
|
|
181
184
|
if (inlineParams !== void 0) return inlineParams;
|
|
182
|
-
const binding = _nullishCoalesce(_optionalChain([code, 'access',
|
|
185
|
+
const binding = _nullishCoalesce(_optionalChain([code, 'access', _21 => _21.match, 'call', _22 => _22(/\bexport\s+default\s+([A-Za-z_$][\w$]*)\s*;?/), 'optionalAccess', _23 => _23[1]]), () => ( _optionalChain([code, 'access', _24 => _24.match, 'call', _25 => _25(/\bexport\s*\{\s*([A-Za-z_$][\w$]*)\s+as\s+default\s*\}/), 'optionalAccess', _26 => _26[1]])));
|
|
183
186
|
if (!binding) return void 0;
|
|
184
187
|
const escapedBinding = escapeRegExp(binding);
|
|
185
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'access',
|
|
188
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'access', _27 => _27.match, 'call', _28 => _28(new RegExp(`\\bfunction\\s+${escapedBinding}\\s*\\(([^)]*)\\)`)), 'optionalAccess', _29 => _29[1]]), () => ( _optionalChain([code, 'access', _30 => _30.match, 'call', _31 => _31(
|
|
186
189
|
new RegExp(
|
|
187
190
|
`\\b(?:const|let|var)\\s+${escapedBinding}\\s*=\\s*(?:async\\s+)?\\(([^)]*)\\)\\s*=>`
|
|
188
191
|
)
|
|
189
|
-
), 'optionalAccess',
|
|
192
|
+
), 'optionalAccess', _32 => _32[1]]))), () => ( _optionalChain([code, 'access', _33 => _33.match, 'call', _34 => _34(
|
|
190
193
|
new RegExp(`\\b(?:const|let|var)\\s+${escapedBinding}\\s*=\\s*function\\s*\\(([^)]*)\\)`)
|
|
191
|
-
), 'optionalAccess',
|
|
194
|
+
), 'optionalAccess', _35 => _35[1]])));
|
|
192
195
|
}
|
|
193
196
|
function stripCommentsAndLiteralContents(source) {
|
|
194
197
|
return sanitizeSource(source, true);
|
|
@@ -290,10 +293,10 @@ function escapeRegExp(value) {
|
|
|
290
293
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
291
294
|
}
|
|
292
295
|
function listsStaticPaths(mod) {
|
|
293
|
-
return typeof _optionalChain([mod, 'optionalAccess',
|
|
296
|
+
return typeof _optionalChain([mod, 'optionalAccess', _36 => _36.getStaticPaths]) === "function" || typeof _optionalChain([mod, 'optionalAccess', _37 => _37.generateStaticParams]) === "function";
|
|
294
297
|
}
|
|
295
298
|
function hasExplicitRenderingConfig(mod, source) {
|
|
296
|
-
return typeof _optionalChain([mod, 'optionalAccess',
|
|
299
|
+
return typeof _optionalChain([mod, 'optionalAccess', _38 => _38.ssg]) === "boolean" || typeof _optionalChain([mod, 'optionalAccess', _39 => _39.ppr]) === "boolean" || typeof _optionalChain([mod, 'optionalAccess', _40 => _40.experimental_ppr]) === "boolean" || typeof _optionalChain([mod, 'optionalAccess', _41 => _41.revalidate]) !== "undefined" || typeof _optionalChain([mod, 'optionalAccess', _42 => _42.dynamic]) !== "undefined" || typeof parseRouteRenderingDirective(source) !== "undefined";
|
|
297
300
|
}
|
|
298
301
|
function parseRouteRenderingDirective(source) {
|
|
299
302
|
if (!source) {
|
|
@@ -322,7 +325,7 @@ function parseKnownRenderingDirective(directive) {
|
|
|
322
325
|
const match = normalized.match(
|
|
323
326
|
/^use\s+(ssg|static|isr|ssr|dynamic|ppr)(?:\s*[;:]\s*(\d+))?\s*;?$/
|
|
324
327
|
);
|
|
325
|
-
if (!_optionalChain([match, 'optionalAccess',
|
|
328
|
+
if (!_optionalChain([match, 'optionalAccess', _43 => _43[1]])) {
|
|
326
329
|
return void 0;
|
|
327
330
|
}
|
|
328
331
|
const mode = match[1];
|
|
@@ -421,6 +424,7 @@ function skipHorizontalWhitespace(source, start) {
|
|
|
421
424
|
async function collectSSGPages(routes, loadModule, options = {}) {
|
|
422
425
|
const ssgPages = [];
|
|
423
426
|
const ssrRoutes = [];
|
|
427
|
+
const staticCandidates = [];
|
|
424
428
|
const staticCandidateRoutes = [];
|
|
425
429
|
let staticCandidateDocsPages = 0;
|
|
426
430
|
for (const route of routes) {
|
|
@@ -431,7 +435,7 @@ async function collectSSGPages(routes, loadModule, options = {}) {
|
|
|
431
435
|
continue;
|
|
432
436
|
}
|
|
433
437
|
const source = await _promises.readFile.call(void 0, route.filePath, "utf8").catch(() => void 0);
|
|
434
|
-
if (_optionalChain([options, 'access',
|
|
438
|
+
if (_optionalChain([options, 'access', _44 => _44.docsAdapterRoutes, 'optionalAccess', _45 => _45.owns, 'call', _46 => _46(route.path)]) && _chunk27IPPPCVcjs.isFarmMarkdownPageFile.call(void 0, route.filePath)) {
|
|
435
439
|
ssrRoutes.push(route.path);
|
|
436
440
|
if (options.suggestStaticRendering !== false && analyzeStaticRouteCandidate(null, source, { isDynamic: route.isDynamic }).candidate) {
|
|
437
441
|
staticCandidateDocsPages += 1;
|
|
@@ -475,8 +479,13 @@ async function collectSSGPages(routes, loadModule, options = {}) {
|
|
|
475
479
|
}
|
|
476
480
|
} else {
|
|
477
481
|
ssrRoutes.push(route.path);
|
|
478
|
-
if (options.
|
|
479
|
-
|
|
482
|
+
if (options.staticCandidates && !_optionalChain([options, 'access', _47 => _47.docsAdapterRoutes, 'optionalAccess', _48 => _48.owns, 'call', _49 => _49(route.path)]) && analyzeStaticRouteCandidate(mod, source, {
|
|
483
|
+
isDynamic: route.isDynamic,
|
|
484
|
+
dynamicAutoIsUnset: true
|
|
485
|
+
}).candidate) {
|
|
486
|
+
staticCandidates.push(...await listStaticCandidatePages(route, mod));
|
|
487
|
+
} else if (options.suggestStaticRendering !== false && analyzeStaticRouteCandidate(mod, source, { isDynamic: route.isDynamic }).candidate) {
|
|
488
|
+
if (_optionalChain([options, 'access', _50 => _50.docsAdapterRoutes, 'optionalAccess', _51 => _51.owns, 'call', _52 => _52(route.path)])) staticCandidateDocsPages += 1;
|
|
480
489
|
else staticCandidateRoutes.push(route.path);
|
|
481
490
|
}
|
|
482
491
|
}
|
|
@@ -496,12 +505,34 @@ async function collectSSGPages(routes, loadModule, options = {}) {
|
|
|
496
505
|
Add \`export const dynamic = "force-static";\` after verifying that imported code does not read cookies, headers, authentication, or other request data.`
|
|
497
506
|
);
|
|
498
507
|
}
|
|
499
|
-
if (staticCandidateDocsPages > 0 && !_optionalChain([options, 'access',
|
|
508
|
+
if (staticCandidateDocsPages > 0 && !_optionalChain([options, 'access', _53 => _53.docsAdapterRoutes, 'optionalAccess', _54 => _54.prerender])) {
|
|
500
509
|
console.warn(
|
|
501
510
|
`[Farm.js] ${staticCandidateDocsPages} docs page${staticCandidateDocsPages === 1 ? " renders" : "s render"} on each request. Set \`docs.prerender: true\` in farm.config.ts to prerender docs pages on Node and serverless targets.`
|
|
502
511
|
);
|
|
503
512
|
}
|
|
504
|
-
return {
|
|
513
|
+
return {
|
|
514
|
+
ssg: ssgPages,
|
|
515
|
+
ssr: ssrRoutes,
|
|
516
|
+
...options.staticCandidates ? { staticCandidates } : {}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
async function listStaticCandidatePages(route, mod) {
|
|
520
|
+
if (!route.isDynamic) return [{ urlPath: route.path, filePath: route.filePath, params: {} }];
|
|
521
|
+
try {
|
|
522
|
+
const getStaticPaths = mod.getStaticPaths || mod.generateStaticParams;
|
|
523
|
+
const paths = getStaticPaths ? await getStaticPaths() : [];
|
|
524
|
+
const optionalCatchAllParams = _chunk66WIOZXXcjs.getOptionalCatchAllParameterNames.call(void 0, route.path);
|
|
525
|
+
return paths.map((params) => ({
|
|
526
|
+
urlPath: _chunk66WIOZXXcjs.materializeSSGRoutePath.call(void 0, route.path, params),
|
|
527
|
+
filePath: route.filePath,
|
|
528
|
+
params: _chunk66WIOZXXcjs.normalizeStaticPathParams.call(void 0, params, optionalCatchAllParams)
|
|
529
|
+
}));
|
|
530
|
+
} catch (error) {
|
|
531
|
+
console.warn(
|
|
532
|
+
`[Farm.js] experimental.staticPages: keeping "${route.path}" server-handled because listing its params failed: ${error instanceof Error ? error.message : String(error)}`
|
|
533
|
+
);
|
|
534
|
+
return [];
|
|
535
|
+
}
|
|
505
536
|
}
|
|
506
537
|
function isSSGModule(mod) {
|
|
507
538
|
return resolveRouteRenderingConfig(mod).ssg;
|
|
@@ -783,7 +814,7 @@ function fieldTsType(field) {
|
|
|
783
814
|
case "json":
|
|
784
815
|
return "unknown";
|
|
785
816
|
case "enum":
|
|
786
|
-
return _optionalChain([field, 'access',
|
|
817
|
+
return _optionalChain([field, 'access', _55 => _55.values, 'optionalAccess', _56 => _56.length]) ? field.values.map((value) => JSON.stringify(value)).join(" | ") : "string";
|
|
787
818
|
// id, uuid, string, text, datetime all travel as strings over JSON.
|
|
788
819
|
default:
|
|
789
820
|
return "string";
|
|
@@ -807,7 +838,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
807
838
|
const shouldGenerateApi = options.api !== false;
|
|
808
839
|
const shouldGenerateEnv = options.env !== false;
|
|
809
840
|
const shouldGenerateImages = options.images !== false;
|
|
810
|
-
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access',
|
|
841
|
+
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _57 => _57.i18nConfig, 'optionalAccess', _58 => _58.enabled]);
|
|
811
842
|
const sourceRoots = _chunkPFVNPOKNcjs.getFarmSourceRoots.call(void 0, { root, srcDir, layers: options.layers });
|
|
812
843
|
const appDirs = _chunkPFVNPOKNcjs.getFarmAppDirectories.call(void 0, { root, srcDir, layers: options.layers });
|
|
813
844
|
const result = {
|
|
@@ -854,7 +885,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
854
885
|
const apiRoutes = generator.scanAPIRoutes();
|
|
855
886
|
const apiTypesPath = options.apiTypesOutFile ? _path.resolve.call(void 0, root, options.apiTypesOutFile) : _path.join.call(void 0, root, srcDir, "lib", "api.generated.ts");
|
|
856
887
|
const pluginRoutes = _chunk4JCX33RZcjs.resolvePluginRoutes.call(void 0,
|
|
857
|
-
_optionalChain([options, 'access',
|
|
888
|
+
_optionalChain([options, 'access', _59 => _59.plugins, 'optionalAccess', _60 => _60.filter, 'call', _61 => _61((plugin) => plugin.name !== _chunk323JTLXRcjs.FARM_NATIVE_SERVER_FN_PLUGIN)])
|
|
858
889
|
);
|
|
859
890
|
const configFiles = [
|
|
860
891
|
...(_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.configFile).filter((file) => Boolean(file)),
|
|
@@ -931,7 +962,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
931
962
|
});
|
|
932
963
|
}
|
|
933
964
|
}
|
|
934
|
-
if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access',
|
|
965
|
+
if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _62 => _62.i18nConfig, 'optionalAccess', _63 => _63.enabled]) && !options.i18nTypesOutFile) {
|
|
935
966
|
const { signatures } = await _chunkYHALJBYTcjs.readFarmI18nCatalogs.call(void 0, options.i18nConfig);
|
|
936
967
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
937
968
|
result.i18nTypesPath = unifiedTypesPath;
|