@farm.js/core 0.1.0-beta.13 → 0.1.0-beta.16
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/api/route-manager.cjs.map +1 -1
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.cjs.map +1 -1
- package/dist/api/runtime.mjs +1 -1
- package/dist/api.cjs +18 -10
- package/dist/api.cjs.map +1 -1
- package/dist/api.mjs +3 -3
- package/dist/{chunk-B232I2GP.mjs → chunk-3HIVDX7J.mjs} +12 -1
- package/dist/chunk-3HIVDX7J.mjs.map +1 -0
- package/dist/{chunk-JDEOUK5V.mjs → chunk-6YXKHAFU.mjs} +3 -3
- package/dist/{chunk-VSDZEB5M.mjs → chunk-AN3PQVKH.mjs} +14 -16
- package/dist/{chunk-VSDZEB5M.mjs.map → chunk-AN3PQVKH.mjs.map} +1 -1
- package/dist/{chunk-Z5CQMP54.mjs → chunk-ARRYKOI5.mjs} +2 -2
- package/dist/{chunk-KLA67WKG.mjs → chunk-B3FFOIWS.mjs} +2 -2
- package/dist/{chunk-3WIRO3N7.mjs → chunk-BWJC5ZOD.mjs} +2 -2
- package/dist/{chunk-3WIRO3N7.mjs.map → chunk-BWJC5ZOD.mjs.map} +1 -1
- package/dist/{chunk-PFE6GMNE.mjs → chunk-HMRFYJK6.mjs} +19 -11
- package/dist/chunk-HMRFYJK6.mjs.map +1 -0
- package/dist/{chunk-32W4QEJP.mjs → chunk-KFTGPFRD.mjs} +1 -1
- package/dist/chunk-KFTGPFRD.mjs.map +1 -0
- package/dist/{chunk-Z3YG4OZT.mjs → chunk-OSWV5IJB.mjs} +140 -41
- package/dist/chunk-OSWV5IJB.mjs.map +1 -0
- package/dist/{chunk-OPHK6OJN.mjs → chunk-SLDBGSC3.mjs} +2 -2
- package/dist/{chunk-L2PE36GQ.mjs → chunk-T2KL7VEL.mjs} +3 -3
- package/dist/{chunk-WDU6QXNK.mjs → chunk-UCYWGN2P.mjs} +1 -1
- package/dist/chunk-UCYWGN2P.mjs.map +1 -0
- package/dist/{chunk-65A7QIKI.mjs → chunk-UMVLB3PN.mjs} +3 -3
- package/dist/chunk-UMVLB3PN.mjs.map +1 -0
- package/dist/{chunk-VY2UYN5R.mjs → chunk-VPCFICID.mjs} +82 -3
- package/dist/chunk-VPCFICID.mjs.map +1 -0
- package/dist/{chunk-H3TE3LOV.mjs → chunk-XMFTIVJH.mjs} +2 -2
- package/dist/{chunk-UB5UOSHB.mjs → chunk-ZVMV3THA.mjs} +71 -2
- package/dist/chunk-ZVMV3THA.mjs.map +1 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +3 -3
- package/dist/deployment.cjs +12 -0
- package/dist/deployment.cjs.map +1 -1
- package/dist/deployment.mjs +3 -1
- package/dist/{devtools-GAZ7F3KL.mjs → devtools-E4YNCY5J.mjs} +4 -4
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.mjs +4 -4
- package/dist/index.cjs +332 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +28 -16
- package/dist/index.mjs.map +1 -1
- package/dist/internal/build-runtime.cjs +159 -46
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.mjs +11 -11
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.mjs +3 -3
- package/dist/plugin.cjs +141 -34
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +8 -8
- package/dist/server-action-security.cjs +23 -1
- package/dist/server-action-security.cjs.map +1 -1
- package/dist/server-action-security.mjs +1 -1
- package/dist/server-fn-client.cjs.map +1 -1
- package/dist/server-fn-client.mjs +1 -1
- package/dist/server-fn.cjs +140 -3
- package/dist/server-fn.cjs.map +1 -1
- package/dist/server-fn.mjs +14 -3
- package/dist/server-query.cjs +99 -1
- package/dist/server-query.cjs.map +1 -1
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +260 -37
- package/dist/server.cjs.map +1 -1
- package/dist/server.mjs +11 -11
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +142 -35
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +8 -8
- package/package.json +1 -1
- package/types/client.d.ts +115 -4
- package/dist/chunk-32W4QEJP.mjs.map +0 -1
- package/dist/chunk-65A7QIKI.mjs.map +0 -1
- package/dist/chunk-B232I2GP.mjs.map +0 -1
- package/dist/chunk-PFE6GMNE.mjs.map +0 -1
- package/dist/chunk-UB5UOSHB.mjs.map +0 -1
- package/dist/chunk-VY2UYN5R.mjs.map +0 -1
- package/dist/chunk-WDU6QXNK.mjs.map +0 -1
- package/dist/chunk-Z3YG4OZT.mjs.map +0 -1
- /package/dist/{chunk-JDEOUK5V.mjs.map → chunk-6YXKHAFU.mjs.map} +0 -0
- /package/dist/{chunk-Z5CQMP54.mjs.map → chunk-ARRYKOI5.mjs.map} +0 -0
- /package/dist/{chunk-KLA67WKG.mjs.map → chunk-B3FFOIWS.mjs.map} +0 -0
- /package/dist/{chunk-OPHK6OJN.mjs.map → chunk-SLDBGSC3.mjs.map} +0 -0
- /package/dist/{chunk-L2PE36GQ.mjs.map → chunk-T2KL7VEL.mjs.map} +0 -0
- /package/dist/{chunk-H3TE3LOV.mjs.map → chunk-XMFTIVJH.mjs.map} +0 -0
- /package/dist/{devtools-GAZ7F3KL.mjs.map → devtools-E4YNCY5J.mjs.map} +0 -0
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
} from "./chunk-GY2STC2S.mjs";
|
|
60
60
|
import {
|
|
61
61
|
resolveServerActionsConfig
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-ZVMV3THA.mjs";
|
|
63
63
|
import {
|
|
64
64
|
createFarmMarkdownRouteModuleFromFile,
|
|
65
65
|
createFarmMarkdownSourceResponse,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
discoverProgrammaticRoutePaths,
|
|
110
110
|
findProgrammaticRouteFiles,
|
|
111
111
|
loadProgrammaticRouteManifests
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-ARRYKOI5.mjs";
|
|
113
113
|
import {
|
|
114
114
|
_runWithFarmI18nRequest,
|
|
115
115
|
_setDefaultFarmI18nRuntime,
|
|
@@ -160,13 +160,13 @@ import {
|
|
|
160
160
|
} from "./chunk-RHIFZZUI.mjs";
|
|
161
161
|
import {
|
|
162
162
|
FARM_VERSION
|
|
163
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-BWJC5ZOD.mjs";
|
|
164
164
|
import {
|
|
165
165
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
166
166
|
createFarmDeploymentCookie,
|
|
167
167
|
createFarmDeploymentMismatchResponse,
|
|
168
168
|
getFarmDeploymentMismatch
|
|
169
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-3HIVDX7J.mjs";
|
|
170
170
|
import {
|
|
171
171
|
createDeferredDataResponse,
|
|
172
172
|
prepareDeferredData,
|
|
@@ -5131,7 +5131,7 @@ var HMRManager = _HMRManager;
|
|
|
5131
5131
|
|
|
5132
5132
|
// src/type-artifacts.ts
|
|
5133
5133
|
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync2, unlinkSync } from "fs";
|
|
5134
|
-
import { dirname as dirname3, join as join4, resolve as resolve3 } from "path";
|
|
5134
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, resolve as resolve3 } from "path";
|
|
5135
5135
|
|
|
5136
5136
|
// src/routing/generate-route-types.ts
|
|
5137
5137
|
import * as path7 from "path";
|
|
@@ -5165,6 +5165,15 @@ function routePatternToRouteLiteral(pattern) {
|
|
|
5165
5165
|
return JSON.stringify(pattern);
|
|
5166
5166
|
}
|
|
5167
5167
|
__name(routePatternToRouteLiteral, "routePatternToRouteLiteral");
|
|
5168
|
+
function renderTypeUnion(values) {
|
|
5169
|
+
return values.length <= 1 ? values[0] || "never" : `
|
|
5170
|
+
| ${values.join("\n | ")}`;
|
|
5171
|
+
}
|
|
5172
|
+
__name(renderTypeUnion, "renderTypeUnion");
|
|
5173
|
+
function renderTypeAlias(name, value) {
|
|
5174
|
+
return `export type ${name} =${value.startsWith("\n") ? "" : " "}${value};`;
|
|
5175
|
+
}
|
|
5176
|
+
__name(renderTypeAlias, "renderTypeAlias");
|
|
5168
5177
|
function createRoutePattern(route) {
|
|
5169
5178
|
if (route.segments.length === 0) return "/";
|
|
5170
5179
|
return "/" + route.segments.map((seg) => {
|
|
@@ -5190,39 +5199,48 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
5190
5199
|
const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
|
|
5191
5200
|
const sourceRoots = options.sourceRoots ?? [{ name: "project", root, srcDir, layer: false }];
|
|
5192
5201
|
const patterns = /* @__PURE__ */ new Set();
|
|
5202
|
+
const routeModulePatterns = /* @__PURE__ */ new Set();
|
|
5193
5203
|
const glob = await import("fast-glob");
|
|
5194
5204
|
for (const source of sourceRoots) {
|
|
5195
5205
|
const appDir = path7.join(source.root, source.srcDir, "app");
|
|
5196
5206
|
if (fs3.existsSync(appDir)) {
|
|
5197
|
-
const
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5207
|
+
const routeModuleFiles = await glob.default(
|
|
5208
|
+
"**/{page,layout,loading,error}.{ts,tsx,js,jsx,md,mdx}",
|
|
5209
|
+
{
|
|
5210
|
+
cwd: appDir,
|
|
5211
|
+
absolute: false
|
|
5212
|
+
}
|
|
5213
|
+
);
|
|
5214
|
+
for (const file of routeModuleFiles) {
|
|
5202
5215
|
if (parseRouteSlotFile(file)) continue;
|
|
5203
5216
|
const route = parseRoutePath(file);
|
|
5217
|
+
const pattern = createRoutePattern(route);
|
|
5218
|
+
routeModulePatterns.add(pattern);
|
|
5204
5219
|
if (route.type === "page") {
|
|
5205
|
-
const pattern = createRoutePattern(route);
|
|
5206
5220
|
patterns.add(pattern);
|
|
5207
5221
|
}
|
|
5208
5222
|
}
|
|
5209
5223
|
}
|
|
5210
5224
|
for (const route of await discoverProgrammaticRoutePaths(source.root, source.srcDir)) {
|
|
5211
5225
|
patterns.add(route);
|
|
5226
|
+
routeModulePatterns.add(route);
|
|
5212
5227
|
}
|
|
5213
5228
|
}
|
|
5214
5229
|
for (const route of extraRoutes) {
|
|
5215
5230
|
if (route.startsWith("/")) {
|
|
5216
5231
|
patterns.add(route);
|
|
5232
|
+
routeModulePatterns.add(route);
|
|
5217
5233
|
}
|
|
5218
5234
|
}
|
|
5219
5235
|
const sortedPatterns = Array.from(patterns).sort();
|
|
5220
5236
|
const typeLiterals = Array.from(new Set(sortedPatterns.flatMap(routePatternToTsTypeLiterals)));
|
|
5221
5237
|
const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
|
|
5222
|
-
const
|
|
5223
|
-
const
|
|
5238
|
+
const routeModulePatternLiterals = Array.from(routeModulePatterns).sort().map(routePatternToRouteLiteral);
|
|
5239
|
+
const routePathType = suppressLintOnLink ? "string" : renderTypeUnion(typeLiterals);
|
|
5240
|
+
const routePatternType = suppressLintOnLink ? "string" : renderTypeUnion(patternLiterals);
|
|
5241
|
+
const routeModulePatternType = renderTypeUnion(routeModulePatternLiterals);
|
|
5224
5242
|
const routeTypesImportPath = `./${path7.basename(outPath).replace(/\.d\.ts$/, "")}`;
|
|
5225
|
-
const
|
|
5243
|
+
const linkAugmentationBlock = suppressLintOnLink ? "" : `
|
|
5226
5244
|
declare module "@farm.js/core/client" {
|
|
5227
5245
|
interface LinkDefaultRoute {
|
|
5228
5246
|
_: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
|
|
@@ -5246,14 +5264,25 @@ declare module "@farm.js/core/dist/client.js" {
|
|
|
5246
5264
|
pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
|
|
5247
5265
|
}
|
|
5248
5266
|
}
|
|
5267
|
+
`;
|
|
5268
|
+
const routeModuleAugmentationBlock = `
|
|
5269
|
+
declare global {
|
|
5270
|
+
namespace FarmJS {
|
|
5271
|
+
interface RouteRegistry {
|
|
5272
|
+
pattern: import(${JSON.stringify(routeTypesImportPath)}).RouteModulePattern;
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5249
5276
|
`;
|
|
5250
5277
|
const content = `/**
|
|
5251
5278
|
* Auto-generated route types from src/app.
|
|
5252
|
-
* Link href
|
|
5279
|
+
* Link href and route component props are typed automatically from generated declarations.
|
|
5280
|
+
* Regenerated on dev start and when routes change.
|
|
5253
5281
|
* Set suppressLintOnLink: true in farm.config.ts to accept any string on Link href.
|
|
5254
5282
|
*/
|
|
5255
|
-
|
|
5256
|
-
|
|
5283
|
+
${renderTypeAlias("RoutePath", routePathType)}
|
|
5284
|
+
${renderTypeAlias("RoutePattern", routePatternType)}
|
|
5285
|
+
${renderTypeAlias("RouteModulePattern", routeModulePatternType)}${linkAugmentationBlock}${routeModuleAugmentationBlock}
|
|
5257
5286
|
`;
|
|
5258
5287
|
return content;
|
|
5259
5288
|
}
|
|
@@ -5358,7 +5387,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5358
5387
|
const sourceRoots = getFarmSourceRoots({ root, srcDir, layers: options.layers });
|
|
5359
5388
|
const appDirs = getFarmAppDirectories({ root, srcDir, layers: options.layers });
|
|
5360
5389
|
const result = {
|
|
5361
|
-
apiRoutes: []
|
|
5390
|
+
apiRoutes: [],
|
|
5391
|
+
stalePaths: []
|
|
5362
5392
|
};
|
|
5363
5393
|
const unifiedTypesPath = join4(root, srcDir, "farm.d.ts");
|
|
5364
5394
|
const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
|
|
@@ -5374,22 +5404,29 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5374
5404
|
unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
|
|
5375
5405
|
result.routeTypesPath = unifiedTypesPath;
|
|
5376
5406
|
} else if (shouldGenerateRoutes) {
|
|
5377
|
-
|
|
5407
|
+
const routeOptions = {
|
|
5378
5408
|
root,
|
|
5379
5409
|
srcDir,
|
|
5380
5410
|
outFile: options.routeTypesOutFile,
|
|
5381
5411
|
extraRoutes: options.extraRoutes || [],
|
|
5382
5412
|
suppressLintOnLink: options.suppressLintOnLink,
|
|
5383
5413
|
sourceRoots
|
|
5384
|
-
}
|
|
5414
|
+
};
|
|
5415
|
+
if (options.check) {
|
|
5416
|
+
const routeTypesPath = resolveGeneratedPath(root, srcDir, options.routeTypesOutFile);
|
|
5417
|
+
const content = await createRouteTypeDeclarations(routeOptions, routeTypesPath);
|
|
5418
|
+
checkGeneratedFile(routeTypesPath, content, result.stalePaths);
|
|
5419
|
+
result.routeTypesPath = routeTypesPath;
|
|
5420
|
+
} else {
|
|
5421
|
+
result.routeTypesPath = await generateRouteTypes(routeOptions);
|
|
5422
|
+
}
|
|
5385
5423
|
}
|
|
5386
5424
|
if (shouldGenerateApi) {
|
|
5387
5425
|
const generator = new APITypeGenerator(appDirs);
|
|
5388
5426
|
const apiRoutes = generator.scanAPIRoutes();
|
|
5389
5427
|
const apiTypesPath = options.apiTypesOutFile ? resolve3(root, options.apiTypesOutFile) : join4(root, srcDir, "lib", "api.generated.ts");
|
|
5390
5428
|
const content = generator.generateAPIRouter(apiRoutes, { outFile: apiTypesPath });
|
|
5391
|
-
|
|
5392
|
-
writeFileIfChanged(apiTypesPath, content);
|
|
5429
|
+
writeOrCheckGeneratedFile(apiTypesPath, content, options.check, result.stalePaths);
|
|
5393
5430
|
result.apiTypesPath = apiTypesPath;
|
|
5394
5431
|
result.apiRoutes = apiRoutes;
|
|
5395
5432
|
}
|
|
@@ -5407,36 +5444,63 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5407
5444
|
);
|
|
5408
5445
|
result.envTypesPath = unifiedTypesPath;
|
|
5409
5446
|
} else if (shouldGenerateEnv) {
|
|
5410
|
-
|
|
5447
|
+
const envOptions = {
|
|
5411
5448
|
root,
|
|
5412
5449
|
srcDir,
|
|
5413
5450
|
outFile: options.envTypesOutFile,
|
|
5414
5451
|
configPath: options.configPath,
|
|
5415
5452
|
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
5416
|
-
}
|
|
5453
|
+
};
|
|
5454
|
+
if (options.check) {
|
|
5455
|
+
const envTypesPath = resolveGeneratedPath(root, srcDir, options.envTypesOutFile);
|
|
5456
|
+
checkGeneratedFile(
|
|
5457
|
+
envTypesPath,
|
|
5458
|
+
createEnvTypeDeclarations(envOptions, envTypesPath),
|
|
5459
|
+
result.stalePaths
|
|
5460
|
+
);
|
|
5461
|
+
result.envTypesPath = envTypesPath;
|
|
5462
|
+
} else {
|
|
5463
|
+
result.envTypesPath = await generateEnvTypes(envOptions);
|
|
5464
|
+
}
|
|
5417
5465
|
}
|
|
5418
5466
|
if (shouldGenerateImages && options.imageTypesOutFile) {
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
}
|
|
5467
|
+
const imageTypesPath = resolveGeneratedPath(root, srcDir, options.imageTypesOutFile, false);
|
|
5468
|
+
if (options.check) {
|
|
5469
|
+
checkGeneratedFile(imageTypesPath, createFarmImageTypeDeclarations(), result.stalePaths);
|
|
5470
|
+
result.imageTypesPath = imageTypesPath;
|
|
5471
|
+
} else {
|
|
5472
|
+
result.imageTypesPath = generateFarmImageTypes({
|
|
5473
|
+
root,
|
|
5474
|
+
srcDir,
|
|
5475
|
+
outFile: options.imageTypesOutFile
|
|
5476
|
+
});
|
|
5477
|
+
}
|
|
5424
5478
|
}
|
|
5425
5479
|
if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
|
|
5426
5480
|
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
5427
5481
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
5428
5482
|
result.i18nTypesPath = unifiedTypesPath;
|
|
5429
5483
|
} else if (shouldGenerateI18n && options.i18nConfig) {
|
|
5430
|
-
|
|
5431
|
-
root,
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5484
|
+
if (options.check) {
|
|
5485
|
+
const i18nTypesPath = resolveGeneratedPath(root, srcDir, options.i18nTypesOutFile, false);
|
|
5486
|
+
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
5487
|
+
checkGeneratedFile(
|
|
5488
|
+
i18nTypesPath,
|
|
5489
|
+
renderFarmI18nTypes(options.i18nConfig.locales, signatures),
|
|
5490
|
+
result.stalePaths
|
|
5491
|
+
);
|
|
5492
|
+
result.i18nTypesPath = i18nTypesPath;
|
|
5493
|
+
} else {
|
|
5494
|
+
result.i18nTypesPath = await generateFarmI18nTypes({
|
|
5495
|
+
root,
|
|
5496
|
+
srcDir,
|
|
5497
|
+
config: options.i18nConfig,
|
|
5498
|
+
outFile: options.i18nTypesOutFile
|
|
5499
|
+
});
|
|
5500
|
+
}
|
|
5436
5501
|
}
|
|
5437
5502
|
if (shouldRefreshUnifiedTypes) {
|
|
5438
|
-
|
|
5439
|
-
writeFileIfChanged(
|
|
5503
|
+
writeOrCheckGeneratedFile(
|
|
5440
5504
|
unifiedTypesPath,
|
|
5441
5505
|
`/**
|
|
5442
5506
|
* Generated by Farm.js. Do not edit.
|
|
@@ -5445,14 +5509,41 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5445
5509
|
|
|
5446
5510
|
import "@farm.js/core/image";
|
|
5447
5511
|
|
|
5448
|
-
${unifiedSections.join("\n")}
|
|
5512
|
+
${unifiedSections.map((section) => section.trimEnd()).join("\n\n")}
|
|
5513
|
+
`,
|
|
5514
|
+
options.check,
|
|
5515
|
+
result.stalePaths
|
|
5449
5516
|
);
|
|
5450
5517
|
result.typesPath = unifiedTypesPath;
|
|
5451
|
-
|
|
5518
|
+
if (options.check) {
|
|
5519
|
+
collectLegacyTypeArtifacts(root, srcDir, result.stalePaths);
|
|
5520
|
+
} else {
|
|
5521
|
+
removeLegacyTypeArtifacts(root, srcDir);
|
|
5522
|
+
}
|
|
5452
5523
|
}
|
|
5453
5524
|
return result;
|
|
5454
5525
|
}
|
|
5455
5526
|
__name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
|
|
5527
|
+
function resolveGeneratedPath(root, srcDir, outFile, relativeToSrc = true) {
|
|
5528
|
+
if (isAbsolute2(outFile)) return resolve3(outFile);
|
|
5529
|
+
return resolve3(root, relativeToSrc ? join4(srcDir, outFile) : outFile);
|
|
5530
|
+
}
|
|
5531
|
+
__name(resolveGeneratedPath, "resolveGeneratedPath");
|
|
5532
|
+
function writeOrCheckGeneratedFile(filePath, content, check, stalePaths) {
|
|
5533
|
+
if (check) {
|
|
5534
|
+
checkGeneratedFile(filePath, content, stalePaths);
|
|
5535
|
+
return;
|
|
5536
|
+
}
|
|
5537
|
+
mkdirSync4(dirname3(filePath), { recursive: true });
|
|
5538
|
+
writeFileIfChanged(filePath, content);
|
|
5539
|
+
}
|
|
5540
|
+
__name(writeOrCheckGeneratedFile, "writeOrCheckGeneratedFile");
|
|
5541
|
+
function checkGeneratedFile(filePath, content, stalePaths) {
|
|
5542
|
+
if (!existsSync4(filePath) || readFileSync2(filePath, "utf8") !== content) {
|
|
5543
|
+
stalePaths.push(filePath);
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
__name(checkGeneratedFile, "checkGeneratedFile");
|
|
5456
5547
|
var LEGACY_TYPE_ARTIFACTS = [
|
|
5457
5548
|
["farm-routes.d.ts", "Auto-generated route types"],
|
|
5458
5549
|
["farm-env.d.ts", "Auto-generated env types"],
|
|
@@ -5470,6 +5561,14 @@ function removeLegacyTypeArtifacts(root, srcDir) {
|
|
|
5470
5561
|
}
|
|
5471
5562
|
}
|
|
5472
5563
|
__name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
|
|
5564
|
+
function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
|
|
5565
|
+
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
5566
|
+
const filePath = join4(root, srcDir, fileName);
|
|
5567
|
+
if (!existsSync4(filePath)) continue;
|
|
5568
|
+
if (readFileSync2(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
__name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
|
|
5473
5572
|
|
|
5474
5573
|
// src/vite.ts
|
|
5475
5574
|
import * as fs4 from "fs";
|
|
@@ -5680,7 +5779,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
5680
5779
|
}
|
|
5681
5780
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
5682
5781
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
5683
|
-
return import("./devtools-
|
|
5782
|
+
return import("./devtools-E4YNCY5J.mjs");
|
|
5684
5783
|
}
|
|
5685
5784
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
5686
5785
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -9447,4 +9546,4 @@ export {
|
|
|
9447
9546
|
farmPlugin,
|
|
9448
9547
|
defineConfig
|
|
9449
9548
|
};
|
|
9450
|
-
//# sourceMappingURL=chunk-
|
|
9549
|
+
//# sourceMappingURL=chunk-OSWV5IJB.mjs.map
|