@velarscript/web 0.28.1 → 0.29.1
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/dist/analysis/component-guidance.d.ts +52 -0
- package/dist/analysis/component-guidance.d.ts.map +1 -0
- package/dist/analysis/component-guidance.js +103 -0
- package/dist/analysis/component-guidance.js.map +1 -0
- package/dist/analysis/look-values.d.ts +30 -0
- package/dist/analysis/look-values.d.ts.map +1 -0
- package/dist/analysis/look-values.js +61 -0
- package/dist/analysis/look-values.js.map +1 -0
- package/dist/analysis/public-config.d.ts +44 -0
- package/dist/analysis/public-config.d.ts.map +1 -0
- package/dist/analysis/public-config.js +133 -0
- package/dist/analysis/public-config.js.map +1 -0
- package/dist/analysis/watch-cycles.d.ts +176 -0
- package/dist/analysis/watch-cycles.d.ts.map +1 -0
- package/dist/analysis/watch-cycles.js +300 -0
- package/dist/analysis/watch-cycles.js.map +1 -0
- package/dist/analyzer.d.ts +45 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +134 -214
- package/dist/analyzer.js.map +1 -1
- package/dist/browser-host-runtime.d.ts +23 -0
- package/dist/browser-host-runtime.d.ts.map +1 -0
- package/dist/browser-host-runtime.js +29 -0
- package/dist/browser-host-runtime.js.map +1 -0
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.js +6 -6
- package/dist/compiler.js.map +1 -1
- package/dist/emitter.js +25 -5
- package/dist/emitter.js.map +1 -1
- package/dist/lexer.js +89 -16
- package/dist/lexer.js.map +1 -1
- package/dist/look.d.ts +1 -1
- package/dist/look.d.ts.map +1 -1
- package/dist/look.js +5 -3
- package/dist/look.js.map +1 -1
- package/dist/parser.d.ts +2 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +23 -25
- package/dist/parser.js.map +1 -1
- package/dist/runtime-foundation.d.ts.map +1 -1
- package/dist/runtime-foundation.js +5 -5
- package/dist/runtime-foundation.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +12 -11
- package/dist/runtime.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -1
- package/dist/visual-blocks.d.ts +28 -0
- package/dist/visual-blocks.d.ts.map +1 -0
- package/dist/visual-blocks.js +23 -0
- package/dist/visual-blocks.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch-cycles.d.ts","sourceRoot":"","sources":["../../src/analysis/watch-cycles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AAGzC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC5C,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CA+B1E;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,GAAG,SAAS,gBAAgB,EAAE,GAAG,IAAI,CASnH;AAED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EAAE,QAAQ,GAAG,WAAW,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;CACrC;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAAC,CA6B9G;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,SAA2B,GAClC,MAAM,GAAG,IAAI,CAgBf;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,MAAM,GACX;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CAS1D"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D114 W: the reactive places a watch is about — the subject it watches, the
|
|
3
|
+
* places a body statement writes, and the one-hop `action`/`async def` writers
|
|
4
|
+
* of this module. Everything here is a question about *paths and statements*;
|
|
5
|
+
* nothing needs a type, which is why it reads as free functions and why, under
|
|
6
|
+
* D115 §三's `web/analysis/`, it is its own module rather than 280 lines in the
|
|
7
|
+
* middle of the Web analyzer.
|
|
8
|
+
*
|
|
9
|
+
* What a path *means* — whether the type at a depth is a collection, which of
|
|
10
|
+
* its calls mutate — stays with the analyzer and arrives as `ReactiveSubjectWrite`.
|
|
11
|
+
*/
|
|
12
|
+
import {} from "@velarscript/compiler";
|
|
13
|
+
import { mutatingCollectionMethods, } from "@velarscript/compiler/extension";
|
|
14
|
+
import { isWebStatement } from "../ast.js";
|
|
15
|
+
/**
|
|
16
|
+
* D114 W: a reactive place written as one comparable key, so "the write and the
|
|
17
|
+
* subject name the same place" is one string equality.
|
|
18
|
+
*
|
|
19
|
+
* It is deliberately narrower than `renderWatchSubject`, which reconstructs any
|
|
20
|
+
* expression for a message. A key has to *decide*, so only the parts that name
|
|
21
|
+
* the same place on two evaluations are allowed into one: names, fields, and an
|
|
22
|
+
* index that is either a literal or another such path. `items[next()]` renders
|
|
23
|
+
* perfectly well and answers a different element every call, so it has no key
|
|
24
|
+
* and the shapes below stay silent on it — which is the right answer for a
|
|
25
|
+
* refusal that has to be right every time.
|
|
26
|
+
*/
|
|
27
|
+
export function reactivePathOf(expression) {
|
|
28
|
+
switch (expression.kind) {
|
|
29
|
+
case "IdentifierExpression":
|
|
30
|
+
return { root: expression.name, steps: [], text: expression.name };
|
|
31
|
+
case "MemberExpression": {
|
|
32
|
+
if (expression.optional)
|
|
33
|
+
return null;
|
|
34
|
+
const object = reactivePathOf(expression.object);
|
|
35
|
+
if (object === null)
|
|
36
|
+
return null;
|
|
37
|
+
return {
|
|
38
|
+
root: object.root,
|
|
39
|
+
steps: [...object.steps, { kind: "field", name: expression.property }],
|
|
40
|
+
text: `${object.text}.${expression.property}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
case "IndexExpression": {
|
|
44
|
+
if (expression.optional)
|
|
45
|
+
return null;
|
|
46
|
+
const object = reactivePathOf(expression.object);
|
|
47
|
+
if (object === null)
|
|
48
|
+
return null;
|
|
49
|
+
const index = expression.index.kind === "LiteralExpression"
|
|
50
|
+
? (typeof expression.index.value === "string" ? JSON.stringify(expression.index.value) : expression.index.raw)
|
|
51
|
+
: reactiveWritePath(expression.index);
|
|
52
|
+
if (index === null)
|
|
53
|
+
return null;
|
|
54
|
+
return {
|
|
55
|
+
root: object.root,
|
|
56
|
+
steps: [...object.steps, { kind: "index", key: index }],
|
|
57
|
+
text: `${object.text}[${index}]`,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function reactiveWritePath(expression) {
|
|
65
|
+
return reactivePathOf(expression)?.text ?? null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* D114 0.28.0 H-D1: the steps a written place takes *below* the watch subject,
|
|
69
|
+
* `[]` when the write is the subject itself, and null when it is neither. §15
|
|
70
|
+
* says a watch fires on a deep change of its subject, so a write of a part of
|
|
71
|
+
* the subject is the same ring as a write of the subject — and a sibling
|
|
72
|
+
* (`watch form.name:` writing `form.email`) or a different root is not.
|
|
73
|
+
*/
|
|
74
|
+
export function reactiveStepsBelow(subject, written) {
|
|
75
|
+
if (written.root !== subject.root || written.steps.length < subject.steps.length)
|
|
76
|
+
return null;
|
|
77
|
+
for (const [index, step] of subject.steps.entries()) {
|
|
78
|
+
const other = written.steps[index];
|
|
79
|
+
if (step.kind !== other.kind)
|
|
80
|
+
return null;
|
|
81
|
+
if (step.kind === "field" ? step.name !== other.name
|
|
82
|
+
: step.key !== other.key)
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return written.steps.slice(subject.steps.length);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* D114 W: the calls that mutate the value at one place, or null where the place
|
|
89
|
+
* holds no collection. One reading of the compiler's own roster, asked of the
|
|
90
|
+
* subject and of any place below it alike, so a deep mutating call and a direct
|
|
91
|
+
* one can never disagree about which methods write.
|
|
92
|
+
*/
|
|
93
|
+
export function collectionMutators(place) {
|
|
94
|
+
return place.kind === "list" || place.kind === "map" || place.kind === "set" || place.kind === "record"
|
|
95
|
+
? mutatingCollectionMethods(place.kind)
|
|
96
|
+
: null;
|
|
97
|
+
}
|
|
98
|
+
/** The root name a reactive path starts from, which is the binding it resolves through. */
|
|
99
|
+
export function reactivePathRoot(expression) {
|
|
100
|
+
switch (expression.kind) {
|
|
101
|
+
case "IdentifierExpression":
|
|
102
|
+
return expression.name;
|
|
103
|
+
case "MemberExpression":
|
|
104
|
+
case "IndexExpression":
|
|
105
|
+
return reactivePathRoot(expression.object);
|
|
106
|
+
default:
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function bindingPatternBinds(pattern, name) {
|
|
111
|
+
switch (pattern.kind) {
|
|
112
|
+
case "NameBindingPattern":
|
|
113
|
+
return pattern.name === name;
|
|
114
|
+
case "ObjectBindingPattern":
|
|
115
|
+
return pattern.rest?.name === name || pattern.entries.some((entry) => bindingPatternBinds(entry.pattern, name));
|
|
116
|
+
case "ListBindingPattern":
|
|
117
|
+
return pattern.rest?.name === name
|
|
118
|
+
|| pattern.elements.some((element) => element !== null && bindingPatternBinds(element, name));
|
|
119
|
+
default:
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* D114 W: whether a body statement introduces its own binding of `name`. From
|
|
125
|
+
* that statement on, the spelling names something else, and a write through it
|
|
126
|
+
* is not a write of the watched place. The scan stops there rather than
|
|
127
|
+
* guessing which of the two a later line meant.
|
|
128
|
+
*/
|
|
129
|
+
export function statementBindsName(statement, name) {
|
|
130
|
+
switch (statement.kind) {
|
|
131
|
+
case "VariableDeclaration":
|
|
132
|
+
return bindingPatternBinds(statement.pattern, name);
|
|
133
|
+
case "UsingDeclaration":
|
|
134
|
+
case "FunctionDeclaration":
|
|
135
|
+
case "ClassDeclaration":
|
|
136
|
+
return statement.name === name;
|
|
137
|
+
default:
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* D114 W: the call a body statement makes when the statement is nothing but
|
|
143
|
+
* that call. `detach` is included because it is how a synchronous watch body
|
|
144
|
+
* starts asynchronous work — the tour and four charter fences spell the reload
|
|
145
|
+
* that way — so a refusal that only saw the bare call would miss the shape it
|
|
146
|
+
* exists for. Everything else (a call inside an `if`, an argument, an assigned
|
|
147
|
+
* result) is not a plain top-level call and is not offered here.
|
|
148
|
+
*/
|
|
149
|
+
export function topLevelCall(statement) {
|
|
150
|
+
const expression = statement.kind === "ExpressionStatement" ? statement.expression
|
|
151
|
+
: statement.kind === "DetachStatement" ? statement.expression
|
|
152
|
+
: null;
|
|
153
|
+
return expression !== null && expression.kind === "CallExpression" ? expression : null;
|
|
154
|
+
}
|
|
155
|
+
export function reactiveWriteCandidate(statement) {
|
|
156
|
+
if (statement.kind === "AssignmentStatement") {
|
|
157
|
+
const place = reactivePathOf(statement.target);
|
|
158
|
+
return place === null ? null : { place, method: null };
|
|
159
|
+
}
|
|
160
|
+
const call = statement.kind === "ExpressionStatement" && statement.expression.kind === "CallExpression"
|
|
161
|
+
? statement.expression
|
|
162
|
+
: null;
|
|
163
|
+
if (call === null || call.callee.kind !== "MemberExpression" || call.callee.optional)
|
|
164
|
+
return null;
|
|
165
|
+
const place = reactivePathOf(call.callee.object);
|
|
166
|
+
return place === null ? null : { place, method: call.callee.property };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* D114 W: whether one plain body statement writes the watched place — the
|
|
170
|
+
* subject itself, or any place below it. An assignment or a compound
|
|
171
|
+
* assignment to it is one; so is a call of a mutating collection method on it,
|
|
172
|
+
* because a watch on a collection fires on its deep mutation and `mutators`
|
|
173
|
+
* answers the compiler's own roster of the calls that mutate whatever sits at
|
|
174
|
+
* that depth.
|
|
175
|
+
*
|
|
176
|
+
* D114 0.28.0 H-D1's other half: `watch form: rename()` where `rename` writes
|
|
177
|
+
* `form.name` is the same ring as `watch form: form.name = …`, which F1 already
|
|
178
|
+
* refuses. The subject and the writer question read one comparison —
|
|
179
|
+
* `reactiveStepsBelow` — so a deep write cannot be a cycle at one of them and
|
|
180
|
+
* not at the other.
|
|
181
|
+
*/
|
|
182
|
+
export function reactiveWriteOf(statement, subject, writes) {
|
|
183
|
+
const write = reactiveWriteCandidate(statement);
|
|
184
|
+
if (write === null)
|
|
185
|
+
return null;
|
|
186
|
+
const steps = reactiveStepsBelow(subject, write.place);
|
|
187
|
+
if (steps === null)
|
|
188
|
+
return null;
|
|
189
|
+
return writes(steps, write.method) ? write.place : null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* D114 W A2(b): whether an `action` or `async def` writes `path` at its own top
|
|
193
|
+
* level, unconditionally. One hop: what the callee itself calls is not
|
|
194
|
+
* followed. A parameter of the callee's own that is spelled like the path's
|
|
195
|
+
* root, or a binding it declares before the write, means the write is not of
|
|
196
|
+
* the watched place and the answer is no.
|
|
197
|
+
*/
|
|
198
|
+
export function writerWritesPath(writer, subject, writes) {
|
|
199
|
+
if (writer.parameters.includes(subject.root))
|
|
200
|
+
return null;
|
|
201
|
+
for (const statement of writer.body) {
|
|
202
|
+
if (statementBindsName(statement, subject.root))
|
|
203
|
+
return null;
|
|
204
|
+
const written = reactiveWriteOf(statement, subject, writes);
|
|
205
|
+
if (written !== null)
|
|
206
|
+
return written;
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
export function collectReactiveWriters(program) {
|
|
211
|
+
const writers = new Map();
|
|
212
|
+
const claim = (name, declaration) => {
|
|
213
|
+
writers.set(name, writers.has(name) ? null : declaration);
|
|
214
|
+
};
|
|
215
|
+
const record = (statements) => {
|
|
216
|
+
for (const statement of statements) {
|
|
217
|
+
if (statement.kind === "FunctionDeclaration") {
|
|
218
|
+
claim(statement.name, statement.asynchronous
|
|
219
|
+
? { spelling: "async def", parameters: statement.parameters.map((parameter) => parameter.name), body: statement.body }
|
|
220
|
+
: null);
|
|
221
|
+
record(statement.body);
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (!isWebStatement(statement))
|
|
225
|
+
continue;
|
|
226
|
+
if (statement.kind === "ExtensionStatement:web:action") {
|
|
227
|
+
claim(statement.name, {
|
|
228
|
+
spelling: "action",
|
|
229
|
+
parameters: statement.parameters.map((parameter) => parameter.name),
|
|
230
|
+
body: statement.body,
|
|
231
|
+
});
|
|
232
|
+
record(statement.body);
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (statement.kind === "ExtensionStatement:web:component")
|
|
236
|
+
record(statement.body);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
record(program.body);
|
|
240
|
+
return writers;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* D114 0.28.0 H-D1: the VEL5077 message one plain body statement earns, or null
|
|
244
|
+
* when it earns none.
|
|
245
|
+
*
|
|
246
|
+
* §15 says a watch fires on a *deep* change of its subject, so `watch form:
|
|
247
|
+
* form.name = …` and `watch items: items[0].done = …` are the same ring
|
|
248
|
+
* `items.append(…)` already is — decided at the top of the body, with no
|
|
249
|
+
* condition to end it — and were silent until the runtime's 100-round cap
|
|
250
|
+
* stopped them. The rule is therefore stated on the path rather than on the
|
|
251
|
+
* spelling: a write whose place is the subject, or any place below it, in an
|
|
252
|
+
* assignment, a compound assignment, or a mutating call.
|
|
253
|
+
*
|
|
254
|
+
* Every existing exclusion stands, because each is answered somewhere else: a
|
|
255
|
+
* conditional or nested write is not a plain body statement, a rebinding stops
|
|
256
|
+
* the scan in `rejectWatchCycle`, and a sibling path (`watch form.name:` writing
|
|
257
|
+
* `form.email`) or a different root fails the step comparison here.
|
|
258
|
+
*/
|
|
259
|
+
export function watchSelfWrite(subject, place, statement, writes, position = "at the top of its body") {
|
|
260
|
+
const write = reactiveWriteCandidate(statement);
|
|
261
|
+
if (write === null)
|
|
262
|
+
return null;
|
|
263
|
+
const steps = reactiveStepsBelow(place, write.place);
|
|
264
|
+
if (steps === null || !writes(steps, write.method))
|
|
265
|
+
return null;
|
|
266
|
+
// A derived value is offered only where it could be declared. A field or an
|
|
267
|
+
// element has no `computed` spelling of its own, so naming one would hand the
|
|
268
|
+
// author a line that does not compile.
|
|
269
|
+
const derived = subject.kind === "IdentifierExpression"
|
|
270
|
+
? `declare 'computed ${place.text} = ...' instead`
|
|
271
|
+
: "write this value where it is produced instead";
|
|
272
|
+
const head = steps.length === 0
|
|
273
|
+
? `This watch writes its own subject '${place.text}'`
|
|
274
|
+
: `This watch writes '${write.place.text}', a part of its subject '${place.text}',`;
|
|
275
|
+
return `${head} ${position}, so every run re-triggers it and the runtime stops the loop after 100`
|
|
276
|
+
+ ` rounds; write the condition that ends it, or watch the input this value follows and ${derived}`;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* D114 0.29.0 ST-D2: `finally` is the one nested block a body cannot get out of.
|
|
280
|
+
* §15 refuses a body whose top level *unconditionally* writes its own subject,
|
|
281
|
+
* and "nested" had been standing in for "conditional" — but a `for` body may run
|
|
282
|
+
* zero times, a `try` body may be cut short by a throw and a `match` arm is
|
|
283
|
+
* chosen by data, while every path through a `try` at the body's top level
|
|
284
|
+
* passes through its `finally`. So the write there is proved the same way a
|
|
285
|
+
* top-level write is, and only there: a `try` inside an `if` is a conditional
|
|
286
|
+
* again and stays the runtime cap's (ST-U1).
|
|
287
|
+
*/
|
|
288
|
+
export function finallySelfWrite(subject, place, statement, writes, root) {
|
|
289
|
+
if (statement.kind !== "TryStatement" || statement.finallyBody === null)
|
|
290
|
+
return null;
|
|
291
|
+
for (const inner of statement.finallyBody) {
|
|
292
|
+
if (statementBindsName(inner, root))
|
|
293
|
+
return null;
|
|
294
|
+
const message = watchSelfWrite(subject, place, inner, writes, "in the 'finally' of a 'try' at the top of its body, which every path through the body runs");
|
|
295
|
+
if (message !== null)
|
|
296
|
+
return { message, span: inner.span };
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=watch-cycles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch-cycles.js","sourceRoot":"","sources":["../../src/analysis/watch-cycles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,EACL,yBAAyB,GAK1B,M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AAK,CAAC,IAAI,GAAG;QACrD,CAAC,CAAC,sBAAsB,KAAK,CAAC,KAAK,CAAC,IAAI,6BAA6B,KAAK,CAAC,IAAI,IAAI,CAAC;IACtF,OAAO,GAAG,IAAI,IAAI,QAAQ,wEAAwE;UAC9F,wFAAwF,OAAO,EAAE,CAAC;AACxG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAmB,EACnB,KAAmB,EACnB,SAAoB,EACpB,MAA4B,EAC5B,IAAY;IAEZ,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,IAAI,SAAS,CAAC,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrF,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACjD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAC1D,4FAA4F,CAAC,CAAC;QAChG,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/analyzer.d.ts
CHANGED
|
@@ -71,6 +71,11 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
71
71
|
private readonly webSourceText;
|
|
72
72
|
/** D74: only props whose authors wrote a readonly contract receive prop-specific guidance. */
|
|
73
73
|
private explicitReadonlyPropBindings;
|
|
74
|
+
/** D114 0.29.0 LC-D1: the manifest's `web.publicConfig`, or null when this compile read no project manifest — an empty section is a claim the compile may check, and no manifest is no claim at all. */
|
|
75
|
+
private readonly webPublicConfig;
|
|
76
|
+
private publicConfigNames;
|
|
77
|
+
/** velar/look builder calls this compile refused on their own arguments (D114 0.29.0 LK-I2). */
|
|
78
|
+
private readonly refusedBuilderCalls;
|
|
74
79
|
constructor(context?: AnalysisContext, extensions?: readonly CompilerAnalysisExtension[]);
|
|
75
80
|
analyze(program: Program): readonly Diagnostic[];
|
|
76
81
|
/**
|
|
@@ -98,6 +103,13 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
98
103
|
* `builtinTypeNameDeclarationMessage` in packages/compiler/src/analyzer.ts,
|
|
99
104
|
* reported as VEL3007. The rosters differ; the wording is meant to read
|
|
100
105
|
* alike, so a change to either sentence belongs in both.
|
|
106
|
+
*
|
|
107
|
+
* `Duration` is on both rosters — Core owns it as a primitive and
|
|
108
|
+
* `velar/look` republishes it — so a Web module used to report it twice. This
|
|
109
|
+
* refusal is the more specific of the two, because it names the surface the
|
|
110
|
+
* author is writing against, so it marks the name refused and Core's stays
|
|
111
|
+
* unsaid. The mark is Core's own hook, which is what lets this pass take
|
|
112
|
+
* precedence without either side learning the other's roster.
|
|
101
113
|
*/
|
|
102
114
|
private rejectWebOwnedTypeNames;
|
|
103
115
|
/**
|
|
@@ -149,6 +161,8 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
149
161
|
protected markDeclaredBindingReactive(name: string, kind?: "state" | "prop"): void;
|
|
150
162
|
protected inferExtensionExpression(expression: Expression, _contextualType: ValueType): ValueType | undefined;
|
|
151
163
|
protected inferExpression(expression: Expression, contextualType?: ValueType): ValueType;
|
|
164
|
+
/** Infers one builder slot and parks the answer in the probe cache, so the call's own analysis reads it back. */
|
|
165
|
+
private probedSlotType;
|
|
152
166
|
private writableStateName;
|
|
153
167
|
/**
|
|
154
168
|
* P2b-5: a `def` that answers markup and answers it with a component element.
|
|
@@ -249,6 +263,26 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
249
263
|
* fixed, exactly as two errors on one line are.
|
|
250
264
|
*/
|
|
251
265
|
private rejectWatchCycle;
|
|
266
|
+
/**
|
|
267
|
+
* D114 0.28.0 H-D1: the type of the place `steps` below the watched subject,
|
|
268
|
+
* or null when the walk cannot reach one.
|
|
269
|
+
*
|
|
270
|
+
* Only the steps the reactive graph publishes as part of the subject are
|
|
271
|
+
* walked — a record field and a collection element — because those are the
|
|
272
|
+
* writes a watch on the containing value is woken by. A step that leaves them
|
|
273
|
+
* (a class instance, a capability handle, a field the record does not declare)
|
|
274
|
+
* is not provably part of the subject, and a refusal that must be right every
|
|
275
|
+
* time answers no there rather than guessing.
|
|
276
|
+
*/
|
|
277
|
+
/**
|
|
278
|
+
* Whether a write `steps` below the watched subject, made the given way, is a
|
|
279
|
+
* write of the subject — the one definition both the body scan (VEL5077) and
|
|
280
|
+
* the one-hop writer scan (VEL5079) read. An assignment to a place the walk
|
|
281
|
+
* can reach is a write; a call is one only when the type at that depth is a
|
|
282
|
+
* collection and the call is on its own mutating roster.
|
|
283
|
+
*/
|
|
284
|
+
private watchSubjectWrite;
|
|
285
|
+
private reactivePlaceType;
|
|
252
286
|
/**
|
|
253
287
|
* D89 A4: records `list = list.map(item => {…})`, React's immutable update,
|
|
254
288
|
* where the callback builds a new record rather than changing a field.
|
|
@@ -339,6 +373,15 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
339
373
|
* says so instead of releasing at the wrong moment.
|
|
340
374
|
*/
|
|
341
375
|
protected ownershipScopeRejection(): string | null;
|
|
376
|
+
/**
|
|
377
|
+
* D114 0.29.0 JX-I2: a component body has no function frame, so a `return` nested
|
|
378
|
+
* inside it — in a `match` arm, an `if`, a `for` — used to earn VEL3003 next to
|
|
379
|
+
* VEL5008 ("exactly one top-level return"), two rules its author can only read as
|
|
380
|
+
* contradicting each other. A lifecycle hook and a watch body are inside the same
|
|
381
|
+
* component and are *not* it: neither returns anything, so a `return` there keeps
|
|
382
|
+
* VEL3003.
|
|
383
|
+
*/
|
|
384
|
+
protected extensionOwnsFunctionlessReturn(): boolean;
|
|
342
385
|
protected invalidExtensionAwaitContext(): boolean;
|
|
343
386
|
protected invalidExtensionAwaitMessage(): string | null;
|
|
344
387
|
private componentType;
|
|
@@ -404,6 +447,8 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
404
447
|
private checkAnimateBuilderCall;
|
|
405
448
|
private checkAnimationKeyword;
|
|
406
449
|
private analyzeKeyframes;
|
|
450
|
+
/** Whether a builder call this compile refused on its own arguments lies inside `sourceSpan`. */
|
|
451
|
+
private refusedBuilderCallWithin;
|
|
407
452
|
private reportKeyframeSnapshotReads;
|
|
408
453
|
/**
|
|
409
454
|
* D104 rule 2 — the wider half of the promise VEL5039 already made. A
|
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,UAAU,EAA2C,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClK,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,UAAU,EAA2C,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClK,OAAO,EACL,QAAQ,EAgBR,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AA6GzC,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AAmHnF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gCAAgC,GAAG,SAAS,GAAG,SAAS,CAsLlG;AAw3CD,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,iHAAiH;IACjH,OAAO,CAAC,cAAc,CAAK;IAC3B,4FAA4F;IAC5F,OAAO,CA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