@octanejs/codemod 0.1.4 → 0.2.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 +295 -4
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +162 -0
- package/dist/compiler.d.ts +11 -0
- package/dist/compiler.js +48 -0
- package/dist/effect-receivers.d.ts +11 -0
- package/dist/effect-receivers.js +315 -0
- package/dist/expression-wrappers.d.ts +6 -0
- package/dist/expression-wrappers.js +16 -0
- package/dist/forwarded-props.d.ts +27 -0
- package/dist/forwarded-props.js +489 -0
- package/dist/index.d.ts +6 -0
- package/{src → dist}/index.js +1 -0
- package/dist/linked-state.d.ts +17 -0
- package/dist/linked-state.js +126 -0
- package/dist/local-calls.d.ts +20 -0
- package/dist/local-calls.js +143 -0
- package/dist/local-react-hook.d.ts +15 -0
- package/dist/local-react-hook.js +353 -0
- package/dist/local-uses.d.ts +13 -0
- package/dist/local-uses.js +987 -0
- package/dist/mappings.d.ts +57 -0
- package/dist/mappings.js +343 -0
- package/dist/path-svg.d.ts +60 -0
- package/dist/path-svg.js +207 -0
- package/dist/project.d.ts +9 -0
- package/dist/project.js +1568 -0
- package/dist/react-intl.d.ts +4 -0
- package/dist/react-intl.js +389 -0
- package/dist/react-renderer.d.ts +9 -0
- package/dist/react-renderer.js +106 -0
- package/dist/scoped-signal.d.ts +4 -0
- package/dist/scoped-signal.js +480 -0
- package/dist/scoped-store-contract.d.ts +13 -0
- package/dist/scoped-store-contract.js +741 -0
- package/dist/store-hook-uses.d.ts +18 -0
- package/dist/store-hook-uses.js +403 -0
- package/dist/store-inputs.d.ts +16 -0
- package/dist/store-inputs.js +391 -0
- package/dist/strong.d.ts +24 -0
- package/dist/strong.js +142 -0
- package/dist/transform.d.ts +27 -0
- package/dist/transform.js +4890 -0
- package/dist/types.d.ts +203 -0
- package/dist/types.js +1 -0
- package/package.json +18 -6
- package/src/path-svg.ts +218 -0
- package/templates/octane-path-svg.ts +56 -0
- package/templates/octane-store-context.tsrx +49 -0
- package/templates/octane-store-hooks.ts +61 -0
- package/templates/react-intl.tsrx +116 -0
- package/src/bin.js +0 -151
- package/src/compiler.js +0 -61
- package/src/index.d.ts +0 -95
- package/src/mappings.js +0 -429
- package/src/project.js +0 -738
- package/src/strong.js +0 -149
- package/src/transform.js +0 -3455
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
function visit(node, read) {
|
|
3
|
+
read(node);
|
|
4
|
+
ts.forEachChild(node, (child) => visit(child, read));
|
|
5
|
+
}
|
|
6
|
+
/** A const already initialized in this function, or a parameter it never reassigns. */
|
|
7
|
+
export function fixedBinding(checker, name, read, parameters) {
|
|
8
|
+
const symbol = checker.getSymbolAtLocation(name);
|
|
9
|
+
if (symbol?.declarations?.length !== 1 || !symbol.valueDeclaration)
|
|
10
|
+
return false;
|
|
11
|
+
let declaration = symbol.valueDeclaration;
|
|
12
|
+
while (ts.isBindingElement(declaration))
|
|
13
|
+
declaration = declaration.parent.parent;
|
|
14
|
+
const owner = ts.findAncestor(read, ts.isFunctionLike);
|
|
15
|
+
if (!owner || owner !== ts.findAncestor(declaration, ts.isFunctionLike))
|
|
16
|
+
return false;
|
|
17
|
+
if (ts.isVariableDeclaration(declaration)) {
|
|
18
|
+
return Boolean(declaration.end <= read.getStart() &&
|
|
19
|
+
ts.isVariableDeclarationList(declaration.parent) &&
|
|
20
|
+
declaration.parent.flags & ts.NodeFlags.Const);
|
|
21
|
+
}
|
|
22
|
+
if (!ts.isParameter(declaration))
|
|
23
|
+
return false;
|
|
24
|
+
const known = parameters?.get(symbol);
|
|
25
|
+
if (known !== undefined)
|
|
26
|
+
return known;
|
|
27
|
+
let fixed = true;
|
|
28
|
+
visit(owner, (node) => {
|
|
29
|
+
if (ts.isIdentifier(node) && node.text === 'eval')
|
|
30
|
+
fixed = false;
|
|
31
|
+
let target;
|
|
32
|
+
if (ts.isBinaryExpression(node) &&
|
|
33
|
+
node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
34
|
+
node.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
|
|
35
|
+
target = node.left;
|
|
36
|
+
if ((ts.isPostfixUnaryExpression(node) || ts.isPrefixUnaryExpression(node)) &&
|
|
37
|
+
(node.operator === ts.SyntaxKind.PlusPlusToken ||
|
|
38
|
+
node.operator === ts.SyntaxKind.MinusMinusToken))
|
|
39
|
+
target = node.operand;
|
|
40
|
+
if (ts.isForInStatement(node) || ts.isForOfStatement(node))
|
|
41
|
+
target = node.initializer;
|
|
42
|
+
if (target && !ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) {
|
|
43
|
+
visit(target, (name) => {
|
|
44
|
+
if (!ts.isIdentifier(name))
|
|
45
|
+
return;
|
|
46
|
+
const ref = ts.isShorthandPropertyAssignment(name.parent)
|
|
47
|
+
? checker.getShorthandAssignmentValueSymbol(name.parent)
|
|
48
|
+
: checker.getSymbolAtLocation(name);
|
|
49
|
+
if (ref === symbol)
|
|
50
|
+
fixed = false;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
parameters?.set(symbol, fixed);
|
|
55
|
+
return fixed;
|
|
56
|
+
}
|
|
57
|
+
/** An identifier moved past a getter must already be initialized, even across switch cases. */
|
|
58
|
+
export function initializedBefore(checker, name, call) {
|
|
59
|
+
let declaration = checker.getSymbolAtLocation(name)?.valueDeclaration;
|
|
60
|
+
while (declaration && ts.isBindingElement(declaration))
|
|
61
|
+
declaration = declaration.parent.parent;
|
|
62
|
+
if (!declaration)
|
|
63
|
+
return false;
|
|
64
|
+
if (ts.isParameter(declaration))
|
|
65
|
+
return true;
|
|
66
|
+
const statement = declaration.parent.parent;
|
|
67
|
+
return (ts.isVariableStatement(statement) &&
|
|
68
|
+
ts.isBlock(statement.parent) &&
|
|
69
|
+
statement.end <= call.getStart() &&
|
|
70
|
+
!!ts.findAncestor(call, (n) => n === statement.parent));
|
|
71
|
+
}
|
|
72
|
+
/** Keep calls to ref-only helpers at their original effect, event or cleanup phase. */
|
|
73
|
+
function effectHelpers(body, checker, reactHook, uses, emit) {
|
|
74
|
+
const effect = body.parent.parent;
|
|
75
|
+
const scope = effect.parent.parent;
|
|
76
|
+
const destination = body.statements[0];
|
|
77
|
+
if (!destination ||
|
|
78
|
+
!ts.isExpressionStatement(effect.parent) ||
|
|
79
|
+
!ts.isBlock(scope) ||
|
|
80
|
+
!ts.isFunctionLike(scope.parent))
|
|
81
|
+
return [];
|
|
82
|
+
const helpers = new Set();
|
|
83
|
+
visit(body, (node) => {
|
|
84
|
+
if (!ts.isCallExpression(node) || !ts.isIdentifier(node.expression))
|
|
85
|
+
return;
|
|
86
|
+
const decl = checker.getSymbolAtLocation(node.expression)?.valueDeclaration;
|
|
87
|
+
if (decl &&
|
|
88
|
+
ts.isVariableDeclaration(decl) &&
|
|
89
|
+
!decl.type &&
|
|
90
|
+
ts.isVariableDeclarationList(decl.parent) &&
|
|
91
|
+
decl.parent.declarations.length === 1 &&
|
|
92
|
+
decl.parent.flags & ts.NodeFlags.Const &&
|
|
93
|
+
ts.isVariableStatement(decl.parent.parent) &&
|
|
94
|
+
decl.parent.parent.parent === scope &&
|
|
95
|
+
decl.end < effect.getStart() &&
|
|
96
|
+
decl.initializer &&
|
|
97
|
+
ts.isArrowFunction(decl.initializer))
|
|
98
|
+
helpers.add(decl);
|
|
99
|
+
});
|
|
100
|
+
const declarations = [];
|
|
101
|
+
for (const decl of helpers) {
|
|
102
|
+
const arrow = decl.initializer;
|
|
103
|
+
if (!ts.isIdentifier(decl.name) ||
|
|
104
|
+
arrow.modifiers?.length ||
|
|
105
|
+
arrow.typeParameters?.length ||
|
|
106
|
+
arrow.parameters.some((p) => !ts.isIdentifier(p.name) || p.initializer || p.dotDotDotToken) ||
|
|
107
|
+
checker.resolveName(decl.name.text, destination, ts.SymbolFlags.Value, false) !==
|
|
108
|
+
checker.getSymbolAtLocation(decl.name))
|
|
109
|
+
continue;
|
|
110
|
+
const refs = uses(decl.name);
|
|
111
|
+
const inside = refs.filter((ref) => ref.pos >= body.pos && ref.end <= body.end);
|
|
112
|
+
if (!refs.some((ref) => (ref.pos < body.pos || ref.end > body.end) &&
|
|
113
|
+
ts.isCallExpression(ref.parent) &&
|
|
114
|
+
ref.parent.expression === ref) ||
|
|
115
|
+
!inside.length ||
|
|
116
|
+
!inside.every((ref) => ts.isCallExpression(ref.parent) &&
|
|
117
|
+
ref.parent.expression === ref &&
|
|
118
|
+
!ref.parent.questionDotToken))
|
|
119
|
+
continue;
|
|
120
|
+
let readsRef = false;
|
|
121
|
+
let safe = true;
|
|
122
|
+
visit(arrow, (node) => {
|
|
123
|
+
if (!safe)
|
|
124
|
+
return;
|
|
125
|
+
if (ts.isTaggedTemplateExpression(node) ||
|
|
126
|
+
ts.isJsxOpeningLikeElement(node) ||
|
|
127
|
+
ts.isJsxFragment(node) ||
|
|
128
|
+
ts.isClassLike(node) ||
|
|
129
|
+
ts.isMetaProperty(node) ||
|
|
130
|
+
ts.isTypeQueryNode(node) ||
|
|
131
|
+
node.kind === ts.SyntaxKind.ThisKeyword ||
|
|
132
|
+
node.kind === ts.SyntaxKind.SuperKeyword)
|
|
133
|
+
safe = false;
|
|
134
|
+
if (!ts.isIdentifier(node))
|
|
135
|
+
return;
|
|
136
|
+
if (node.text === 'eval' ||
|
|
137
|
+
node.text === 'arguments' ||
|
|
138
|
+
/^use(?:[A-Z0-9]|$)/.test(node.text)) {
|
|
139
|
+
safe = false;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const parent = node.parent;
|
|
143
|
+
if (((ts.isPropertyAccessExpression(parent) || ts.isPropertyAssignment(parent)) &&
|
|
144
|
+
parent.name === node) ||
|
|
145
|
+
(ts.isQualifiedName(parent) && parent.right === node))
|
|
146
|
+
return;
|
|
147
|
+
const type = ts.isPartOfTypeNode(node);
|
|
148
|
+
const flags = type ? ts.SymbolFlags.Type | ts.SymbolFlags.Namespace : ts.SymbolFlags.Value;
|
|
149
|
+
const captured = checker.resolveName(node.text, node, flags, false);
|
|
150
|
+
if (captured?.declarations?.some((d) => d.getSourceFile() === arrow.getSourceFile() && d.pos >= arrow.pos && d.end <= arrow.end))
|
|
151
|
+
return;
|
|
152
|
+
if (checker.resolveName(node.text, destination, flags, false) !== captured) {
|
|
153
|
+
safe = false;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (type || !captured)
|
|
157
|
+
return;
|
|
158
|
+
const binding = captured.valueDeclaration;
|
|
159
|
+
if (binding &&
|
|
160
|
+
ts.isVariableDeclaration(binding) &&
|
|
161
|
+
binding.parent.parent.parent === scope &&
|
|
162
|
+
ts.isVariableDeclarationList(binding.parent) &&
|
|
163
|
+
binding.parent.flags & ts.NodeFlags.Const &&
|
|
164
|
+
binding.end <= effect.getStart() &&
|
|
165
|
+
binding.initializer &&
|
|
166
|
+
ts.isCallExpression(binding.initializer) &&
|
|
167
|
+
reactHook(binding.initializer.expression) === 'useRef' &&
|
|
168
|
+
ts.isPropertyAccessExpression(parent) &&
|
|
169
|
+
parent.expression === node &&
|
|
170
|
+
parent.name.text === 'current') {
|
|
171
|
+
readsRef = true;
|
|
172
|
+
}
|
|
173
|
+
else if (captured.declarations?.some((d) => d.getSourceFile() === arrow.getSourceFile()))
|
|
174
|
+
safe = false;
|
|
175
|
+
});
|
|
176
|
+
if (safe && readsRef)
|
|
177
|
+
declarations.push(`const ${decl.name.text} = ${emit(arrow)};`);
|
|
178
|
+
}
|
|
179
|
+
return declarations;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* An explicit [owner] observes object identity even when the callback reads
|
|
183
|
+
* owner.value or calls owner.method(). Read the binding inside the callback
|
|
184
|
+
* and leave property accesses where React executed them, including cleanup.
|
|
185
|
+
*/
|
|
186
|
+
export function effectReceivers(callback, checker, reactHook, aliases, snapshot, bridgeLayout, helperUses, emitHelper) {
|
|
187
|
+
const { body } = callback;
|
|
188
|
+
if (callback.parameters.length ||
|
|
189
|
+
(ts.isBlock(body) &&
|
|
190
|
+
body.statements.length &&
|
|
191
|
+
ts.isExpressionStatement(body.statements[0]) &&
|
|
192
|
+
ts.isStringLiteral(body.statements[0].expression)))
|
|
193
|
+
return [];
|
|
194
|
+
const call = callback.parent;
|
|
195
|
+
if (!ts.isCallExpression(call))
|
|
196
|
+
return [];
|
|
197
|
+
const hook = reactHook(call.expression);
|
|
198
|
+
const imperative = hook === 'useImperativeHandle';
|
|
199
|
+
const callbackIndex = imperative ? 1 : 0;
|
|
200
|
+
if ((!imperative && !['useEffect', 'useLayoutEffect', 'useInsertionEffect'].includes(hook ?? '')) ||
|
|
201
|
+
call.arguments.length !== callbackIndex + 2 ||
|
|
202
|
+
call.arguments[callbackIndex] !== callback ||
|
|
203
|
+
(imperative && ts.isSpreadElement(call.arguments[0])))
|
|
204
|
+
return [];
|
|
205
|
+
const deps = call.arguments[callbackIndex + 1];
|
|
206
|
+
if (!ts.isArrayLiteralExpression(deps))
|
|
207
|
+
return [];
|
|
208
|
+
const identifiers = deps.elements.filter(ts.isIdentifier);
|
|
209
|
+
const hasProperties = identifiers.length !== deps.elements.length;
|
|
210
|
+
// A property snapshot would run before the imperative handle evaluates its ref.
|
|
211
|
+
if (hasProperties && (imperative || !snapshot))
|
|
212
|
+
return [];
|
|
213
|
+
const names = new Set();
|
|
214
|
+
const members = new Map();
|
|
215
|
+
visit(body, (node) => {
|
|
216
|
+
if (ts.isIdentifier(node))
|
|
217
|
+
names.add(node.text);
|
|
218
|
+
if ((!ts.isPropertyAccessExpression(node) && !ts.isElementAccessExpression(node)) ||
|
|
219
|
+
!ts.isIdentifier(node.expression))
|
|
220
|
+
return;
|
|
221
|
+
const receiver = node.expression;
|
|
222
|
+
const symbol = checker.getSymbolAtLocation(receiver);
|
|
223
|
+
if (!symbol)
|
|
224
|
+
return;
|
|
225
|
+
const uses = members.get(symbol) ?? [];
|
|
226
|
+
uses.push(receiver);
|
|
227
|
+
members.set(symbol, uses);
|
|
228
|
+
});
|
|
229
|
+
if (names.has('eval') || !identifiers.every((dep) => fixedBinding(checker, dep, call)))
|
|
230
|
+
return [];
|
|
231
|
+
if (helperUses &&
|
|
232
|
+
emitHelper &&
|
|
233
|
+
!deps.elements.length &&
|
|
234
|
+
ts.isBlock(body) &&
|
|
235
|
+
!call.questionDotToken &&
|
|
236
|
+
(hook === 'useEffect' || hook === 'useLayoutEffect'))
|
|
237
|
+
return effectHelpers(body, checker, reactHook, helperUses, emitHelper);
|
|
238
|
+
const declarations = [];
|
|
239
|
+
if (hasProperties) {
|
|
240
|
+
const properties = deps.elements.filter(ts.isPropertyAccessExpression);
|
|
241
|
+
const statement = call.parent;
|
|
242
|
+
if (!snapshot ||
|
|
243
|
+
properties.length + identifiers.length !== deps.elements.length ||
|
|
244
|
+
!ts.isIdentifier(call.expression) ||
|
|
245
|
+
call.questionDotToken ||
|
|
246
|
+
!ts.isExpressionStatement(statement) ||
|
|
247
|
+
!ts.isBlock(statement.parent) ||
|
|
248
|
+
!identifiers.every((dep) => initializedBefore(checker, dep, call)))
|
|
249
|
+
return [];
|
|
250
|
+
// Preserve statement directives and comments around the dependency list.
|
|
251
|
+
const source = body.getSourceFile().text;
|
|
252
|
+
if (/\/[/*]/.test(source.slice(statement.pos, body.getStart()) + source.slice(body.end, statement.end)))
|
|
253
|
+
return [];
|
|
254
|
+
const parameters = new Map();
|
|
255
|
+
const canBridgeLayout = bridgeLayout &&
|
|
256
|
+
hook === 'useLayoutEffect' &&
|
|
257
|
+
!callback.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword);
|
|
258
|
+
let layoutEvent = false;
|
|
259
|
+
for (const property of properties) {
|
|
260
|
+
let root = property;
|
|
261
|
+
while (ts.isPropertyAccessExpression(root) && ts.isIdentifier(root.name))
|
|
262
|
+
root = root.expression;
|
|
263
|
+
if (!ts.isIdentifier(root) || !fixedBinding(checker, root, call, parameters))
|
|
264
|
+
return [];
|
|
265
|
+
if (names.has(root.text)) {
|
|
266
|
+
const symbol = checker.getSymbolAtLocation(root);
|
|
267
|
+
if (!canBridgeLayout || !symbol || !members.has(symbol))
|
|
268
|
+
return [];
|
|
269
|
+
layoutEvent = true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Accessors observe the order and multiplicity of the original render-time reads.
|
|
273
|
+
for (const [index, property] of properties.entries()) {
|
|
274
|
+
let name = 'effectDependency' + (index + 1);
|
|
275
|
+
while (names.has(name) || checker.resolveName(name, call, ts.SymbolFlags.Value, false))
|
|
276
|
+
name += '_';
|
|
277
|
+
names.add(name);
|
|
278
|
+
snapshot(statement, property, name);
|
|
279
|
+
declarations.push(`void ${name};`);
|
|
280
|
+
}
|
|
281
|
+
if (layoutEvent && bridgeLayout) {
|
|
282
|
+
// Run the latest committed setup at layout time, including after Activity reconnects.
|
|
283
|
+
let name = 'runLayoutEffect';
|
|
284
|
+
while (names.has(name) || checker.resolveName(name, call, ts.SymbolFlags.Value, false))
|
|
285
|
+
name += '_';
|
|
286
|
+
bridgeLayout(statement, name);
|
|
287
|
+
for (const { text } of identifiers)
|
|
288
|
+
declarations.push(`void ${text};`);
|
|
289
|
+
declarations.push(`return ${name}();`);
|
|
290
|
+
return declarations;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// An otherwise unused dependency can intentionally restart the effect.
|
|
294
|
+
for (const { text } of identifiers) {
|
|
295
|
+
if (names.has(text))
|
|
296
|
+
continue;
|
|
297
|
+
declarations.push(`void ${text};`);
|
|
298
|
+
names.add(text);
|
|
299
|
+
}
|
|
300
|
+
for (const dep of identifiers) {
|
|
301
|
+
const symbol = checker.getSymbolAtLocation(dep);
|
|
302
|
+
const uses = symbol && members.get(symbol);
|
|
303
|
+
if (!uses)
|
|
304
|
+
continue;
|
|
305
|
+
let alias = 'current' + dep.text[0].toUpperCase() + dep.text.slice(1);
|
|
306
|
+
while (names.has(alias))
|
|
307
|
+
alias += 'Value';
|
|
308
|
+
names.add(alias);
|
|
309
|
+
for (const use of uses)
|
|
310
|
+
aliases.set(use, alias);
|
|
311
|
+
members.delete(symbol);
|
|
312
|
+
declarations.push(`const ${alias} = ${dep.text};`);
|
|
313
|
+
}
|
|
314
|
+
return declarations;
|
|
315
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `node` wraps an expression only for grouping or the type checker.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isWrapper(node: ts.Node): node is ts.ParenthesizedExpression | ts.AsExpression | ts.SatisfiesExpression | ts.NonNullExpression | ts.TypeAssertion;
|
|
6
|
+
export declare function skipWrappers(node: ts.Expression): ts.Expression;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `node` wraps an expression only for grouping or the type checker.
|
|
4
|
+
*/
|
|
5
|
+
export function isWrapper(node) {
|
|
6
|
+
return (ts.isParenthesizedExpression(node) ||
|
|
7
|
+
ts.isAsExpression(node) ||
|
|
8
|
+
ts.isSatisfiesExpression(node) ||
|
|
9
|
+
ts.isNonNullExpression(node) ||
|
|
10
|
+
ts.isTypeAssertionExpression(node));
|
|
11
|
+
}
|
|
12
|
+
export function skipWrappers(node) {
|
|
13
|
+
while (isWrapper(node))
|
|
14
|
+
node = node.expression;
|
|
15
|
+
return node;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { localUses } from './local-uses.js';
|
|
3
|
+
export declare function contains(node: ts.Node, matches: (node: ts.Node) => boolean): boolean;
|
|
4
|
+
export declare function hasEval(file: ts.SourceFile): boolean;
|
|
5
|
+
export declare function hasPrototypeAccess(file: ts.SourceFile): boolean;
|
|
6
|
+
export declare function renderUses(refs: ts.Identifier[]): ts.Identifier[];
|
|
7
|
+
type RenderTypes = {
|
|
8
|
+
typeOf: (node: ts.Node) => ts.Type;
|
|
9
|
+
text: (node: ts.Node) => boolean;
|
|
10
|
+
};
|
|
11
|
+
/** Follow the value being rendered all the way to its containing component's return. */
|
|
12
|
+
export declare function nativeOutputOwner(value: ts.Node, slot: (tag: ts.Identifier, prop: string) => boolean, { typeOf, text }: RenderTypes): ts.ArrowFunction | ts.FunctionDeclaration | ts.FunctionExpression | undefined;
|
|
13
|
+
export declare function literalJsxAttribute(attr: ts.JsxAttributeLike): boolean;
|
|
14
|
+
/** Follow one stored SVG value to its only runtime read, inside the same component body. */
|
|
15
|
+
export declare function svgLocalReads(checker: ts.TypeChecker, uses: ReturnType<typeof localUses>, typeOf: RenderTypes['typeOf'], reactNode: (annotation: ts.TypeNode) => boolean): (element: ts.JsxSelfClosingElement) => ts.Identifier | undefined;
|
|
16
|
+
/** The returned native tree must own the element before its props can reach another renderer. */
|
|
17
|
+
export declare function returnedTextReceiver(tag: ts.JsxOpeningLikeElement, types: RenderTypes, uses: ReturnType<typeof localUses>): ts.FunctionDeclaration | undefined;
|
|
18
|
+
/** A competing prop, custom element, or spread can change which receiver observes the value. */
|
|
19
|
+
export declare function closedForwardedAttribute(attr: ts.JsxAttribute): boolean;
|
|
20
|
+
type TextPath = RenderTypes & {
|
|
21
|
+
next?: (module: string, name: string, prop: string) => boolean;
|
|
22
|
+
};
|
|
23
|
+
/** Prove where a selected component delivers every reference to an incoming prop. */
|
|
24
|
+
export declare function forwardedProps(file: ts.SourceFile, checker: ts.TypeChecker, destination: 'text' | (RenderTypes & {
|
|
25
|
+
imported?: (module: string, name: string, prop: string, depth: number) => boolean;
|
|
26
|
+
}), uses?: (id: ts.Identifier) => ts.Identifier[], ordinaryProps?: boolean, textPath?: TextPath): (symbol: ts.Symbol | undefined, prop: string, ordinaryCaller?: boolean, depth?: number) => boolean;
|
|
27
|
+
export {};
|