veryfront 0.1.1149 → 0.1.1150
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/esm/deno.js +1 -1
- package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.js +10 -9
- package/esm/src/rendering/layouts/layout-collector.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-collector.js +10 -12
- package/esm/src/rendering/orchestrator/path-helpers.d.ts +13 -2
- package/esm/src/rendering/orchestrator/path-helpers.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/path-helpers.js +21 -4
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +10 -2
- package/esm/src/rendering/router-detection.d.ts +12 -0
- package/esm/src/rendering/router-detection.d.ts.map +1 -1
- package/esm/src/rendering/router-detection.js +41 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-applicator.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/layouts/layout-applicator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,YAAY,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAKzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-applicator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,oBAAoB;YAsDpB,mBAAmB;YAwCnB,0BAA0B;CAsEzC"}
|
|
@@ -7,7 +7,7 @@ import { resolve as resolveContract } from "../../extensions/contracts.js";
|
|
|
7
7
|
import { applyLayoutsESM, applyLayoutsFunctionBody } from "./utils/applicator.js";
|
|
8
8
|
import { resolveAppComponentPath } from "./utils/app-resolver.js";
|
|
9
9
|
import { collectAncestorDirs, createErrorBoundary, tryLoadReservedInDirs, } from "../app-reserved.js";
|
|
10
|
-
import {
|
|
10
|
+
import { resolveRouterModeForPage } from "../router-detection.js";
|
|
11
11
|
import { getProjectReact } from "../../react/index.js";
|
|
12
12
|
import { extract } from "../../platform/compat/std/front-matter-yaml.js";
|
|
13
13
|
import { createFileSystem } from "../../platform/compat/fs.js";
|
|
@@ -15,6 +15,7 @@ import { resolveFrameworkSourcePath } from "../../platform/compat/framework-sour
|
|
|
15
15
|
import { loadModuleFromSource } from "../../modules/react-loader/index.js";
|
|
16
16
|
import { resolveProjectReactVersion } from "../../transforms/esm/package-registry.js";
|
|
17
17
|
import { CLIENT_PAGE_ISLAND_ID } from "../rsc/page-island.js";
|
|
18
|
+
import { isDotPath } from "../orchestrator/path-helpers.js";
|
|
18
19
|
const logger = rendererLogger.component("layout-applicator");
|
|
19
20
|
export class LayoutApplicator {
|
|
20
21
|
projectDir;
|
|
@@ -75,17 +76,17 @@ export class LayoutApplicator {
|
|
|
75
76
|
else {
|
|
76
77
|
wrappedElement = await this.applyLayoutsOnly(pageElement, layoutBundle, nestedLayouts, layoutDataMap, reactVersion);
|
|
77
78
|
}
|
|
78
|
-
const useAppRouter = await detectAppRouter(this.projectDir, this.config, this.adapter, {
|
|
79
|
-
projectId: this.projectId,
|
|
80
|
-
});
|
|
81
79
|
const pageFilePath = pageInfo.entity.path;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const routerMode = resolveRouterModeForPage(this.projectDir, pageFilePath, this.config);
|
|
81
|
+
const dotPath = isDotPath({
|
|
82
|
+
slug: pageInfo.entity.slug ?? "",
|
|
83
|
+
filePath: pageFilePath,
|
|
84
|
+
projectDir: this.projectDir,
|
|
85
|
+
});
|
|
86
|
+
if (routerMode === "app") {
|
|
86
87
|
wrappedElement = await this.wrapWithReservedComponents(wrappedElement, pageFilePath);
|
|
87
88
|
}
|
|
88
|
-
else if (
|
|
89
|
+
else if (dotPath) {
|
|
89
90
|
logger.debug("Skipping wrapWithAppComponent - dot-prefixed path");
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-collector.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/layouts/layout-collector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAW7D,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,eAAe,GACtB,MAAM,CAKR;
|
|
1
|
+
{"version":3,"file":"layout-collector.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/layouts/layout-collector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAW7D,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,eAAe,GACtB,MAAM,CAKR;AA+BD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB;AAUD,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,SAAS,GAAG,SAAS,CAAC;IACpC,aAAa,EAAE,UAAU,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC,SAAS,CAAC,CAAC;CACzB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAIM;gBAEZ,OAAO,EAAE,sBAAsB;IAQrC,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAsD7D,mBAAmB;YAyDnB,0BAA0B;IAkExC,OAAO,CAAC,iBAAiB;YAoBX,oBAAoB;YAgBpB,qBAAqB;IA4BnC;;;;;;OAMG;YACW,6BAA6B;IAiC3C;;OAEG;YACW,0BAA0B;CASzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { join } from "../../platform/compat/path/index.js";
|
|
1
|
+
import { isAbsolute, join, normalize } from "../../platform/compat/path/index.js";
|
|
2
2
|
import { rendererLogger } from "../../utils/index.js";
|
|
3
3
|
import { getLayoutEntity } from "../../types/entities/getEntityInfo.js";
|
|
4
4
|
import { discoverNestedLayouts } from "./utils/discovery.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveRouterModeForPage } from "../router-detection.js";
|
|
6
6
|
import { LAYOUT_EXTENSIONS } from "./types.js";
|
|
7
7
|
import { SpanNames } from "../../observability/index.js";
|
|
8
8
|
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
@@ -14,6 +14,9 @@ export function resolveLayoutRouterRootDir(projectDir, useAppRouter, config) {
|
|
|
14
14
|
: config.directories?.pages ?? "pages";
|
|
15
15
|
return join(projectDir, directory);
|
|
16
16
|
}
|
|
17
|
+
function resolvePagePath(pageFilePath, projectDir) {
|
|
18
|
+
return normalize(isAbsolute(pageFilePath) ? pageFilePath : join(projectDir, pageFilePath));
|
|
19
|
+
}
|
|
17
20
|
function getLayoutKind(path) {
|
|
18
21
|
return path.endsWith(".mdx") || path.endsWith(".md") ? "mdx" : "tsx";
|
|
19
22
|
}
|
|
@@ -187,19 +190,14 @@ export class LayoutCollector {
|
|
|
187
190
|
return null;
|
|
188
191
|
}
|
|
189
192
|
async collectNestedLayouts(pageInfo) {
|
|
190
|
-
const pageFilePath = pageInfo.entity.path;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// Unified path for ALL adapters - discoverNestedLayouts uses adapter.fs.stat()
|
|
195
|
-
// which works for both filesystem and API adapters
|
|
196
|
-
return this.collectLayoutsUnified(pageFilePath, useAppRouter);
|
|
193
|
+
const pageFilePath = resolvePagePath(pageInfo.entity.path, this.projectDir);
|
|
194
|
+
const routerMode = resolveRouterModeForPage(this.projectDir, pageInfo.entity.path, this.config);
|
|
195
|
+
const rootDir = resolveLayoutRouterRootDir(this.projectDir, routerMode === "app", this.config);
|
|
196
|
+
return this.collectLayoutsUnified(pageFilePath, rootDir);
|
|
197
197
|
}
|
|
198
|
-
async collectLayoutsUnified(pageFilePath,
|
|
199
|
-
const rootDir = resolveLayoutRouterRootDir(this.projectDir, useAppRouter, this.config);
|
|
198
|
+
async collectLayoutsUnified(pageFilePath, rootDir) {
|
|
200
199
|
logger.debug("collectLayoutsUnified", {
|
|
201
200
|
pageFilePath,
|
|
202
|
-
useAppRouter,
|
|
203
201
|
rootDir,
|
|
204
202
|
projectDir: this.projectDir,
|
|
205
203
|
});
|
|
@@ -8,8 +8,19 @@
|
|
|
8
8
|
import type { LayoutItem } from "../../types/index.js";
|
|
9
9
|
/** Check if a path segment is a hidden dot-directory (not . or ..) */
|
|
10
10
|
export declare function isHiddenSegment(segment: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
export
|
|
11
|
+
/** Inputs used to determine whether a resolved route is hidden. */
|
|
12
|
+
export interface DotPathOptions {
|
|
13
|
+
slug: string;
|
|
14
|
+
filePath?: string;
|
|
15
|
+
projectDir: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check whether a route contains a dot-prefixed segment.
|
|
19
|
+
*
|
|
20
|
+
* Absolute filesystem ancestors are outside the route namespace and must not
|
|
21
|
+
* make a project hidden (for example, a project checked out under `.worktrees`).
|
|
22
|
+
*/
|
|
23
|
+
export declare function isDotPath({ slug, filePath, projectDir }: DotPathOptions): boolean;
|
|
13
24
|
/** Empty layout result for dot-prefixed paths */
|
|
14
25
|
export declare const EMPTY_LAYOUT_RESULT: {
|
|
15
26
|
layoutBundle: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"path-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAcD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,cAAc,GAAG,OAAO,CAMjF;AAED,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,EAAE;IAChC,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,UAAU,EAAE,CAAC;CACoB,CAAC"}
|
|
@@ -5,14 +5,31 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module rendering/orchestrator/path-helpers
|
|
7
7
|
*/
|
|
8
|
+
import { isAbsolute, relative } from "../../platform/compat/path/index.js";
|
|
8
9
|
/** Check if a path segment is a hidden dot-directory (not . or ..) */
|
|
9
10
|
export function isHiddenSegment(segment) {
|
|
10
11
|
return segment.startsWith(".") && segment !== "." && segment !== "..";
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function getProjectPath(filePath, projectDir) {
|
|
14
|
+
if (!filePath || !isAbsolute(filePath))
|
|
15
|
+
return filePath;
|
|
16
|
+
const projectPath = relative(projectDir, filePath);
|
|
17
|
+
const normalizedProjectPath = projectPath.replaceAll("\\", "/");
|
|
18
|
+
const isOutsideProject = normalizedProjectPath === ".." ||
|
|
19
|
+
normalizedProjectPath.startsWith("../") ||
|
|
20
|
+
isAbsolute(projectPath);
|
|
21
|
+
return isOutsideProject ? undefined : projectPath;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a route contains a dot-prefixed segment.
|
|
25
|
+
*
|
|
26
|
+
* Absolute filesystem ancestors are outside the route namespace and must not
|
|
27
|
+
* make a project hidden (for example, a project checked out under `.worktrees`).
|
|
28
|
+
*/
|
|
29
|
+
export function isDotPath({ slug, filePath, projectDir }) {
|
|
30
|
+
const hasDotSegment = (path) => path.replaceAll("\\", "/").split("/").some(isHiddenSegment);
|
|
31
|
+
const projectPath = getProjectPath(filePath, projectDir);
|
|
32
|
+
return hasDotSegment(slug) || (projectPath ? hasDotSegment(projectPath) : false);
|
|
16
33
|
}
|
|
17
34
|
/** Empty layout result for dot-prefixed paths */
|
|
18
35
|
export const EMPTY_LAYOUT_RESULT = { layoutBundle: undefined, nestedLayouts: [] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AASzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA6DhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO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IA6FhC,OAAO,CAAC,kBAAkB;YAQZ,uBAAuB;IAmBrC;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;CAStB"}
|
|
@@ -334,7 +334,11 @@ export class RenderPipeline {
|
|
|
334
334
|
timing.pageResolve = Math.round(performance.now() - pageResolveStart);
|
|
335
335
|
const sourceFile = extractRelativePathShared(pageInfo.entity.path, this.config.projectDir);
|
|
336
336
|
try {
|
|
337
|
-
const skipLayouts = isDotPath(
|
|
337
|
+
const skipLayouts = isDotPath({
|
|
338
|
+
slug,
|
|
339
|
+
filePath: pageInfo.entity.path,
|
|
340
|
+
projectDir: this.config.projectDir,
|
|
341
|
+
});
|
|
338
342
|
const layoutCollectStart = performance.now();
|
|
339
343
|
const layoutResult = skipLayouts ? EMPTY_LAYOUT_RESULT : await profilePhase("render.collect_layouts", () => withSpan("render.collect_layouts", () => this.config.layoutOrchestrator.collectLayouts(pageInfo), { "render.slug": slug }));
|
|
340
344
|
timing.layoutCollect = Math.round(performance.now() - layoutCollectStart);
|
|
@@ -514,7 +518,11 @@ export class RenderPipeline {
|
|
|
514
518
|
clearSSRModuleCacheForProject(projectId, { preserveActiveTransforms: true });
|
|
515
519
|
}
|
|
516
520
|
const pageInfo = await profilePhase("page_data.resolve_page", () => this.config.pageResolver.resolvePage(slug));
|
|
517
|
-
const skipLayouts = isDotPath(
|
|
521
|
+
const skipLayouts = isDotPath({
|
|
522
|
+
slug,
|
|
523
|
+
filePath: pageInfo.entity.path,
|
|
524
|
+
projectDir: this.config.projectDir,
|
|
525
|
+
});
|
|
518
526
|
const layoutResult = skipLayouts ? EMPTY_LAYOUT_RESULT : await profilePhase("page_data.collect_layouts", () => this.config.layoutOrchestrator.collectLayouts(pageInfo));
|
|
519
527
|
const pagePath = extractRelativePathShared(pageInfo.entity.path, this.config.projectDir);
|
|
520
528
|
const fileExtension = getExtensionName(pageInfo.entity.path);
|
|
@@ -26,6 +26,18 @@ export interface DetectAppRouterOptions {
|
|
|
26
26
|
/** Project ID for cache isolation in multi-tenant deployments */
|
|
27
27
|
projectId?: string;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the router that owns an already-resolved page.
|
|
31
|
+
*
|
|
32
|
+
* Auto-detection decides which router to try first, but mixed projects can
|
|
33
|
+
* legitimately fall back to the other router. Per-page rendering must follow
|
|
34
|
+
* the route that actually resolved instead of the project-wide preference.
|
|
35
|
+
*
|
|
36
|
+
* Pages routes can also resolve from the project root. App routes cannot
|
|
37
|
+
* resolve outside their configured root, so an unmatched resolved path belongs
|
|
38
|
+
* to the Pages router.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveRouterModeForPage(projectDir: string, pagePath: string, config: VeryfrontConfig): "app" | "pages";
|
|
29
41
|
/**
|
|
30
42
|
* Detect if app router should be used based on config and directory structure.
|
|
31
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-detection.d.ts","sourceRoot":"","sources":["../../../src/src/rendering/router-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;4BAO4B;AAK5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAY5D;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,KAAK,GAAG,OAAO,GACpB,IAAI,CAEN;AAED,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
|
1
|
+
{"version":3,"file":"router-detection.d.ts","sourceRoot":"","sources":["../../../src/src/rendering/router-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;4BAO4B;AAK5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAY5D;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,KAAK,GAAG,OAAO,GACpB,IAAI,CAEN;AAED,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GACtB,KAAK,GAAG,OAAO,CA0BjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Directory structure analysis
|
|
7
7
|
* - Route file presence detection
|
|
8
8
|
**************************/
|
|
9
|
-
import { join } from "../platform/compat/path/index.js";
|
|
9
|
+
import { isAbsolute, join, normalize, relative } from "../platform/compat/path/index.js";
|
|
10
10
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
11
11
|
import { rendererLogger } from "../utils/index.js";
|
|
12
12
|
import { LRUCache } from "../utils/lru-wrapper.js";
|
|
@@ -41,6 +41,46 @@ export function clearRouterDetectionCacheForProject(projectId) {
|
|
|
41
41
|
export function primeRouterDetectionCache(projectKey, mode) {
|
|
42
42
|
routerDetectionCache.set(projectKey, mode === "app");
|
|
43
43
|
}
|
|
44
|
+
function isPathInside(path, directory) {
|
|
45
|
+
const relativePath = relative(directory, path).replaceAll("\\", "/");
|
|
46
|
+
return relativePath === "" ||
|
|
47
|
+
(relativePath !== ".." &&
|
|
48
|
+
!relativePath.startsWith("../") &&
|
|
49
|
+
!isAbsolute(relativePath));
|
|
50
|
+
}
|
|
51
|
+
function resolveProjectPath(projectDir, path) {
|
|
52
|
+
return normalize(isAbsolute(path) ? path : join(projectDir, path));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the router that owns an already-resolved page.
|
|
56
|
+
*
|
|
57
|
+
* Auto-detection decides which router to try first, but mixed projects can
|
|
58
|
+
* legitimately fall back to the other router. Per-page rendering must follow
|
|
59
|
+
* the route that actually resolved instead of the project-wide preference.
|
|
60
|
+
*
|
|
61
|
+
* Pages routes can also resolve from the project root. App routes cannot
|
|
62
|
+
* resolve outside their configured root, so an unmatched resolved path belongs
|
|
63
|
+
* to the Pages router.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveRouterModeForPage(projectDir, pagePath, config) {
|
|
66
|
+
if (config.router === "app")
|
|
67
|
+
return "app";
|
|
68
|
+
if (config.router === "pages")
|
|
69
|
+
return "pages";
|
|
70
|
+
const resolvedPagePath = resolveProjectPath(projectDir, pagePath);
|
|
71
|
+
const appRoot = resolveProjectPath(projectDir, config.directories?.app ?? "app");
|
|
72
|
+
const pagesRoot = resolveProjectPath(projectDir, config.directories?.pages ?? "pages");
|
|
73
|
+
const isAppRoute = isPathInside(resolvedPagePath, appRoot);
|
|
74
|
+
const isPagesRoute = isPathInside(resolvedPagePath, pagesRoot);
|
|
75
|
+
if (isAppRoute && isPagesRoute) {
|
|
76
|
+
const appDistance = relative(appRoot, resolvedPagePath).split(/[\\/]/).filter(Boolean).length;
|
|
77
|
+
const pagesDistance = relative(pagesRoot, resolvedPagePath).split(/[\\/]/).filter(Boolean).length;
|
|
78
|
+
return pagesDistance < appDistance ? "pages" : "app";
|
|
79
|
+
}
|
|
80
|
+
if (isAppRoute)
|
|
81
|
+
return "app";
|
|
82
|
+
return "pages";
|
|
83
|
+
}
|
|
44
84
|
/**
|
|
45
85
|
* Detect if app router should be used based on config and directory structure.
|
|
46
86
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1150",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -332,10 +332,10 @@
|
|
|
332
332
|
"@types/react": "19.2.14",
|
|
333
333
|
"@types/react-dom": "19.2.3",
|
|
334
334
|
"ws": "8.21.0",
|
|
335
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
336
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
337
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
338
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
335
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1150",
|
|
336
|
+
"@veryfront/ext-content-mdx": "0.1.1150",
|
|
337
|
+
"@veryfront/ext-css-tailwind": "0.1.1150",
|
|
338
|
+
"@veryfront/ext-parser-babel": "0.1.1150"
|
|
339
339
|
},
|
|
340
340
|
"devDependencies": {
|
|
341
341
|
"@types/node": "20.9.0"
|