From 71c7f6cc090c153bbf96d6ce68487530902dc36d Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Sat, 19 Sep 2026 14:39:45 +0800 Subject: [PATCH] refactor(boot): name the interception layer parent and note intentional anchors routeScoped names the profile parent whose node_modules is the interception layer. The installation traversal records why the installation root keeps its caller-supplied directory and why generation construction keeps its Promise return type. --- .../boot/app-boot/src/profile-resolution/resolver.ts | 9 +++++---- packages/boot/app-boot/src/profile.ts | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/boot/app-boot/src/profile-resolution/resolver.ts b/packages/boot/app-boot/src/profile-resolution/resolver.ts index 11533aba18..bae3853f5c 100644 --- a/packages/boot/app-boot/src/profile-resolution/resolver.ts +++ b/packages/boot/app-boot/src/profile-resolution/resolver.ts @@ -393,13 +393,14 @@ class ResolutionRouter { } } - // The interception layer is the node_modules directory of the profile's parent. - const layer = dirname(localRoot) + // The interception layer is `/node_modules`: a fallback entry occupies its name + // there, so its subpath misses continue above it; a name without an entry continues at it. + const profileParent = dirname(localRoot) const eligible = target?.scope === 'installation' || (target?.scope === 'profile' && parentRoutes.activeProfile) const route: ResolutionRoute = eligible - ? { kind: 'fallback', entry: target, after: join(dirname(layer), 'package.json') } - : { kind: 'after-fallback', parent: join(layer, 'package.json') } + ? { kind: 'fallback', entry: target, after: join(dirname(profileParent), 'package.json') } + : { kind: 'after-fallback', parent: join(profileParent, 'package.json') } const state: ResolutionRouteState = { route } if (route.kind === 'fallback') requests.set(request, state) return state diff --git a/packages/boot/app-boot/src/profile.ts b/packages/boot/app-boot/src/profile.ts index abea03462b..c752c15419 100644 --- a/packages/boot/app-boot/src/profile.ts +++ b/packages/boot/app-boot/src/profile.ts @@ -221,6 +221,7 @@ function resolveModuleFallbackEntries( const versions = new Map() /* v8 ignore next -- a real app manifest always declares its name */ if (appManifest.name !== undefined) { + // Supported launches derive the installation anchor from import.meta.url, so this directory is already real. links.set(appManifest.name, dirname(installAnchor)) declarers.set(appManifest.name, canonicalAnchor) versions.set(appManifest.name, appManifest.version) @@ -286,6 +287,7 @@ export async function createProfileResolutionGeneration( const profilePackages: ReadonlyMap = profile === undefined ? new Map() : resolveProfileModuleFallback(profile, packageNames, profileDeclarers, profileVersions) + // The Promise return type is the pre-stable API; construction has no asynchronous step. return await Promise.resolve(Object.freeze({ profilesDir, profileDir: profile?.dir,