@farm.js/core 0.1.19 → 0.1.21
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.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- 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-WZXN4R5Y.mjs → chunk-53G3OLTA.mjs} +106 -75
- package/dist/{chunk-FVZGEVTO.mjs → chunk-5L6NBNHI.mjs} +123 -41
- package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- 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-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-XDGMADQM.cjs → chunk-L7ARWZYT.cjs} +384 -353
- package/dist/{chunk-2ANEVVF7.mjs → chunk-NRS46D4L.mjs} +1 -1
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-2GNATDDE.mjs → chunk-PKO4FCTL.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-RFYO7QUD.cjs → chunk-Q2TUENW2.cjs} +1 -1
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-V4AICMQA.mjs → chunk-RMIJFZU3.mjs} +26 -2
- package/dist/{chunk-NSFC3LHB.cjs → chunk-RWXZKZXB.cjs} +255 -173
- 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-QBPKKQTD.mjs → chunk-W7MZXRXM.mjs} +19 -4
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-GPVTX3HT.cjs → chunk-XFFQSD2F.cjs} +2 -2
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-U5BMPGS3.cjs → chunk-YP5JZ4LF.cjs} +32 -8
- package/dist/{chunk-S27FMYAM.cjs → chunk-ZE6ONQ5R.cjs} +28 -13
- 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-FY5R7TQ4.mjs → devtools-MTB5SA2B.mjs} +3 -3
- package/dist/{devtools-5KGPDVKL.cjs → devtools-R6MDDAZK.cjs} +7 -7
- package/dist/docs.cjs +6 -5
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +5 -4
- package/dist/index.cjs +21 -20
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +20 -19
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/build-runtime.cjs +15 -14
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +14 -13
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- 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 +4 -4
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +2 -2
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.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 +17 -11
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +17 -11
- 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/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +25 -24
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +12 -11
- 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 +12 -11
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +11 -10
- 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
|
@@ -6,10 +6,10 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
6
6
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkB3WK4DTXcjs = require('./chunk-B3WK4DTX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -33,6 +33,9 @@ var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
|
33
33
|
var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
|
|
37
|
+
|
|
38
|
+
|
|
36
39
|
|
|
37
40
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
38
41
|
|
|
@@ -102,7 +105,7 @@ function farmApiPlugin(options = {}) {
|
|
|
102
105
|
const existing = apiRoutesCache.get(routePath);
|
|
103
106
|
const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
|
|
104
107
|
if (existingFile) {
|
|
105
|
-
throw new (0,
|
|
108
|
+
throw new (0, _chunkB3WK4DTXcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
|
|
106
109
|
}
|
|
107
110
|
if (existing) {
|
|
108
111
|
if (!existing.methods.includes(normalizedMethod)) {
|
|
@@ -249,7 +252,7 @@ function farmApiPlugin(options = {}) {
|
|
|
249
252
|
try {
|
|
250
253
|
const relativePath = path.relative(apiDir, path.dirname(filePath));
|
|
251
254
|
const routePath = "/api/" + (relativePath === "." ? "" : relativePath.replace(/\\/g, "/"));
|
|
252
|
-
const routeModule = await
|
|
255
|
+
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, filePath);
|
|
253
256
|
const endpoints = {};
|
|
254
257
|
const availableMethods = [];
|
|
255
258
|
for (const method of _chunk4PNUXIVUcjs.API_ROUTE_METHODS) {
|
|
@@ -265,7 +268,7 @@ function farmApiPlugin(options = {}) {
|
|
|
265
268
|
log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
|
|
266
269
|
}
|
|
267
270
|
} catch (e) {
|
|
268
|
-
if (e instanceof
|
|
271
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
269
272
|
log(`API route load failed at ${filePath}: ${e.message}`);
|
|
270
273
|
}
|
|
271
274
|
}
|
|
@@ -281,7 +284,7 @@ function farmApiPlugin(options = {}) {
|
|
|
281
284
|
for (const routesFile of routesFiles) {
|
|
282
285
|
if (fs.existsSync(routesFile)) {
|
|
283
286
|
try {
|
|
284
|
-
const routesModule = await
|
|
287
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, routesFile);
|
|
285
288
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
286
289
|
const endpoint = exportValue;
|
|
287
290
|
if (endpoint && endpoint.__path) {
|
|
@@ -292,7 +295,7 @@ function farmApiPlugin(options = {}) {
|
|
|
292
295
|
}
|
|
293
296
|
}
|
|
294
297
|
} catch (e) {
|
|
295
|
-
if (e instanceof
|
|
298
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
296
299
|
log(`Root routes.ts load failed: ${e.message}`);
|
|
297
300
|
}
|
|
298
301
|
break;
|
|
@@ -302,12 +305,13 @@ function farmApiPlugin(options = {}) {
|
|
|
302
305
|
const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
303
306
|
const path = await import("path");
|
|
304
307
|
const srcRoot = path.join(server.config.root, srcDir);
|
|
305
|
-
const routeFiles =
|
|
308
|
+
const routeFiles = _chunkN4RLRSWWcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
|
|
306
309
|
if (routeFiles.length === 0) return;
|
|
307
310
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
308
311
|
for (const routeFile of routeFiles) {
|
|
309
312
|
try {
|
|
310
|
-
const routesModule = await
|
|
313
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0,
|
|
314
|
+
server,
|
|
311
315
|
_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, routeFile, server.config.root)
|
|
312
316
|
);
|
|
313
317
|
const manifest = getProgrammaticRouteManifest(routesModule);
|
|
@@ -322,7 +326,7 @@ function farmApiPlugin(options = {}) {
|
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
328
|
} catch (e) {
|
|
325
|
-
if (e instanceof
|
|
329
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
326
330
|
log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
|
|
327
331
|
}
|
|
328
332
|
}
|
|
@@ -471,7 +475,7 @@ function farmApiPlugin(options = {}) {
|
|
|
471
475
|
if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _9 => _9()])) return [];
|
|
472
476
|
const previousState = snapshotRouteState();
|
|
473
477
|
try {
|
|
474
|
-
const routesModule = await
|
|
478
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
475
479
|
removeEndpointsFromFile(file);
|
|
476
480
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
477
481
|
const endpoint = exportValue;
|
|
@@ -499,7 +503,7 @@ function farmApiPlugin(options = {}) {
|
|
|
499
503
|
log(`API router recreated`);
|
|
500
504
|
} catch (e) {
|
|
501
505
|
restoreRouteState(previousState);
|
|
502
|
-
if (e instanceof
|
|
506
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
503
507
|
log(`Root routes.ts HMR failed: ${e.message}`);
|
|
504
508
|
}
|
|
505
509
|
return [];
|
|
@@ -524,7 +528,7 @@ function farmApiPlugin(options = {}) {
|
|
|
524
528
|
log(`API route file removed: ${routePath}`);
|
|
525
529
|
return [];
|
|
526
530
|
}
|
|
527
|
-
const routeModule = await
|
|
531
|
+
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
528
532
|
removeEndpointsFromFile(file);
|
|
529
533
|
const availableMethods = [];
|
|
530
534
|
for (const method of _chunk4PNUXIVUcjs.API_ROUTE_METHODS) {
|
|
@@ -537,7 +541,7 @@ function farmApiPlugin(options = {}) {
|
|
|
537
541
|
log(`API router recreated`);
|
|
538
542
|
} catch (e) {
|
|
539
543
|
restoreRouteState(previousState);
|
|
540
|
-
if (e instanceof
|
|
544
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
541
545
|
log(`API route HMR failed: ${e.message}`);
|
|
542
546
|
}
|
|
543
547
|
return [];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/dev-module.ts
|
|
6
|
+
var failedModules = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
var _FarmDevEnvironmentError = class _FarmDevEnvironmentError extends Error {
|
|
8
|
+
};
|
|
9
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, _FarmDevEnvironmentError, "FarmDevEnvironmentError");
|
|
10
|
+
var FarmDevEnvironmentError = _FarmDevEnvironmentError;
|
|
11
|
+
async function loadFarmDevModule(server, id, environmentName = "ssr") {
|
|
12
|
+
const environment = server.environments[environmentName];
|
|
13
|
+
const runner = _optionalChain([environment, 'optionalAccess', _ => _.runner]);
|
|
14
|
+
if (!environment || !runner || typeof runner.import !== "function") {
|
|
15
|
+
throw new FarmDevEnvironmentError(
|
|
16
|
+
`[Farm.js] Cannot load ${JSON.stringify(id)}: the "${environmentName}" development environment must provide a module runner. Remote runtimes require a request/response adapter.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return await runner.import(id);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
const failures = _nullishCoalesce(failedModules.get(environment), () => ( /* @__PURE__ */ new Map()));
|
|
23
|
+
failedModules.set(environment, failures);
|
|
24
|
+
await Promise.all(
|
|
25
|
+
[..._nullishCoalesce(_optionalChain([runner, 'access', _2 => _2.evaluatedModules, 'optionalAccess', _3 => _3.idToModuleMap, 'access', _4 => _4.values, 'call', _5 => _5()]), () => ( []))].filter((module) => module.evaluated && module.promise).map(async (module) => {
|
|
26
|
+
try {
|
|
27
|
+
await module.promise;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
failures.set(module.id, module.promise);
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevModule, "loadFarmDevModule");
|
|
37
|
+
function invalidateFailedFarmDevModules(server) {
|
|
38
|
+
for (const entry of Object.values(server.environments)) {
|
|
39
|
+
const environment = entry;
|
|
40
|
+
const failures = failedModules.get(environment);
|
|
41
|
+
if (!_optionalChain([failures, 'optionalAccess', _6 => _6.size])) continue;
|
|
42
|
+
const runner = environment.runner;
|
|
43
|
+
for (const [id, failed] of failures) {
|
|
44
|
+
const evaluated = runner.evaluatedModules.getModuleById(id);
|
|
45
|
+
if (_optionalChain([evaluated, 'optionalAccess', _7 => _7.promise]) !== failed) continue;
|
|
46
|
+
const transformed = environment.moduleGraph.getModuleById(id);
|
|
47
|
+
if (transformed) environment.moduleGraph.invalidateModule(transformed);
|
|
48
|
+
if (evaluated) runner.evaluatedModules.invalidateModule(evaluated);
|
|
49
|
+
}
|
|
50
|
+
failures.clear();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, invalidateFailedFarmDevModules, "invalidateFailedFarmDevModules");
|
|
54
|
+
|
|
55
|
+
// src/utils/file-module.ts
|
|
56
|
+
var _url = require('url');
|
|
57
|
+
function toFileModuleUrl(filePath) {
|
|
58
|
+
return _url.pathToFileURL.call(void 0, filePath).href;
|
|
59
|
+
}
|
|
60
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, toFileModuleUrl, "toFileModuleUrl");
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
exports.FarmDevEnvironmentError = FarmDevEnvironmentError; exports.loadFarmDevModule = loadFarmDevModule; exports.invalidateFailedFarmDevModules = invalidateFailedFarmDevModules; exports.toFileModuleUrl = toFileModuleUrl;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findProgrammaticRouteFilesInDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YOYF2E4U.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isFarmAPIRouteFileName
|
|
6
6
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -24,10 +24,11 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
getFarmRouteRuntimeConfig,
|
|
26
26
|
normalizeFarmRouteRuntimeConfig
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2J7W2WND.mjs";
|
|
28
28
|
import {
|
|
29
|
+
loadFarmDevModule,
|
|
29
30
|
toFileModuleUrl
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-43FMW62B.mjs";
|
|
31
32
|
import {
|
|
32
33
|
logger
|
|
33
34
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -251,7 +252,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
251
252
|
}
|
|
252
253
|
async loadModule(filePath) {
|
|
253
254
|
if (this.viteServer) {
|
|
254
|
-
return await this.viteServer
|
|
255
|
+
return await loadFarmDevModule(this.viteServer, filePath);
|
|
255
256
|
}
|
|
256
257
|
return await import(
|
|
257
258
|
/* @vite-ignore */
|
|
@@ -7,7 +7,7 @@ var _chunk6QQDAAAZcjs = require('./chunk-6QQDAAAZ.cjs');
|
|
|
7
7
|
var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -278,7 +278,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, parseProgrammaticRoutePath2, "parseProgram
|
|
|
278
278
|
function createRouteModuleFromProgrammaticPage(route, rendererRuntime) {
|
|
279
279
|
const mod = {
|
|
280
280
|
default: createProgrammaticPageComponent(route, rendererRuntime),
|
|
281
|
-
...
|
|
281
|
+
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, route, `Route "${route.path}"`)
|
|
282
282
|
};
|
|
283
283
|
if (route.params || route.search || route.guard || route.data) {
|
|
284
284
|
mod.__farmRouteSchemas = {
|
|
@@ -327,7 +327,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createRouteModuleFromProgrammaticPage, "cr
|
|
|
327
327
|
function createLayoutModuleFromProgrammaticLayout(route) {
|
|
328
328
|
return {
|
|
329
329
|
default: route.component,
|
|
330
|
-
...
|
|
330
|
+
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, route, `Layout "${route.path}"`),
|
|
331
331
|
metadata: route.metadata,
|
|
332
332
|
generateMetadata: route.generateMetadata
|
|
333
333
|
};
|
|
@@ -611,7 +611,7 @@ function normalizeProgrammaticRoute(route) {
|
|
|
611
611
|
if (route.kind === "api") {
|
|
612
612
|
return {
|
|
613
613
|
...route,
|
|
614
|
-
...
|
|
614
|
+
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, route, `API route "${route.path}"`),
|
|
615
615
|
path: normalizeRoutePath(route.path),
|
|
616
616
|
methods: normalizeApiMethods(route.methods)
|
|
617
617
|
};
|
|
@@ -620,7 +620,7 @@ function normalizeProgrammaticRoute(route) {
|
|
|
620
620
|
return {
|
|
621
621
|
...route,
|
|
622
622
|
...routeActions,
|
|
623
|
-
...
|
|
623
|
+
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
624
624
|
route,
|
|
625
625
|
`${route.kind === "layout" ? "Layout" : "Route"} "${route.path}"`
|
|
626
626
|
),
|
|
@@ -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
|
}
|