@farm.js/core 0.1.18 → 0.1.20
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-runtime.d.mts +2 -3
- package/dist/agent-runtime.d.ts +2 -3
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +2 -3
- package/dist/api/route-manager.d.ts +2 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +3 -4
- package/dist/api.d.ts +3 -4
- package/dist/api.mjs +5 -5
- package/dist/{app-BHY_10Lm.d.ts → app-DAyPE-gr.d.ts} +11 -4
- package/dist/{app-BMk0do23.d.mts → app-D_6nTit-.d.mts} +11 -4
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
- package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
- package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
- package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
- package/dist/chunk-43FMW62B.mjs +67 -0
- package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
- package/dist/{chunk-KPNVGRBL.mjs → chunk-5V37LKBG.mjs} +105 -41
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-ZCNJKLA2.mjs → chunk-7BC6GAL7.mjs} +1 -1
- package/dist/{chunk-J2OP5GG3.cjs → chunk-A777V5WU.cjs} +28 -28
- package/dist/{chunk-NWOD6NIT.cjs → chunk-A7T6JZNI.cjs} +1 -1
- package/dist/{chunk-E2BMSZ2W.cjs → chunk-AH7HOAQ3.cjs} +2 -2
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- package/dist/{chunk-TWGMSEHX.cjs → chunk-BBVSJVBZ.cjs} +88 -13
- package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
- package/dist/chunk-BMWDEBXO.cjs +67 -0
- package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
- package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
- package/dist/{chunk-AWRISO2H.cjs → chunk-E2ROOWQC.cjs} +30 -4
- package/dist/{chunk-3XG26Z3J.mjs → chunk-F7E2AZKQ.mjs} +1 -1
- package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-UN5GHC5V.cjs → chunk-GQFSCBKJ.cjs} +249 -185
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-DHDVMXYK.mjs → chunk-HALDNTIV.mjs} +30 -4
- package/dist/{chunk-5QOEPUYE.mjs → chunk-HSDL2AUR.mjs} +1 -1
- package/dist/{chunk-BSTRERPP.cjs → chunk-I5YBCWQ6.cjs} +2 -2
- package/dist/{chunk-TYQUSXUG.cjs → chunk-ISTFC3MZ.cjs} +4 -4
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-GYKJCFTS.mjs → chunk-K6MG3SEG.mjs} +124 -82
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-TNBAYAWO.mjs → chunk-L4DVIHOC.mjs} +1 -1
- package/dist/{chunk-XWAYMDLB.mjs → chunk-MVUREHPN.mjs} +1 -1
- package/dist/{chunk-6VQIKZZO.mjs → chunk-N255VYFP.mjs} +1 -1
- package/dist/{chunk-GNEO2XOF.cjs → chunk-NBAHDVOJ.cjs} +4 -4
- package/dist/{chunk-EN7WTEAY.mjs → chunk-NRS46D4L.mjs} +2 -2
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-SXHV42UQ.mjs → chunk-OFEY6KHO.mjs} +88 -13
- package/dist/{chunk-OIEOCXKG.cjs → chunk-OYDRPBBV.cjs} +2 -2
- package/dist/{chunk-76DG3LF3.mjs → chunk-PGQBL5DN.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-IKNRN4VS.cjs → chunk-PZX6I4JW.cjs} +462 -420
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-QGVJVSNX.mjs → chunk-RMIJFZU3.mjs} +28 -4
- package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
- package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
- package/dist/chunk-VVBO3QH7.mjs +46 -0
- package/dist/{chunk-UTBVHYS3.mjs → chunk-W7MZXRXM.mjs} +20 -5
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-WZMNW2IW.cjs → chunk-XFFQSD2F.cjs} +4 -4
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-NV3A5DXM.cjs → chunk-YP5JZ4LF.cjs} +42 -18
- package/dist/{chunk-B4CH33IG.cjs → chunk-ZE6ONQ5R.cjs} +39 -24
- package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
- package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
- package/dist/client-plugins.d.mts +2 -3
- package/dist/client-plugins.d.ts +2 -3
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -38
- package/dist/client.d.ts +9 -38
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +2 -3
- package/dist/config.d.ts +2 -3
- package/dist/{devtools-UFVTMQX5.mjs → devtools-MTB5SA2B.mjs} +5 -5
- package/dist/{devtools-OUIPHVV6.cjs → devtools-R6MDDAZK.cjs} +9 -9
- package/dist/docs.cjs +9 -8
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +8 -7
- package/dist/index.cjs +29 -28
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +28 -27
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +22 -21
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +21 -20
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.mjs +11 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +2 -3
- package/dist/internal/compression-runtime.d.ts +2 -3
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +5 -5
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
- package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +4 -11
- package/dist/middleware.d.ts +4 -11
- package/dist/middleware.mjs +3 -3
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +42 -3
- package/dist/navigation.d.ts +42 -3
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
- package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
- package/dist/plugin.cjs +23 -17
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +23 -17
- package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
- package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
- package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +4 -5
- package/dist/renderer-client.d.ts +4 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +3 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
- package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
- package/dist/request.d.mts +3 -4
- package/dist/request.d.ts +3 -4
- package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
- package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
- package/dist/router-B2m4fvve.d.ts +50 -0
- package/dist/router-xwEE112q.d.mts +50 -0
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +2 -3
- package/dist/routes.d.ts +2 -3
- package/dist/routes.mjs +2 -2
- package/dist/{schema-dev-notice-2IE2F2XI.mjs → schema-dev-notice-O67CPXJ6.mjs} +1 -1
- package/dist/{schema-dev-notice-MXSZMVDG.cjs → schema-dev-notice-Y7MQEFGN.cjs} +3 -3
- package/dist/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +33 -32
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +19 -18
- package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
- package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.mts +2 -3
- package/dist/testing.d.ts +2 -3
- package/dist/testing.mjs +5 -5
- package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
- package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
- package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
- package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -17
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +17 -16
- package/package.json +3 -3
- package/dist/chunk-7GNWGLWB.mjs +0 -14
- package/dist/chunk-VQDBNVOO.cjs +0 -14
- package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
- package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
- /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
- /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
|
@@ -7,6 +7,28 @@ import {
|
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-LPEX4YW6.mjs";
|
|
9
9
|
|
|
10
|
+
// src/schema-sql-identifiers.ts
|
|
11
|
+
var POSTGRES_IDENTIFIER_BYTES = 63;
|
|
12
|
+
function fitSqlIndexName(dialect, name) {
|
|
13
|
+
if (dialect !== "postgres") return name;
|
|
14
|
+
const encoder = new TextEncoder();
|
|
15
|
+
const bytes = encoder.encode(name);
|
|
16
|
+
if (bytes.length <= POSTGRES_IDENTIFIER_BYTES) return name;
|
|
17
|
+
let hash = 2166136261;
|
|
18
|
+
for (const byte of bytes) hash = Math.imul(hash ^ byte, 16777619);
|
|
19
|
+
const suffix = `_${(hash >>> 0).toString(16).padStart(8, "0")}`;
|
|
20
|
+
let prefix = "";
|
|
21
|
+
let length = 0;
|
|
22
|
+
for (const character of name) {
|
|
23
|
+
const size = encoder.encode(character).length;
|
|
24
|
+
if (length + size > POSTGRES_IDENTIFIER_BYTES - suffix.length) break;
|
|
25
|
+
prefix += character;
|
|
26
|
+
length += size;
|
|
27
|
+
}
|
|
28
|
+
return prefix + suffix;
|
|
29
|
+
}
|
|
30
|
+
__name(fitSqlIndexName, "fitSqlIndexName");
|
|
31
|
+
|
|
10
32
|
// src/schema-sql.ts
|
|
11
33
|
function describeSchemaReference(model, fieldKey) {
|
|
12
34
|
const field = model.model.fields[fieldKey];
|
|
@@ -155,14 +177,17 @@ function collectSchemaIndexes(model, dialect) {
|
|
|
155
177
|
continue;
|
|
156
178
|
}
|
|
157
179
|
definitions.push({
|
|
158
|
-
name: `${model.modelName}_${field.name}_idx
|
|
180
|
+
name: fitSqlIndexName(dialect, `${model.modelName}_${field.name}_idx`),
|
|
159
181
|
columns: [quoteSqlIdentifier(dialect, field.name)],
|
|
160
182
|
unique: false
|
|
161
183
|
});
|
|
162
184
|
}
|
|
163
185
|
for (const constraint of model.model.constraints || []) {
|
|
164
186
|
definitions.push({
|
|
165
|
-
name:
|
|
187
|
+
name: fitSqlIndexName(
|
|
188
|
+
dialect,
|
|
189
|
+
constraint.name || `${model.modelName}_${constraint.fields.map((fieldKey) => model.model.fields[fieldKey]?.name || fieldKey).join("_")}_${constraint.type}`
|
|
190
|
+
),
|
|
166
191
|
columns: constraint.fields.map(
|
|
167
192
|
(fieldKey) => quoteSqlIdentifier(dialect, model.model.fields[fieldKey]?.name || fieldKey)
|
|
168
193
|
),
|
|
@@ -473,11 +498,12 @@ async function planSchemaMigration(models, dialect, executor) {
|
|
|
473
498
|
continue;
|
|
474
499
|
}
|
|
475
500
|
const columns = index.columns.map((column) => quoteSqlIdentifier(dialect, column)).join(", ");
|
|
501
|
+
const name = fitSqlIndexName(dialect, index.name);
|
|
476
502
|
upgrades.push({
|
|
477
503
|
kind: "index",
|
|
478
504
|
table: model.modelName,
|
|
479
|
-
target:
|
|
480
|
-
sql: `CREATE INDEX${dialect === "mysql" ? "" : " IF NOT EXISTS"} ${quoteSqlIdentifier(dialect,
|
|
505
|
+
target: name,
|
|
506
|
+
sql: `CREATE INDEX${dialect === "mysql" ? "" : " IF NOT EXISTS"} ${quoteSqlIdentifier(dialect, name)} ON ${quoteTableName(dialect, model.modelName)} (${columns});`
|
|
481
507
|
});
|
|
482
508
|
}
|
|
483
509
|
const entry = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
|
|
3
|
+
var _chunkAH7HOAQ3cjs = require('./chunk-AH7HOAQ3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -11,7 +11,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
|
11
11
|
var _url = require('url');
|
|
12
12
|
async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
|
|
13
13
|
const source = await _promises.readFile.call(void 0, filePath, "utf8");
|
|
14
|
-
return
|
|
14
|
+
return _chunkAH7HOAQ3cjs.createFarmMarkdownRouteModule.call(void 0, {
|
|
15
15
|
source,
|
|
16
16
|
filePath,
|
|
17
17
|
components: options.components,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkBBVSJVBZcjs = require('./chunk-BBVSJVBZ.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
@@ -63,11 +63,11 @@ function collectFarmLlmsTxtPages(sources, options) {
|
|
|
63
63
|
for (const source of sources) {
|
|
64
64
|
const path = source.pattern;
|
|
65
65
|
if (path.includes("[") || pages.has(path)) continue;
|
|
66
|
-
if (include.length && !include.some((pattern) =>
|
|
66
|
+
if (include.length && !include.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
if (exclude.some((pattern) =>
|
|
70
|
-
const target =
|
|
69
|
+
if (exclude.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
70
|
+
const target = _chunkBBVSJVBZcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkBBVSJVBZcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
|
|
71
71
|
const description = readMetadataString(source.metadata, "description");
|
|
72
72
|
pages.set(path, {
|
|
73
73
|
path,
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
parseRouteSlotFile,
|
|
7
7
|
resolveRouteRenderingConfig,
|
|
8
8
|
resolveRouteRenderingConfigFromFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NRS46D4L.mjs";
|
|
10
10
|
import {
|
|
11
11
|
collectSchemaExtensions,
|
|
12
12
|
declareSchemaTables,
|
|
13
13
|
readSchemaTables
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HALDNTIV.mjs";
|
|
15
15
|
import {
|
|
16
16
|
resolveSchemaModels
|
|
17
17
|
} from "./chunk-ZMSZZXOR.mjs";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
getDefaultErrorStatusText,
|
|
25
25
|
renderFarmLocaleAlternateLinks,
|
|
26
26
|
resolveDefaultErrorStatus
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-PGQBL5DN.mjs";
|
|
28
28
|
import {
|
|
29
29
|
isFarmPreviewDeploymentEnvironment
|
|
30
30
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -48,6 +48,10 @@ import {
|
|
|
48
48
|
_setDefaultFarmThemeConfig,
|
|
49
49
|
getTheme
|
|
50
50
|
} from "./chunk-WBIH66JK.mjs";
|
|
51
|
+
import {
|
|
52
|
+
generateFarmDocsAdapterClientRuntime,
|
|
53
|
+
getFarmDocsAdapterConfigModule
|
|
54
|
+
} from "./chunk-VVBO3QH7.mjs";
|
|
51
55
|
import {
|
|
52
56
|
resolveFarmDocsFontAssets,
|
|
53
57
|
toFarmDocsPublicFontAssets
|
|
@@ -65,7 +69,7 @@ import {
|
|
|
65
69
|
} from "./chunk-JBSVKMC5.mjs";
|
|
66
70
|
import {
|
|
67
71
|
normalizeRouteRules
|
|
68
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-GHFS7RUB.mjs";
|
|
69
73
|
import {
|
|
70
74
|
getFarmAppDirectories,
|
|
71
75
|
getFarmLayerAliases,
|
|
@@ -99,7 +103,7 @@ import {
|
|
|
99
103
|
resolveFarmLlmsTxtConfig,
|
|
100
104
|
resolveFarmPerformanceConfig,
|
|
101
105
|
resolveFarmSecurityConfig
|
|
102
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-7BC6GAL7.mjs";
|
|
103
107
|
import {
|
|
104
108
|
getPublicFarmImageConfig,
|
|
105
109
|
resolveFarmImageConfig
|
|
@@ -117,12 +121,12 @@ import {
|
|
|
117
121
|
import {
|
|
118
122
|
createFarmMarkdownRouteModuleFromFile,
|
|
119
123
|
loadFarmMdxComponents
|
|
120
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-MVUREHPN.mjs";
|
|
121
125
|
import {
|
|
122
126
|
createFarmMarkdownSourceResponse,
|
|
123
127
|
isFarmMarkdownPageFile,
|
|
124
128
|
normalizeFarmMarkdownRoutePath
|
|
125
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-N255VYFP.mjs";
|
|
126
130
|
import {
|
|
127
131
|
resolveFarmMdxComponentsModulePath,
|
|
128
132
|
resolveMdxConfig
|
|
@@ -136,7 +140,7 @@ import {
|
|
|
136
140
|
getFarmMarkdownMirrorPath,
|
|
137
141
|
resolveMarkdownConfig,
|
|
138
142
|
resolveMarkdownMirrorTarget
|
|
139
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-OFEY6KHO.mjs";
|
|
140
144
|
import {
|
|
141
145
|
resolveWorkflowsConfig
|
|
142
146
|
} from "./chunk-EGJDUF4Q.mjs";
|
|
@@ -162,7 +166,7 @@ import {
|
|
|
162
166
|
} from "./chunk-JLCQGPXE.mjs";
|
|
163
167
|
import {
|
|
164
168
|
MiddlewareManager
|
|
165
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-TIKNUAU7.mjs";
|
|
166
170
|
import {
|
|
167
171
|
_clearCurrentMiddlewareContext,
|
|
168
172
|
_clearCurrentMiddlewareData,
|
|
@@ -177,11 +181,11 @@ import {
|
|
|
177
181
|
} from "./chunk-IOEH4VWN.mjs";
|
|
178
182
|
import {
|
|
179
183
|
APIRouteManager
|
|
180
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-CQHFU55R.mjs";
|
|
181
185
|
import {
|
|
182
186
|
findProgrammaticRouteFiles,
|
|
183
187
|
loadProgrammaticRouteManifests
|
|
184
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-YOYF2E4U.mjs";
|
|
185
189
|
import {
|
|
186
190
|
_runWithFarmI18nRequest,
|
|
187
191
|
_setDefaultFarmI18nRuntime,
|
|
@@ -208,7 +212,7 @@ import {
|
|
|
208
212
|
normalizeFarmRouteRuntimeConfig,
|
|
209
213
|
resolveFarmRouteRuleRuntimeConfig,
|
|
210
214
|
resolveFarmRouteRuntimeConfig
|
|
211
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-2J7W2WND.mjs";
|
|
212
216
|
import {
|
|
213
217
|
clearRequestContext,
|
|
214
218
|
copyRequestContext,
|
|
@@ -227,8 +231,10 @@ import {
|
|
|
227
231
|
createCliColors
|
|
228
232
|
} from "./chunk-I2BHUNBU.mjs";
|
|
229
233
|
import {
|
|
234
|
+
invalidateFailedFarmDevModules,
|
|
235
|
+
loadFarmDevModule,
|
|
230
236
|
toFileModuleUrl
|
|
231
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-43FMW62B.mjs";
|
|
232
238
|
import {
|
|
233
239
|
isFarmI18nCatalogFile,
|
|
234
240
|
resolveFarmI18nConfig,
|
|
@@ -258,7 +264,7 @@ import {
|
|
|
258
264
|
} from "./chunk-Z2RZJZIZ.mjs";
|
|
259
265
|
import {
|
|
260
266
|
FARM_VERSION
|
|
261
|
-
} from "./chunk-
|
|
267
|
+
} from "./chunk-F7E2AZKQ.mjs";
|
|
262
268
|
import {
|
|
263
269
|
resolveFarmTrailingSlashRedirect,
|
|
264
270
|
setFarmTrailingSlashPreference
|
|
@@ -277,7 +283,7 @@ import {
|
|
|
277
283
|
mergeMetadata,
|
|
278
284
|
renderMetadataHead,
|
|
279
285
|
resolveFarmNotFoundMetadata
|
|
280
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-2M435BUE.mjs";
|
|
281
287
|
import {
|
|
282
288
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
283
289
|
createFarmDeploymentCookie,
|
|
@@ -2388,7 +2394,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2388
2394
|
const mdxConfig = resolveMdxConfig(this.config.mdx);
|
|
2389
2395
|
const components = await loadFarmMdxComponents(mdxConfig, {
|
|
2390
2396
|
root: this.config.root,
|
|
2391
|
-
loadModule: this.viteServer ? (componentModulePath) => this.viteServer
|
|
2397
|
+
loadModule: this.viteServer ? (componentModulePath) => loadFarmDevModule(this.viteServer, componentModulePath) : void 0
|
|
2392
2398
|
});
|
|
2393
2399
|
return await createFarmMarkdownRouteModuleFromFile(modulePath, {
|
|
2394
2400
|
components,
|
|
@@ -2396,7 +2402,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2396
2402
|
});
|
|
2397
2403
|
}
|
|
2398
2404
|
if (this.viteServer) {
|
|
2399
|
-
const module = await this.viteServer
|
|
2405
|
+
const module = await loadFarmDevModule(this.viteServer, modulePath);
|
|
2400
2406
|
return module;
|
|
2401
2407
|
} else {
|
|
2402
2408
|
const module = await import(
|
|
@@ -2421,7 +2427,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2421
2427
|
return createLayoutModuleFromProgrammaticLayout(programmaticLayout);
|
|
2422
2428
|
}
|
|
2423
2429
|
if (this.viteServer) {
|
|
2424
|
-
const module = await this.viteServer
|
|
2430
|
+
const module = await loadFarmDevModule(this.viteServer, modulePath);
|
|
2425
2431
|
return module;
|
|
2426
2432
|
} else {
|
|
2427
2433
|
const module = await import(
|
|
@@ -2695,7 +2701,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2695
2701
|
async loadProgrammaticRoutesModule(filePath) {
|
|
2696
2702
|
if (this.viteServer) {
|
|
2697
2703
|
const viteRoot = this.viteServer.config?.root || this.config.root || process.cwd();
|
|
2698
|
-
return await this.viteServer
|
|
2704
|
+
return await loadFarmDevModule(this.viteServer, toViteModuleId(filePath, viteRoot));
|
|
2699
2705
|
}
|
|
2700
2706
|
return await import(
|
|
2701
2707
|
/* @vite-ignore */
|
|
@@ -3012,18 +3018,29 @@ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED) {
|
|
|
3012
3018
|
__name(collectDevStylesheetUrls, "collectDevStylesheetUrls");
|
|
3013
3019
|
|
|
3014
3020
|
// src/server/full-document.ts
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3021
|
+
var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
|
|
3022
|
+
var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>)/i;
|
|
3023
|
+
function peelDocumentPrefix(markup) {
|
|
3024
|
+
let inner = markup.replace(/^\s+/, "");
|
|
3025
|
+
let hoisted = "";
|
|
3018
3026
|
let match;
|
|
3019
|
-
while (match =
|
|
3020
|
-
|
|
3027
|
+
while (match = CONTENTS_WRAPPER.exec(inner) ?? HOISTED_HEAD_ELEMENT.exec(inner)) {
|
|
3028
|
+
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
3029
|
+
inner = inner.slice(match[0].length).replace(/^\s+/, "");
|
|
3021
3030
|
}
|
|
3022
|
-
return
|
|
3031
|
+
return { inner, hoisted };
|
|
3023
3032
|
}
|
|
3024
|
-
__name(
|
|
3033
|
+
__name(peelDocumentPrefix, "peelDocumentPrefix");
|
|
3034
|
+
function restoreHoistedHead(document, hoisted) {
|
|
3035
|
+
if (!hoisted) return document;
|
|
3036
|
+
if (/<head[\s>]/i.test(document)) {
|
|
3037
|
+
return document.replace(/<head\b[^>]*>/i, (open) => open + hoisted);
|
|
3038
|
+
}
|
|
3039
|
+
return document.replace(/<html\b[^>]*>/i, (open) => `${open}<head>${hoisted}</head>`);
|
|
3040
|
+
}
|
|
3041
|
+
__name(restoreHoistedHead, "restoreHoistedHead");
|
|
3025
3042
|
function extractFarmFullDocument(markup) {
|
|
3026
|
-
const inner =
|
|
3043
|
+
const { inner, hoisted } = peelDocumentPrefix(markup);
|
|
3027
3044
|
if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
|
|
3028
3045
|
const start = markup.search(/<!doctype|<html[\s>]/i);
|
|
3029
3046
|
const lower = markup.toLowerCase();
|
|
@@ -3041,14 +3058,15 @@ function extractFarmFullDocument(markup) {
|
|
|
3041
3058
|
if (streamedTail) {
|
|
3042
3059
|
document = document.replace(/<\/body>/i, () => `${streamedTail}</body>`);
|
|
3043
3060
|
}
|
|
3044
|
-
return document;
|
|
3061
|
+
return restoreHoistedHead(document, hoisted);
|
|
3045
3062
|
}
|
|
3046
3063
|
__name(extractFarmFullDocument, "extractFarmFullDocument");
|
|
3047
|
-
function
|
|
3048
|
-
const inner =
|
|
3049
|
-
|
|
3064
|
+
function classifyFarmDocumentPrefix(markup) {
|
|
3065
|
+
const { inner } = peelDocumentPrefix(markup);
|
|
3066
|
+
if (/^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner)) return "document";
|
|
3067
|
+
return inner === "" ? "pending" : "fragment";
|
|
3050
3068
|
}
|
|
3051
|
-
__name(
|
|
3069
|
+
__name(classifyFarmDocumentPrefix, "classifyFarmDocumentPrefix");
|
|
3052
3070
|
function ensureFarmDocumentHead(markup) {
|
|
3053
3071
|
if (/<head[\s>]/i.test(markup)) return markup;
|
|
3054
3072
|
return markup.replace(/<html([^>]*)>/i, (_match, attributes) => {
|
|
@@ -4601,6 +4619,7 @@ function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
|
|
|
4601
4619
|
}
|
|
4602
4620
|
__name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
|
|
4603
4621
|
var fullDocumentRoutes = /* @__PURE__ */ new Set();
|
|
4622
|
+
var documentLayouts = /* @__PURE__ */ new WeakMap();
|
|
4604
4623
|
function hasRequestHeader(req, name) {
|
|
4605
4624
|
const value = req.headers[name.toLowerCase()];
|
|
4606
4625
|
return Array.isArray(value) ? value.length > 0 : Boolean(value);
|
|
@@ -4791,7 +4810,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4791
4810
|
if (this.config.notFound?.component?.trim()) {
|
|
4792
4811
|
resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
|
|
4793
4812
|
}
|
|
4794
|
-
const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : this.viteServer ? await this.viteServer
|
|
4813
|
+
const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
|
|
4795
4814
|
resolveFarmRendererModule(
|
|
4796
4815
|
this.config.root || process.cwd(),
|
|
4797
4816
|
this.config.renderer.server
|
|
@@ -5903,7 +5922,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5903
5922
|
path9.resolve(this.config.root, provider.component.module),
|
|
5904
5923
|
this.config.root
|
|
5905
5924
|
) : provider.component.module;
|
|
5906
|
-
const providerModule = this.viteServer ? await this.viteServer
|
|
5925
|
+
const providerModule = this.viteServer ? await loadFarmDevModule(this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
5907
5926
|
provider.component.module.startsWith(".") ? pathToFileURL2(path9.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
5908
5927
|
);
|
|
5909
5928
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
@@ -6530,10 +6549,43 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6530
6549
|
clearMiddlewareData?.();
|
|
6531
6550
|
}
|
|
6532
6551
|
}
|
|
6552
|
+
/**
|
|
6553
|
+
* Whether the root layout returns its own `<html>` document, checked as the client's layout
|
|
6554
|
+
* boundary checks it: call a plain synchronous layout and look at what it returns. Knowing
|
|
6555
|
+
* this up front keeps a route's first request on the buffered path too; a layout this cannot
|
|
6556
|
+
* call (async, a class, or one using hooks) falls back to detection from the stream.
|
|
6557
|
+
*/
|
|
6558
|
+
async rootLayoutRendersDocument() {
|
|
6559
|
+
if (typeof this.routeManager.getLayouts !== "function") return false;
|
|
6560
|
+
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6561
|
+
if (!rootLayout) return false;
|
|
6562
|
+
try {
|
|
6563
|
+
const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
|
|
6564
|
+
if (typeof Layout !== "function" || Layout.prototype?.isReactComponent || Layout.constructor?.name === "AsyncFunction") {
|
|
6565
|
+
return false;
|
|
6566
|
+
}
|
|
6567
|
+
const cached = documentLayouts.get(Layout);
|
|
6568
|
+
if (cached !== void 0) return cached;
|
|
6569
|
+
let rendersDocument = false;
|
|
6570
|
+
try {
|
|
6571
|
+
const rendered = Layout({
|
|
6572
|
+
children: null,
|
|
6573
|
+
params: {}
|
|
6574
|
+
});
|
|
6575
|
+
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
6576
|
+
} catch {
|
|
6577
|
+
rendersDocument = false;
|
|
6578
|
+
}
|
|
6579
|
+
documentLayouts.set(Layout, rendersDocument);
|
|
6580
|
+
return rendersDocument;
|
|
6581
|
+
} catch {
|
|
6582
|
+
return false;
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6533
6585
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
6534
6586
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
6535
6587
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
6536
|
-
if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey)) {
|
|
6588
|
+
if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument()) {
|
|
6537
6589
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
6538
6590
|
}
|
|
6539
6591
|
return new Promise((resolve5, reject) => {
|
|
@@ -6709,14 +6761,18 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6709
6761
|
staticShellParts?.push(securedShell);
|
|
6710
6762
|
let firstChunk = true;
|
|
6711
6763
|
let checkedFullDocument = false;
|
|
6764
|
+
let documentPrefix = "";
|
|
6712
6765
|
const cspNonceRewriter = cspNonce ? createFarmCspNonceRewriter(cspNonce) : void 0;
|
|
6713
6766
|
const cspStreamDecoder = cspNonceRewriter ? new TextDecoder() : void 0;
|
|
6714
6767
|
const recordRenderedChunk = /* @__PURE__ */ __name((chunkText) => {
|
|
6715
6768
|
if (!chunkText) return;
|
|
6716
6769
|
if (!checkedFullDocument) {
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6770
|
+
documentPrefix += chunkText;
|
|
6771
|
+
const prefix = classifyFarmDocumentPrefix(documentPrefix);
|
|
6772
|
+
if (prefix !== "pending") {
|
|
6773
|
+
checkedFullDocument = true;
|
|
6774
|
+
documentPrefix = "";
|
|
6775
|
+
if (prefix === "document") fullDocumentRoutes.add(fullDocumentRouteKey);
|
|
6720
6776
|
}
|
|
6721
6777
|
}
|
|
6722
6778
|
htmlParts.push(chunkText);
|
|
@@ -9179,33 +9235,6 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
9179
9235
|
}
|
|
9180
9236
|
__name(mergeFarmProductionViteConfig, "mergeFarmProductionViteConfig");
|
|
9181
9237
|
|
|
9182
|
-
// src/docs/adapter-client.ts
|
|
9183
|
-
function generateFarmDocsAdapterClientRuntime(reactModule) {
|
|
9184
|
-
if (!reactModule) {
|
|
9185
|
-
return `
|
|
9186
|
-
async function hydrateFarmDocsAdapterRuntime() {
|
|
9187
|
-
return false;
|
|
9188
|
-
}
|
|
9189
|
-
`;
|
|
9190
|
-
}
|
|
9191
|
-
return `
|
|
9192
|
-
async function hydrateFarmDocsAdapterRuntime() {
|
|
9193
|
-
const runtime = window.__FARM_DOCS_ADAPTER__;
|
|
9194
|
-
if (!runtime) return false;
|
|
9195
|
-
const FarmDocsAdapterReact = await import(${JSON.stringify(reactModule)});
|
|
9196
|
-
if (typeof FarmDocsAdapterReact.hydrateFarmDocs !== "function") {
|
|
9197
|
-
throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
|
|
9198
|
-
}
|
|
9199
|
-
FarmDocsAdapterReact.hydrateFarmDocs({
|
|
9200
|
-
config: runtime.config || {},
|
|
9201
|
-
data: runtime.data,
|
|
9202
|
-
});
|
|
9203
|
-
return true;
|
|
9204
|
-
}
|
|
9205
|
-
`;
|
|
9206
|
-
}
|
|
9207
|
-
__name(generateFarmDocsAdapterClientRuntime, "generateFarmDocsAdapterClientRuntime");
|
|
9208
|
-
|
|
9209
9238
|
// src/theme/vite.ts
|
|
9210
9239
|
var FARM_DARK_VARIANT = '@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));';
|
|
9211
9240
|
function createFarmThemeCssPlugin(input, basePath = "/") {
|
|
@@ -9324,7 +9353,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
9324
9353
|
}
|
|
9325
9354
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
9326
9355
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
9327
|
-
return import("./devtools-
|
|
9356
|
+
return import("./devtools-MTB5SA2B.mjs");
|
|
9328
9357
|
}
|
|
9329
9358
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
9330
9359
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -9941,6 +9970,9 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
9941
9970
|
// directory the production client build emits.
|
|
9942
9971
|
...options.publicDir ? { publicDir: options.publicDir } : {},
|
|
9943
9972
|
define: getEnvDefines(options, configEnv),
|
|
9973
|
+
// Keep development module ownership explicit; the RSC plugin adds its
|
|
9974
|
+
// environment only when enabled. Production environment setup is unchanged.
|
|
9975
|
+
...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
|
|
9944
9976
|
resolve: {
|
|
9945
9977
|
alias: { ...layerAliases, ...sourceAlias }
|
|
9946
9978
|
},
|
|
@@ -10069,10 +10101,16 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10069
10101
|
const layerConfigFiles = new Set(
|
|
10070
10102
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
10071
10103
|
);
|
|
10072
|
-
const
|
|
10104
|
+
const routeModuleExtensions = /* @__PURE__ */ new Set([
|
|
10105
|
+
...resolveFarmComponentExtensions(farmConfig.renderer.componentExtensions),
|
|
10106
|
+
".md",
|
|
10107
|
+
".mdx"
|
|
10108
|
+
]);
|
|
10109
|
+
const isRouteModuleFile = /* @__PURE__ */ __name((file) => {
|
|
10073
10110
|
const normalized = file.replace(/\\/g, "/");
|
|
10074
|
-
|
|
10075
|
-
|
|
10111
|
+
const match = /\/(?:page|layout|loading|error)(\.[^./]+)$/.exec(normalized);
|
|
10112
|
+
return appDirSlugs.some((appDir) => normalized.startsWith(`${appDir}/`)) && !!match && routeModuleExtensions.has(match[1].toLowerCase());
|
|
10113
|
+
}, "isRouteModuleFile");
|
|
10076
10114
|
const isApiRouteFile = /* @__PURE__ */ __name((file) => {
|
|
10077
10115
|
const normalized = file.replace(/\\/g, "/");
|
|
10078
10116
|
return appDirSlugs.some((appDir) => normalized.startsWith(`${appDir}/api/`)) && /route\.(ts|tsx|js|jsx)$/.test(normalized);
|
|
@@ -10123,11 +10161,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10123
10161
|
}, "scheduleTypeArtifactGen");
|
|
10124
10162
|
["add", "change", "unlink"].forEach((ev) => {
|
|
10125
10163
|
server.watcher.on(ev, (file) => {
|
|
10164
|
+
if (ev === "add") {
|
|
10165
|
+
invalidateFailedFarmDevModules(server);
|
|
10166
|
+
}
|
|
10126
10167
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
10127
10168
|
const configChanged = isFarmConfigFile(file, farmConfig.root) || layerConfigFiles.has(normalizedFile);
|
|
10128
10169
|
const programmaticRouteChanged = isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file));
|
|
10129
10170
|
const typeArtifacts = configChanged ? ALL_TYPE_ARTIFACTS : {
|
|
10130
|
-
routes: ev !== "change" &&
|
|
10171
|
+
routes: ev !== "change" && isRouteModuleFile(file) || programmaticRouteChanged,
|
|
10131
10172
|
api: isApiRouteFile(file) || programmaticRouteChanged,
|
|
10132
10173
|
env: false,
|
|
10133
10174
|
images: false,
|
|
@@ -10201,14 +10242,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10201
10242
|
discoveredWorkflows = await discoverFarmWorkflows(
|
|
10202
10243
|
{ ...farmConfig, workflows: workflowConfig },
|
|
10203
10244
|
{
|
|
10204
|
-
loadModule: /* @__PURE__ */ __name(async (filePath) => server
|
|
10245
|
+
loadModule: /* @__PURE__ */ __name(async (filePath) => loadFarmDevModule(server, filePath), "loadModule")
|
|
10205
10246
|
}
|
|
10206
10247
|
);
|
|
10207
10248
|
if (discoveredWorkflows.length > 0) {
|
|
10208
10249
|
workflowHandler = createFarmWorkflowRequestHandler({
|
|
10209
10250
|
workflows: discoveredWorkflows,
|
|
10210
10251
|
config: workflowConfig,
|
|
10211
|
-
loadModule: /* @__PURE__ */ __name(async (workflow) => server
|
|
10252
|
+
loadModule: /* @__PURE__ */ __name(async (workflow) => loadFarmDevModule(server, workflow.filePath), "loadModule"),
|
|
10212
10253
|
server: farmConfig.server
|
|
10213
10254
|
});
|
|
10214
10255
|
logger.success(`\u2705 Discovered ${discoveredWorkflows.length} Farm workflow task(s)`);
|
|
@@ -10282,16 +10323,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10282
10323
|
farmConfig.srcDir
|
|
10283
10324
|
),
|
|
10284
10325
|
loadModule: /* @__PURE__ */ __name(async (specifier) => {
|
|
10285
|
-
const resolved = await server.pluginContainer.resolveId(specifier
|
|
10286
|
-
ssr: true
|
|
10287
|
-
});
|
|
10326
|
+
const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
|
|
10288
10327
|
if (specifier === farmConfig.docs.adapter?.server && resolved?.id) {
|
|
10289
10328
|
return import(
|
|
10290
10329
|
/* @vite-ignore */
|
|
10291
10330
|
pathToFileURL3(resolved.id).href
|
|
10292
10331
|
);
|
|
10293
10332
|
}
|
|
10294
|
-
return server
|
|
10333
|
+
return loadFarmDevModule(server, resolved?.id ?? specifier);
|
|
10295
10334
|
}, "loadModule")
|
|
10296
10335
|
}) : farmDocsDevRuntime.createFarmDocsHandler(farmConfig.docs, {
|
|
10297
10336
|
root: farmConfig.root,
|
|
@@ -10329,7 +10368,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10329
10368
|
}
|
|
10330
10369
|
const docsRenderer = resolveFarmRenderer((farmApp?.getConfig() ?? options).renderer);
|
|
10331
10370
|
const [rendererRuntime, layoutModules] = await Promise.all([
|
|
10332
|
-
isReactRenderer(docsRenderer) ? import("./renderer/react/server.mjs") : server
|
|
10371
|
+
isReactRenderer(docsRenderer) ? import("./renderer/react/server.mjs") : loadFarmDevModule(server, docsRenderer.server),
|
|
10333
10372
|
Promise.all(
|
|
10334
10373
|
layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
|
|
10335
10374
|
)
|
|
@@ -11573,7 +11612,8 @@ ${generatedDevIndicatorsClientRuntime}`,
|
|
|
11573
11612
|
resolvedConfig?.basePath ?? "/",
|
|
11574
11613
|
generateClientCachePersistenceCode(
|
|
11575
11614
|
resolveFarmClientCacheAdapterEntry(root, resolvedConfig?.cache)
|
|
11576
|
-
)
|
|
11615
|
+
),
|
|
11616
|
+
isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0
|
|
11577
11617
|
);
|
|
11578
11618
|
}
|
|
11579
11619
|
if (id === "/@farm/server") {
|
|
@@ -11739,7 +11779,7 @@ export const manifest = getManifest();
|
|
|
11739
11779
|
);
|
|
11740
11780
|
return;
|
|
11741
11781
|
}` : "";
|
|
11742
|
-
const hmrCode = !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
|
|
11782
|
+
const hmrCode = transformOptions?.ssr || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
|
|
11743
11783
|
if (import.meta.hot) {
|
|
11744
11784
|
import.meta.hot.accept((newModule) => {
|
|
11745
11785
|
${isolatedHmrUpdate}
|
|
@@ -12384,7 +12424,7 @@ function parseRouteModuleSchema2(schema, value, label, routePath) {
|
|
|
12384
12424
|
}
|
|
12385
12425
|
}
|
|
12386
12426
|
__name(parseRouteModuleSchema2, "parseRouteModuleSchema");
|
|
12387
|
-
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }) {
|
|
12427
|
+
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
12388
12428
|
const providerClientCode = generateFarmIntegrationProviderClientCode(
|
|
12389
12429
|
integrationProviders,
|
|
12390
12430
|
root,
|
|
@@ -12399,7 +12439,10 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
|
|
|
12399
12439
|
const rendererClientImports = isReactRenderer(renderer) ? `import React from 'react'
|
|
12400
12440
|
import { hydrateRoot, createRoot } from 'react-dom/client'` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
|
|
12401
12441
|
const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'` : "";
|
|
12402
|
-
const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
|
|
12442
|
+
const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
|
|
12443
|
+
docsAdapterReact,
|
|
12444
|
+
docsConfigModule
|
|
12445
|
+
);
|
|
12403
12446
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
12404
12447
|
ReactRuntime: React,
|
|
12405
12448
|
hydrateRoot,
|
|
@@ -14197,7 +14240,6 @@ export {
|
|
|
14197
14240
|
createFarmSourceAlias,
|
|
14198
14241
|
mergeFarmViteConfig,
|
|
14199
14242
|
mergeFarmProductionViteConfig,
|
|
14200
|
-
generateFarmDocsAdapterClientRuntime,
|
|
14201
14243
|
createFarmThemeCssPlugin,
|
|
14202
14244
|
farmI18nClientBridgePlugin,
|
|
14203
14245
|
farmServerOnlyEntriesPlugin,
|
|
@@ -55,6 +55,11 @@ function mergeMetadataTitle(base, next) {
|
|
|
55
55
|
return parentTemplate ? applyTitleTemplate(parentTemplate, next) : next;
|
|
56
56
|
}
|
|
57
57
|
if (!isRecord(next)) return next;
|
|
58
|
+
const absoluteTitle = normalizeContent(next.absolute);
|
|
59
|
+
if (absoluteTitle) {
|
|
60
|
+
const { absolute: _absolute, ...rest } = next;
|
|
61
|
+
return { ...rest, default: absoluteTitle };
|
|
62
|
+
}
|
|
58
63
|
const defaultTitle = _nullishCoalesce(normalizeContent(next.default), () => ( resolveMetadataTitle(base)));
|
|
59
64
|
return {
|
|
60
65
|
...next,
|
|
@@ -372,7 +377,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, hasMetadataImages, "hasMetadataImages");
|
|
|
372
377
|
function resolveMetadataTitle(title) {
|
|
373
378
|
if (typeof title === "string") return title;
|
|
374
379
|
if (isRecord(title)) {
|
|
375
|
-
return normalizeContent(title.default);
|
|
380
|
+
return _nullishCoalesce(normalizeContent(title.absolute), () => ( normalizeContent(title.default)));
|
|
376
381
|
}
|
|
377
382
|
return void 0;
|
|
378
383
|
}
|