You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/resolution-algorithm.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,7 +146,22 @@ The resolver can throw the following errors:
146
146
147
147
<!--lint enable-->
148
148
149
-
**TODO**: `PACKAGE_IMPORTS_EXPORTS_RESOLVE`
149
+
1. If `matchKey` is a key of `matchObj` and does not contain `'*'`, then
150
+
1. Let *target* be the value of `matchObj[matchKey]`
151
+
2. Return the result of [`PACKAGE_TARGET_RESOLVE(packageUrl, target, null, isImports, conditions, mainFields, parent)`][package-target-resolve]
152
+
2. Let *expansionKeys* be the list of keys of *matchObj* containing only a single `'*'`, sorted by the sorting function
153
+
[`PATTERN_KEY_COMPARE`][pattern-key-compare] which orders in descending order of specificity
154
+
3. For each key *expansionKey* in *expansionKeys*, do
155
+
1. Let *patternBase* be the substring of *expansionKey* up to but excluding the first `'*'` character
156
+
2. If *matchKey* starts with, but is not equal, to *patternBase*, then
157
+
1. Let *patternTrailer* be the substring of *expansionKey* from the index after the first `'*'` character
158
+
2. If *patternTrailer* has zero length, or if *matchKey* ends with *patternTrailer* and the length of *matchKey*
159
+
is greater than or equal to the length of *expansionKey*, then
160
+
1. Let *target* be the value of `matchObj[matchKey]`
161
+
2. Let *patternMatch* be the substring of *matchKey* starting at the index of the length of *patternBase* up to
162
+
the length of *matchKey* minus the length of *patternTrailer*
163
+
3. Return the result of [`PACKAGE_TARGET_RESOLVE(packageUrl, target, patternMatch, isImports, conditions, mainFields, parent)`][package-target-resolve]
0 commit comments