@suss/resolution 0.20.0 → 0.21.0
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/README.md +26 -0
- package/dist/index.cjs +17 -0
- package/dist/index.js +17 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -200,6 +200,32 @@ The demand cone stays on the base facts named above. Nothing here pulls
|
|
|
200
200
|
`reaches` or `callsInto`, so asking about a receiver does not price in
|
|
201
201
|
call-graph closure.
|
|
202
202
|
|
|
203
|
+
## The subject behind a registration
|
|
204
|
+
|
|
205
|
+
Discovery keeps asking one question: is this receiver the app, the
|
|
206
|
+
router, the thing built by calling what a library exports? Which
|
|
207
|
+
`.get(...)` calls are routes and which `.use(...)` calls are mounts
|
|
208
|
+
both hang on the answer, and every language feature that moves a value
|
|
209
|
+
is a place the receiver can be written: a class field, a destructured
|
|
210
|
+
name, a property on an object another file built. Enumerating those
|
|
211
|
+
spellings in a walker loses to the language, so the question is asked
|
|
212
|
+
of the rules instead.
|
|
213
|
+
|
|
214
|
+
The answer comes back in two relations, both seeded by
|
|
215
|
+
`wantedSubject`.
|
|
216
|
+
`wantedSubjectWritten` is the written-value walk from the asked
|
|
217
|
+
receiver, so the asking side can apply the single-answer policy over
|
|
218
|
+
everything the receiver could be. `wantedSubjectConstruction` keeps
|
|
219
|
+
only the answers that are a call or a `new`, and pairs each with where
|
|
220
|
+
its callee was imported from, through however many aliases the callee
|
|
221
|
+
went. The asking side checks that pair against the (module, name) a
|
|
222
|
+
pack declares: exactly one distinct construction with a matching
|
|
223
|
+
origin is the subject, none or several is a refusal.
|
|
224
|
+
|
|
225
|
+
The construction end needs no fact of its own. Every call is already a
|
|
226
|
+
`call` fact, a `new` expression included, and the join against
|
|
227
|
+
`comesFrom` is what makes one of them a subject seed.
|
|
228
|
+
|
|
203
229
|
## Explaining an answer
|
|
204
230
|
|
|
205
231
|
Evaluate the same rules under `@suss/datalog`'s `witnesses` algebra and
|
package/dist/index.cjs
CHANGED
|
@@ -1162,6 +1162,23 @@ var RESOLUTION_QUESTIONS = [
|
|
|
1162
1162
|
(0, import_datalog2.lit)("callsInto", (0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
1163
1163
|
]
|
|
1164
1164
|
),
|
|
1165
|
+
// Subject identity, its own demand class; the README's subject
|
|
1166
|
+
// section says why the origin pair rides on the written-value walk.
|
|
1167
|
+
(0, import_datalog2.rule)(
|
|
1168
|
+
"wantedSubjectWritten",
|
|
1169
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")],
|
|
1170
|
+
[(0, import_datalog2.lit)("wantedSubject", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("isWrittenAs", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r"))]
|
|
1171
|
+
),
|
|
1172
|
+
(0, import_datalog2.rule)(
|
|
1173
|
+
"wantedSubjectConstruction",
|
|
1174
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
1175
|
+
[
|
|
1176
|
+
(0, import_datalog2.lit)("wantedSubject", (0, import_datalog2.variable)("x")),
|
|
1177
|
+
(0, import_datalog2.lit)("isWrittenAs", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")),
|
|
1178
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")),
|
|
1179
|
+
(0, import_datalog2.lit)("comesFrom", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
1180
|
+
]
|
|
1181
|
+
),
|
|
1165
1182
|
// The export table of one module, keyed by the module asked about.
|
|
1166
1183
|
// The moduleExport rules flatten re-export chains of any length, and
|
|
1167
1184
|
// the demand cone stays on export facts alone.
|
package/dist/index.js
CHANGED
|
@@ -1123,6 +1123,23 @@ var RESOLUTION_QUESTIONS = [
|
|
|
1123
1123
|
lit("callsInto", v("g"), v("m"), v("n"))
|
|
1124
1124
|
]
|
|
1125
1125
|
),
|
|
1126
|
+
// Subject identity, its own demand class; the README's subject
|
|
1127
|
+
// section says why the origin pair rides on the written-value walk.
|
|
1128
|
+
rule(
|
|
1129
|
+
"wantedSubjectWritten",
|
|
1130
|
+
[v("x"), v("r")],
|
|
1131
|
+
[lit("wantedSubject", v("x")), lit("isWrittenAs", v("x"), v("r"))]
|
|
1132
|
+
),
|
|
1133
|
+
rule(
|
|
1134
|
+
"wantedSubjectConstruction",
|
|
1135
|
+
[v("x"), v("r"), v("m"), v("n")],
|
|
1136
|
+
[
|
|
1137
|
+
lit("wantedSubject", v("x")),
|
|
1138
|
+
lit("isWrittenAs", v("x"), v("r")),
|
|
1139
|
+
lit("call", v("r"), v("c")),
|
|
1140
|
+
lit("comesFrom", v("c"), v("m"), v("n"))
|
|
1141
|
+
]
|
|
1142
|
+
),
|
|
1126
1143
|
// The export table of one module, keyed by the module asked about.
|
|
1127
1144
|
// The moduleExport rules flatten re-export chains of any length, and
|
|
1128
1145
|
// the demand cone stays on export facts alone.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/resolution",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Language-neutral rules for following a value to the function it comes down to.",
|
|
6
6
|
"keywords": [
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@suss/datalog": "0.
|
|
56
|
+
"@suss/datalog": "0.21.0"
|
|
57
57
|
}
|
|
58
58
|
}
|