@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
package/dist/plugin.cjs
CHANGED
|
@@ -2036,6 +2036,13 @@ var init_cache_invalidation = __esm({
|
|
|
2036
2036
|
}
|
|
2037
2037
|
});
|
|
2038
2038
|
|
|
2039
|
+
// src/server-fn-error.ts
|
|
2040
|
+
var init_server_fn_error = __esm({
|
|
2041
|
+
"src/server-fn-error.ts"() {
|
|
2042
|
+
"use strict";
|
|
2043
|
+
}
|
|
2044
|
+
});
|
|
2045
|
+
|
|
2039
2046
|
// src/server-action-security.ts
|
|
2040
2047
|
function resolveServerActionsConfig(config) {
|
|
2041
2048
|
const allowedOrigins = (config?.allowedOrigins ?? []).map(normalizeAllowedOriginPattern);
|
|
@@ -2129,6 +2136,7 @@ var init_server_action_security = __esm({
|
|
|
2129
2136
|
"use strict";
|
|
2130
2137
|
import_node_async_hooks = require("async_hooks");
|
|
2131
2138
|
init_cache_invalidation();
|
|
2139
|
+
init_server_fn_error();
|
|
2132
2140
|
DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT = 1e6;
|
|
2133
2141
|
SERVER_ACTION_STORAGE_KEY = /* @__PURE__ */ Symbol.for("farm.serverActionStorage");
|
|
2134
2142
|
__name(resolveServerActionsConfig, "resolveServerActionsConfig");
|
|
@@ -20913,6 +20921,15 @@ function routePatternToRouteLiteral(pattern) {
|
|
|
20913
20921
|
return JSON.stringify(pattern);
|
|
20914
20922
|
}
|
|
20915
20923
|
__name(routePatternToRouteLiteral, "routePatternToRouteLiteral");
|
|
20924
|
+
function renderTypeUnion(values) {
|
|
20925
|
+
return values.length <= 1 ? values[0] || "never" : `
|
|
20926
|
+
| ${values.join("\n | ")}`;
|
|
20927
|
+
}
|
|
20928
|
+
__name(renderTypeUnion, "renderTypeUnion");
|
|
20929
|
+
function renderTypeAlias(name, value) {
|
|
20930
|
+
return `export type ${name} =${value.startsWith("\n") ? "" : " "}${value};`;
|
|
20931
|
+
}
|
|
20932
|
+
__name(renderTypeAlias, "renderTypeAlias");
|
|
20916
20933
|
function createRoutePattern(route) {
|
|
20917
20934
|
if (route.segments.length === 0) return "/";
|
|
20918
20935
|
return "/" + route.segments.map((seg) => {
|
|
@@ -20938,39 +20955,48 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
20938
20955
|
const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
|
|
20939
20956
|
const sourceRoots = options.sourceRoots ?? [{ name: "project", root, srcDir, layer: false }];
|
|
20940
20957
|
const patterns = /* @__PURE__ */ new Set();
|
|
20958
|
+
const routeModulePatterns = /* @__PURE__ */ new Set();
|
|
20941
20959
|
const glob = await import("fast-glob");
|
|
20942
20960
|
for (const source of sourceRoots) {
|
|
20943
20961
|
const appDir = path14.join(source.root, source.srcDir, "app");
|
|
20944
20962
|
if (fs5.existsSync(appDir)) {
|
|
20945
|
-
const
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20963
|
+
const routeModuleFiles = await glob.default(
|
|
20964
|
+
"**/{page,layout,loading,error}.{ts,tsx,js,jsx,md,mdx}",
|
|
20965
|
+
{
|
|
20966
|
+
cwd: appDir,
|
|
20967
|
+
absolute: false
|
|
20968
|
+
}
|
|
20969
|
+
);
|
|
20970
|
+
for (const file of routeModuleFiles) {
|
|
20950
20971
|
if (parseRouteSlotFile(file)) continue;
|
|
20951
20972
|
const route = parseRoutePath(file);
|
|
20973
|
+
const pattern = createRoutePattern(route);
|
|
20974
|
+
routeModulePatterns.add(pattern);
|
|
20952
20975
|
if (route.type === "page") {
|
|
20953
|
-
const pattern = createRoutePattern(route);
|
|
20954
20976
|
patterns.add(pattern);
|
|
20955
20977
|
}
|
|
20956
20978
|
}
|
|
20957
20979
|
}
|
|
20958
20980
|
for (const route of await discoverProgrammaticRoutePaths(source.root, source.srcDir)) {
|
|
20959
20981
|
patterns.add(route);
|
|
20982
|
+
routeModulePatterns.add(route);
|
|
20960
20983
|
}
|
|
20961
20984
|
}
|
|
20962
20985
|
for (const route of extraRoutes) {
|
|
20963
20986
|
if (route.startsWith("/")) {
|
|
20964
20987
|
patterns.add(route);
|
|
20988
|
+
routeModulePatterns.add(route);
|
|
20965
20989
|
}
|
|
20966
20990
|
}
|
|
20967
20991
|
const sortedPatterns = Array.from(patterns).sort();
|
|
20968
20992
|
const typeLiterals = Array.from(new Set(sortedPatterns.flatMap(routePatternToTsTypeLiterals)));
|
|
20969
20993
|
const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
|
|
20970
|
-
const
|
|
20971
|
-
const
|
|
20994
|
+
const routeModulePatternLiterals = Array.from(routeModulePatterns).sort().map(routePatternToRouteLiteral);
|
|
20995
|
+
const routePathType = suppressLintOnLink ? "string" : renderTypeUnion(typeLiterals);
|
|
20996
|
+
const routePatternType = suppressLintOnLink ? "string" : renderTypeUnion(patternLiterals);
|
|
20997
|
+
const routeModulePatternType = renderTypeUnion(routeModulePatternLiterals);
|
|
20972
20998
|
const routeTypesImportPath = `./${path14.basename(outPath).replace(/\.d\.ts$/, "")}`;
|
|
20973
|
-
const
|
|
20999
|
+
const linkAugmentationBlock = suppressLintOnLink ? "" : `
|
|
20974
21000
|
declare module "@farm.js/core/client" {
|
|
20975
21001
|
interface LinkDefaultRoute {
|
|
20976
21002
|
_: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
|
|
@@ -20994,14 +21020,25 @@ declare module "@farm.js/core/dist/client.js" {
|
|
|
20994
21020
|
pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
|
|
20995
21021
|
}
|
|
20996
21022
|
}
|
|
21023
|
+
`;
|
|
21024
|
+
const routeModuleAugmentationBlock = `
|
|
21025
|
+
declare global {
|
|
21026
|
+
namespace FarmJS {
|
|
21027
|
+
interface RouteRegistry {
|
|
21028
|
+
pattern: import(${JSON.stringify(routeTypesImportPath)}).RouteModulePattern;
|
|
21029
|
+
}
|
|
21030
|
+
}
|
|
21031
|
+
}
|
|
20997
21032
|
`;
|
|
20998
21033
|
const content = `/**
|
|
20999
21034
|
* Auto-generated route types from src/app.
|
|
21000
|
-
* Link href
|
|
21035
|
+
* Link href and route component props are typed automatically from generated declarations.
|
|
21036
|
+
* Regenerated on dev start and when routes change.
|
|
21001
21037
|
* Set suppressLintOnLink: true in farm.config.ts to accept any string on Link href.
|
|
21002
21038
|
*/
|
|
21003
|
-
|
|
21004
|
-
|
|
21039
|
+
${renderTypeAlias("RoutePath", routePathType)}
|
|
21040
|
+
${renderTypeAlias("RoutePattern", routePatternType)}
|
|
21041
|
+
${renderTypeAlias("RouteModulePattern", routeModulePatternType)}${linkAugmentationBlock}${routeModuleAugmentationBlock}
|
|
21005
21042
|
`;
|
|
21006
21043
|
return content;
|
|
21007
21044
|
}
|
|
@@ -21283,7 +21320,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
21283
21320
|
const sourceRoots = getFarmSourceRoots({ root, srcDir, layers: options.layers });
|
|
21284
21321
|
const appDirs = getFarmAppDirectories({ root, srcDir, layers: options.layers });
|
|
21285
21322
|
const result = {
|
|
21286
|
-
apiRoutes: []
|
|
21323
|
+
apiRoutes: [],
|
|
21324
|
+
stalePaths: []
|
|
21287
21325
|
};
|
|
21288
21326
|
const unifiedTypesPath = (0, import_path8.join)(root, srcDir, "farm.d.ts");
|
|
21289
21327
|
const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
|
|
@@ -21299,22 +21337,29 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
21299
21337
|
unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
|
|
21300
21338
|
result.routeTypesPath = unifiedTypesPath;
|
|
21301
21339
|
} else if (shouldGenerateRoutes) {
|
|
21302
|
-
|
|
21340
|
+
const routeOptions = {
|
|
21303
21341
|
root,
|
|
21304
21342
|
srcDir,
|
|
21305
21343
|
outFile: options.routeTypesOutFile,
|
|
21306
21344
|
extraRoutes: options.extraRoutes || [],
|
|
21307
21345
|
suppressLintOnLink: options.suppressLintOnLink,
|
|
21308
21346
|
sourceRoots
|
|
21309
|
-
}
|
|
21347
|
+
};
|
|
21348
|
+
if (options.check) {
|
|
21349
|
+
const routeTypesPath = resolveGeneratedPath(root, srcDir, options.routeTypesOutFile);
|
|
21350
|
+
const content = await createRouteTypeDeclarations(routeOptions, routeTypesPath);
|
|
21351
|
+
checkGeneratedFile(routeTypesPath, content, result.stalePaths);
|
|
21352
|
+
result.routeTypesPath = routeTypesPath;
|
|
21353
|
+
} else {
|
|
21354
|
+
result.routeTypesPath = await generateRouteTypes(routeOptions);
|
|
21355
|
+
}
|
|
21310
21356
|
}
|
|
21311
21357
|
if (shouldGenerateApi) {
|
|
21312
21358
|
const generator = new APITypeGenerator(appDirs);
|
|
21313
21359
|
const apiRoutes = generator.scanAPIRoutes();
|
|
21314
21360
|
const apiTypesPath = options.apiTypesOutFile ? (0, import_path8.resolve)(root, options.apiTypesOutFile) : (0, import_path8.join)(root, srcDir, "lib", "api.generated.ts");
|
|
21315
21361
|
const content = generator.generateAPIRouter(apiRoutes, { outFile: apiTypesPath });
|
|
21316
|
-
(
|
|
21317
|
-
writeFileIfChanged(apiTypesPath, content);
|
|
21362
|
+
writeOrCheckGeneratedFile(apiTypesPath, content, options.check, result.stalePaths);
|
|
21318
21363
|
result.apiTypesPath = apiTypesPath;
|
|
21319
21364
|
result.apiRoutes = apiRoutes;
|
|
21320
21365
|
}
|
|
@@ -21332,36 +21377,63 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
21332
21377
|
);
|
|
21333
21378
|
result.envTypesPath = unifiedTypesPath;
|
|
21334
21379
|
} else if (shouldGenerateEnv) {
|
|
21335
|
-
|
|
21380
|
+
const envOptions = {
|
|
21336
21381
|
root,
|
|
21337
21382
|
srcDir,
|
|
21338
21383
|
outFile: options.envTypesOutFile,
|
|
21339
21384
|
configPath: options.configPath,
|
|
21340
21385
|
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
21341
|
-
}
|
|
21386
|
+
};
|
|
21387
|
+
if (options.check) {
|
|
21388
|
+
const envTypesPath = resolveGeneratedPath(root, srcDir, options.envTypesOutFile);
|
|
21389
|
+
checkGeneratedFile(
|
|
21390
|
+
envTypesPath,
|
|
21391
|
+
createEnvTypeDeclarations(envOptions, envTypesPath),
|
|
21392
|
+
result.stalePaths
|
|
21393
|
+
);
|
|
21394
|
+
result.envTypesPath = envTypesPath;
|
|
21395
|
+
} else {
|
|
21396
|
+
result.envTypesPath = await generateEnvTypes(envOptions);
|
|
21397
|
+
}
|
|
21342
21398
|
}
|
|
21343
21399
|
if (shouldGenerateImages && options.imageTypesOutFile) {
|
|
21344
|
-
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
}
|
|
21400
|
+
const imageTypesPath = resolveGeneratedPath(root, srcDir, options.imageTypesOutFile, false);
|
|
21401
|
+
if (options.check) {
|
|
21402
|
+
checkGeneratedFile(imageTypesPath, createFarmImageTypeDeclarations(), result.stalePaths);
|
|
21403
|
+
result.imageTypesPath = imageTypesPath;
|
|
21404
|
+
} else {
|
|
21405
|
+
result.imageTypesPath = generateFarmImageTypes({
|
|
21406
|
+
root,
|
|
21407
|
+
srcDir,
|
|
21408
|
+
outFile: options.imageTypesOutFile
|
|
21409
|
+
});
|
|
21410
|
+
}
|
|
21349
21411
|
}
|
|
21350
21412
|
if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
|
|
21351
21413
|
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
21352
21414
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
21353
21415
|
result.i18nTypesPath = unifiedTypesPath;
|
|
21354
21416
|
} else if (shouldGenerateI18n && options.i18nConfig) {
|
|
21355
|
-
|
|
21356
|
-
root,
|
|
21357
|
-
|
|
21358
|
-
|
|
21359
|
-
|
|
21360
|
-
|
|
21417
|
+
if (options.check) {
|
|
21418
|
+
const i18nTypesPath = resolveGeneratedPath(root, srcDir, options.i18nTypesOutFile, false);
|
|
21419
|
+
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
21420
|
+
checkGeneratedFile(
|
|
21421
|
+
i18nTypesPath,
|
|
21422
|
+
renderFarmI18nTypes(options.i18nConfig.locales, signatures),
|
|
21423
|
+
result.stalePaths
|
|
21424
|
+
);
|
|
21425
|
+
result.i18nTypesPath = i18nTypesPath;
|
|
21426
|
+
} else {
|
|
21427
|
+
result.i18nTypesPath = await generateFarmI18nTypes({
|
|
21428
|
+
root,
|
|
21429
|
+
srcDir,
|
|
21430
|
+
config: options.i18nConfig,
|
|
21431
|
+
outFile: options.i18nTypesOutFile
|
|
21432
|
+
});
|
|
21433
|
+
}
|
|
21361
21434
|
}
|
|
21362
21435
|
if (shouldRefreshUnifiedTypes) {
|
|
21363
|
-
(
|
|
21364
|
-
writeFileIfChanged(
|
|
21436
|
+
writeOrCheckGeneratedFile(
|
|
21365
21437
|
unifiedTypesPath,
|
|
21366
21438
|
`/**
|
|
21367
21439
|
* Generated by Farm.js. Do not edit.
|
|
@@ -21370,14 +21442,41 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
21370
21442
|
|
|
21371
21443
|
import "@farm.js/core/image";
|
|
21372
21444
|
|
|
21373
|
-
${unifiedSections.join("\n")}
|
|
21445
|
+
${unifiedSections.map((section) => section.trimEnd()).join("\n\n")}
|
|
21446
|
+
`,
|
|
21447
|
+
options.check,
|
|
21448
|
+
result.stalePaths
|
|
21374
21449
|
);
|
|
21375
21450
|
result.typesPath = unifiedTypesPath;
|
|
21376
|
-
|
|
21451
|
+
if (options.check) {
|
|
21452
|
+
collectLegacyTypeArtifacts(root, srcDir, result.stalePaths);
|
|
21453
|
+
} else {
|
|
21454
|
+
removeLegacyTypeArtifacts(root, srcDir);
|
|
21455
|
+
}
|
|
21377
21456
|
}
|
|
21378
21457
|
return result;
|
|
21379
21458
|
}
|
|
21380
21459
|
__name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
|
|
21460
|
+
function resolveGeneratedPath(root, srcDir, outFile, relativeToSrc = true) {
|
|
21461
|
+
if ((0, import_path8.isAbsolute)(outFile)) return (0, import_path8.resolve)(outFile);
|
|
21462
|
+
return (0, import_path8.resolve)(root, relativeToSrc ? (0, import_path8.join)(srcDir, outFile) : outFile);
|
|
21463
|
+
}
|
|
21464
|
+
__name(resolveGeneratedPath, "resolveGeneratedPath");
|
|
21465
|
+
function writeOrCheckGeneratedFile(filePath, content, check, stalePaths) {
|
|
21466
|
+
if (check) {
|
|
21467
|
+
checkGeneratedFile(filePath, content, stalePaths);
|
|
21468
|
+
return;
|
|
21469
|
+
}
|
|
21470
|
+
(0, import_fs4.mkdirSync)((0, import_path8.dirname)(filePath), { recursive: true });
|
|
21471
|
+
writeFileIfChanged(filePath, content);
|
|
21472
|
+
}
|
|
21473
|
+
__name(writeOrCheckGeneratedFile, "writeOrCheckGeneratedFile");
|
|
21474
|
+
function checkGeneratedFile(filePath, content, stalePaths) {
|
|
21475
|
+
if (!(0, import_fs4.existsSync)(filePath) || (0, import_fs4.readFileSync)(filePath, "utf8") !== content) {
|
|
21476
|
+
stalePaths.push(filePath);
|
|
21477
|
+
}
|
|
21478
|
+
}
|
|
21479
|
+
__name(checkGeneratedFile, "checkGeneratedFile");
|
|
21381
21480
|
var LEGACY_TYPE_ARTIFACTS = [
|
|
21382
21481
|
["farm-routes.d.ts", "Auto-generated route types"],
|
|
21383
21482
|
["farm-env.d.ts", "Auto-generated env types"],
|
|
@@ -21395,6 +21494,14 @@ function removeLegacyTypeArtifacts(root, srcDir) {
|
|
|
21395
21494
|
}
|
|
21396
21495
|
}
|
|
21397
21496
|
__name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
|
|
21497
|
+
function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
|
|
21498
|
+
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
21499
|
+
const filePath = (0, import_path8.join)(root, srcDir, fileName);
|
|
21500
|
+
if (!(0, import_fs4.existsSync)(filePath)) continue;
|
|
21501
|
+
if ((0, import_fs4.readFileSync)(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
|
|
21502
|
+
}
|
|
21503
|
+
}
|
|
21504
|
+
__name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
|
|
21398
21505
|
|
|
21399
21506
|
// src/vite.ts
|
|
21400
21507
|
init_markdown();
|