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.
This commit is contained in:
1 parent
0e2097ac18
commit
71c7f6cc09
2 files changed
+7
-4
No files matched your search
@@ -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 `<profileParent>/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
|
||||
|
||||
@@ -221,6 +221,7 @@ function resolveModuleFallbackEntries(
|
||||
const versions = new Map<string, string | undefined>()
|
||||
/* 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<string, string> = profile === undefined
|
||||
? new Map<string, string>()
|
||||
: 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,
|
||||
|
||||
Reference in new issue
Block a user