babel-plugin-react-compiler 19.0.0-beta-e1e972c-20250221 → 19.0.0-beta-bafa41b-20250307
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/index.d.ts +1551 -0
- package/dist/index.js +6237 -9824
- package/package.json +3 -3
- package/dist/index.js.map +0 -7
package/dist/index.d.ts
ADDED
@@ -0,0 +1,1551 @@
|
|
1
|
+
import * as BabelCore from '@babel/core';
|
2
|
+
import { NodePath as NodePath$1 } from '@babel/core';
|
3
|
+
import * as t from '@babel/types';
|
4
|
+
import { z } from 'zod';
|
5
|
+
import { Scope, NodePath } from '@babel/traverse';
|
6
|
+
|
7
|
+
type BuiltInType = PrimitiveType | FunctionType | ObjectType;
|
8
|
+
type Type = BuiltInType | PhiType | TypeVar | PolyType | PropType | ObjectMethod$1;
|
9
|
+
type PrimitiveType = {
|
10
|
+
kind: 'Primitive';
|
11
|
+
};
|
12
|
+
type FunctionType = {
|
13
|
+
kind: 'Function';
|
14
|
+
shapeId: string | null;
|
15
|
+
return: Type;
|
16
|
+
};
|
17
|
+
type ObjectType = {
|
18
|
+
kind: 'Object';
|
19
|
+
shapeId: string | null;
|
20
|
+
};
|
21
|
+
type TypeVar = {
|
22
|
+
kind: 'Type';
|
23
|
+
id: TypeId;
|
24
|
+
};
|
25
|
+
type PolyType = {
|
26
|
+
kind: 'Poly';
|
27
|
+
};
|
28
|
+
type PhiType = {
|
29
|
+
kind: 'Phi';
|
30
|
+
operands: Array<Type>;
|
31
|
+
};
|
32
|
+
type PropType = {
|
33
|
+
kind: 'Property';
|
34
|
+
objectType: Type;
|
35
|
+
objectName: string;
|
36
|
+
propertyName: PropertyLiteral;
|
37
|
+
};
|
38
|
+
type ObjectMethod$1 = {
|
39
|
+
kind: 'ObjectMethod';
|
40
|
+
};
|
41
|
+
declare const opaqueTypeId: unique symbol;
|
42
|
+
type TypeId = number & {
|
43
|
+
[opaqueTypeId]: 'IdentifierId';
|
44
|
+
};
|
45
|
+
|
46
|
+
type HookKind = 'useContext' | 'useState' | 'useActionState' | 'useReducer' | 'useRef' | 'useEffect' | 'useLayoutEffect' | 'useInsertionEffect' | 'useMemo' | 'useCallback' | 'useTransition' | 'useImperativeHandle' | 'Custom';
|
47
|
+
type FunctionSignature = {
|
48
|
+
positionalParams: Array<Effect>;
|
49
|
+
restParam: Effect | null;
|
50
|
+
returnType: BuiltInType | PolyType;
|
51
|
+
returnValueKind: ValueKind;
|
52
|
+
returnValueReason?: ValueReason;
|
53
|
+
calleeEffect: Effect;
|
54
|
+
hookKind: HookKind | null;
|
55
|
+
noAlias?: boolean;
|
56
|
+
mutableOnlyIfOperandsAreMutable?: boolean;
|
57
|
+
impure?: boolean;
|
58
|
+
canonicalName?: string;
|
59
|
+
};
|
60
|
+
|
61
|
+
type Global = BuiltInType | PolyType;
|
62
|
+
|
63
|
+
declare const ExternalFunctionSchema: z.ZodObject<{
|
64
|
+
source: z.ZodString;
|
65
|
+
importSpecifierName: z.ZodString;
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
67
|
+
source: string;
|
68
|
+
importSpecifierName: string;
|
69
|
+
}, {
|
70
|
+
source: string;
|
71
|
+
importSpecifierName: string;
|
72
|
+
}>;
|
73
|
+
type ExternalFunction = z.infer<typeof ExternalFunctionSchema>;
|
74
|
+
declare const HookSchema: z.ZodObject<{
|
75
|
+
effectKind: z.ZodNativeEnum<typeof Effect>;
|
76
|
+
valueKind: z.ZodNativeEnum<typeof ValueKind>;
|
77
|
+
noAlias: z.ZodDefault<z.ZodBoolean>;
|
78
|
+
transitiveMixedData: z.ZodDefault<z.ZodBoolean>;
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
80
|
+
noAlias: boolean;
|
81
|
+
effectKind: Effect;
|
82
|
+
valueKind: ValueKind;
|
83
|
+
transitiveMixedData: boolean;
|
84
|
+
}, {
|
85
|
+
effectKind: Effect;
|
86
|
+
valueKind: ValueKind;
|
87
|
+
noAlias?: boolean | undefined;
|
88
|
+
transitiveMixedData?: boolean | undefined;
|
89
|
+
}>;
|
90
|
+
type Hook = z.infer<typeof HookSchema>;
|
91
|
+
declare const EnvironmentConfigSchema: z.ZodObject<{
|
92
|
+
customHooks: z.ZodDefault<z.ZodMap<z.ZodString, z.ZodObject<{
|
93
|
+
effectKind: z.ZodNativeEnum<typeof Effect>;
|
94
|
+
valueKind: z.ZodNativeEnum<typeof ValueKind>;
|
95
|
+
noAlias: z.ZodDefault<z.ZodBoolean>;
|
96
|
+
transitiveMixedData: z.ZodDefault<z.ZodBoolean>;
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
98
|
+
noAlias: boolean;
|
99
|
+
effectKind: Effect;
|
100
|
+
valueKind: ValueKind;
|
101
|
+
transitiveMixedData: boolean;
|
102
|
+
}, {
|
103
|
+
effectKind: Effect;
|
104
|
+
valueKind: ValueKind;
|
105
|
+
noAlias?: boolean | undefined;
|
106
|
+
transitiveMixedData?: boolean | undefined;
|
107
|
+
}>>>;
|
108
|
+
moduleTypeProvider: z.ZodDefault<z.ZodNullable<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodUnknown>>>;
|
109
|
+
customMacros: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
110
|
+
type: z.ZodLiteral<"wildcard">;
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
112
|
+
type: "wildcard";
|
113
|
+
}, {
|
114
|
+
type: "wildcard";
|
115
|
+
}>, z.ZodObject<{
|
116
|
+
type: z.ZodLiteral<"name">;
|
117
|
+
name: z.ZodString;
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
119
|
+
type: "name";
|
120
|
+
name: string;
|
121
|
+
}, {
|
122
|
+
type: "name";
|
123
|
+
name: string;
|
124
|
+
}>]>, "many">], null>]>, "many">>>;
|
125
|
+
enableResetCacheOnSourceFileChanges: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
|
126
|
+
enablePreserveExistingMemoizationGuarantees: z.ZodDefault<z.ZodBoolean>;
|
127
|
+
validatePreserveExistingMemoizationGuarantees: z.ZodDefault<z.ZodBoolean>;
|
128
|
+
enablePreserveExistingManualUseMemo: z.ZodDefault<z.ZodBoolean>;
|
129
|
+
enableForest: z.ZodDefault<z.ZodBoolean>;
|
130
|
+
enableUseTypeAnnotations: z.ZodDefault<z.ZodBoolean>;
|
131
|
+
enableOptionalDependencies: z.ZodDefault<z.ZodBoolean>;
|
132
|
+
enableFire: z.ZodDefault<z.ZodBoolean>;
|
133
|
+
inferEffectDependencies: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
134
|
+
function: z.ZodObject<{
|
135
|
+
source: z.ZodString;
|
136
|
+
importSpecifierName: z.ZodString;
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
138
|
+
source: string;
|
139
|
+
importSpecifierName: string;
|
140
|
+
}, {
|
141
|
+
source: string;
|
142
|
+
importSpecifierName: string;
|
143
|
+
}>;
|
144
|
+
numRequiredArgs: z.ZodNumber;
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
146
|
+
function: {
|
147
|
+
source: string;
|
148
|
+
importSpecifierName: string;
|
149
|
+
};
|
150
|
+
numRequiredArgs: number;
|
151
|
+
}, {
|
152
|
+
function: {
|
153
|
+
source: string;
|
154
|
+
importSpecifierName: string;
|
155
|
+
};
|
156
|
+
numRequiredArgs: number;
|
157
|
+
}>, "many">>>;
|
158
|
+
inlineJsxTransform: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
159
|
+
elementSymbol: z.ZodUnion<[z.ZodLiteral<"react.element">, z.ZodLiteral<"react.transitional.element">]>;
|
160
|
+
globalDevVar: z.ZodString;
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
162
|
+
elementSymbol: "react.element" | "react.transitional.element";
|
163
|
+
globalDevVar: string;
|
164
|
+
}, {
|
165
|
+
elementSymbol: "react.element" | "react.transitional.element";
|
166
|
+
globalDevVar: string;
|
167
|
+
}>>>;
|
168
|
+
validateHooksUsage: z.ZodDefault<z.ZodBoolean>;
|
169
|
+
validateRefAccessDuringRender: z.ZodDefault<z.ZodBoolean>;
|
170
|
+
validateNoSetStateInRender: z.ZodDefault<z.ZodBoolean>;
|
171
|
+
validateNoSetStateInPassiveEffects: z.ZodDefault<z.ZodBoolean>;
|
172
|
+
validateNoJSXInTryStatements: z.ZodDefault<z.ZodBoolean>;
|
173
|
+
validateMemoizedEffectDependencies: z.ZodDefault<z.ZodBoolean>;
|
174
|
+
validateNoCapitalizedCalls: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
175
|
+
validateBlocklistedImports: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
176
|
+
validateNoImpureFunctionsInRender: z.ZodDefault<z.ZodBoolean>;
|
177
|
+
enableAssumeHooksFollowRulesOfReact: z.ZodDefault<z.ZodBoolean>;
|
178
|
+
enableTransitivelyFreezeFunctionExpressions: z.ZodDefault<z.ZodBoolean>;
|
179
|
+
enableEmitFreeze: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
180
|
+
source: z.ZodString;
|
181
|
+
importSpecifierName: z.ZodString;
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
183
|
+
source: string;
|
184
|
+
importSpecifierName: string;
|
185
|
+
}, {
|
186
|
+
source: string;
|
187
|
+
importSpecifierName: string;
|
188
|
+
}>>>;
|
189
|
+
enableEmitHookGuards: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
190
|
+
source: z.ZodString;
|
191
|
+
importSpecifierName: z.ZodString;
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
193
|
+
source: string;
|
194
|
+
importSpecifierName: string;
|
195
|
+
}, {
|
196
|
+
source: string;
|
197
|
+
importSpecifierName: string;
|
198
|
+
}>>>;
|
199
|
+
enableInstructionReordering: z.ZodDefault<z.ZodBoolean>;
|
200
|
+
enableFunctionOutlining: z.ZodDefault<z.ZodBoolean>;
|
201
|
+
enableJsxOutlining: z.ZodDefault<z.ZodBoolean>;
|
202
|
+
enableEmitInstrumentForget: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodObject<{
|
203
|
+
fn: z.ZodObject<{
|
204
|
+
source: z.ZodString;
|
205
|
+
importSpecifierName: z.ZodString;
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
207
|
+
source: string;
|
208
|
+
importSpecifierName: string;
|
209
|
+
}, {
|
210
|
+
source: string;
|
211
|
+
importSpecifierName: string;
|
212
|
+
}>;
|
213
|
+
gating: z.ZodNullable<z.ZodObject<{
|
214
|
+
source: z.ZodString;
|
215
|
+
importSpecifierName: z.ZodString;
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
217
|
+
source: string;
|
218
|
+
importSpecifierName: string;
|
219
|
+
}, {
|
220
|
+
source: string;
|
221
|
+
importSpecifierName: string;
|
222
|
+
}>>;
|
223
|
+
globalGating: z.ZodNullable<z.ZodString>;
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
225
|
+
fn: {
|
226
|
+
source: string;
|
227
|
+
importSpecifierName: string;
|
228
|
+
};
|
229
|
+
gating: {
|
230
|
+
source: string;
|
231
|
+
importSpecifierName: string;
|
232
|
+
} | null;
|
233
|
+
globalGating: string | null;
|
234
|
+
}, {
|
235
|
+
fn: {
|
236
|
+
source: string;
|
237
|
+
importSpecifierName: string;
|
238
|
+
};
|
239
|
+
gating: {
|
240
|
+
source: string;
|
241
|
+
importSpecifierName: string;
|
242
|
+
} | null;
|
243
|
+
globalGating: string | null;
|
244
|
+
}>, {
|
245
|
+
fn: {
|
246
|
+
source: string;
|
247
|
+
importSpecifierName: string;
|
248
|
+
};
|
249
|
+
gating: {
|
250
|
+
source: string;
|
251
|
+
importSpecifierName: string;
|
252
|
+
} | null;
|
253
|
+
globalGating: string | null;
|
254
|
+
}, {
|
255
|
+
fn: {
|
256
|
+
source: string;
|
257
|
+
importSpecifierName: string;
|
258
|
+
};
|
259
|
+
gating: {
|
260
|
+
source: string;
|
261
|
+
importSpecifierName: string;
|
262
|
+
} | null;
|
263
|
+
globalGating: string | null;
|
264
|
+
}>>>;
|
265
|
+
assertValidMutableRanges: z.ZodDefault<z.ZodBoolean>;
|
266
|
+
enableChangeVariableCodegen: z.ZodDefault<z.ZodBoolean>;
|
267
|
+
enableMemoizationComments: z.ZodDefault<z.ZodBoolean>;
|
268
|
+
throwUnknownException__testonly: z.ZodDefault<z.ZodBoolean>;
|
269
|
+
enableTreatFunctionDepsAsConditional: z.ZodDefault<z.ZodBoolean>;
|
270
|
+
disableMemoizationForDebugging: z.ZodDefault<z.ZodBoolean>;
|
271
|
+
enableMinimalTransformsForRetry: z.ZodDefault<z.ZodBoolean>;
|
272
|
+
enableChangeDetectionForDebugging: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
273
|
+
source: z.ZodString;
|
274
|
+
importSpecifierName: z.ZodString;
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
276
|
+
source: string;
|
277
|
+
importSpecifierName: string;
|
278
|
+
}, {
|
279
|
+
source: string;
|
280
|
+
importSpecifierName: string;
|
281
|
+
}>>>;
|
282
|
+
enableCustomTypeDefinitionForReanimated: z.ZodDefault<z.ZodBoolean>;
|
283
|
+
hookPattern: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
284
|
+
enableTreatRefLikeIdentifiersAsRefs: z.ZodDefault<z.ZodBoolean>;
|
285
|
+
lowerContextAccess: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
286
|
+
source: z.ZodString;
|
287
|
+
importSpecifierName: z.ZodString;
|
288
|
+
}, "strip", z.ZodTypeAny, {
|
289
|
+
source: string;
|
290
|
+
importSpecifierName: string;
|
291
|
+
}, {
|
292
|
+
source: string;
|
293
|
+
importSpecifierName: string;
|
294
|
+
}>>>;
|
295
|
+
}, "strip", z.ZodTypeAny, {
|
296
|
+
customHooks: Map<string, {
|
297
|
+
noAlias: boolean;
|
298
|
+
effectKind: Effect;
|
299
|
+
valueKind: ValueKind;
|
300
|
+
transitiveMixedData: boolean;
|
301
|
+
}>;
|
302
|
+
moduleTypeProvider: ((args_0: string, ...args_1: unknown[]) => unknown) | null;
|
303
|
+
customMacros: (string | [string, ({
|
304
|
+
type: "wildcard";
|
305
|
+
} | {
|
306
|
+
type: "name";
|
307
|
+
name: string;
|
308
|
+
})[]])[] | null;
|
309
|
+
enableResetCacheOnSourceFileChanges: boolean | null;
|
310
|
+
enablePreserveExistingMemoizationGuarantees: boolean;
|
311
|
+
validatePreserveExistingMemoizationGuarantees: boolean;
|
312
|
+
enablePreserveExistingManualUseMemo: boolean;
|
313
|
+
enableForest: boolean;
|
314
|
+
enableUseTypeAnnotations: boolean;
|
315
|
+
enableOptionalDependencies: boolean;
|
316
|
+
enableFire: boolean;
|
317
|
+
inferEffectDependencies: {
|
318
|
+
function: {
|
319
|
+
source: string;
|
320
|
+
importSpecifierName: string;
|
321
|
+
};
|
322
|
+
numRequiredArgs: number;
|
323
|
+
}[] | null;
|
324
|
+
inlineJsxTransform: {
|
325
|
+
elementSymbol: "react.element" | "react.transitional.element";
|
326
|
+
globalDevVar: string;
|
327
|
+
} | null;
|
328
|
+
validateHooksUsage: boolean;
|
329
|
+
validateRefAccessDuringRender: boolean;
|
330
|
+
validateNoSetStateInRender: boolean;
|
331
|
+
validateNoSetStateInPassiveEffects: boolean;
|
332
|
+
validateNoJSXInTryStatements: boolean;
|
333
|
+
validateMemoizedEffectDependencies: boolean;
|
334
|
+
validateNoCapitalizedCalls: string[] | null;
|
335
|
+
validateBlocklistedImports: string[] | null;
|
336
|
+
validateNoImpureFunctionsInRender: boolean;
|
337
|
+
enableAssumeHooksFollowRulesOfReact: boolean;
|
338
|
+
enableTransitivelyFreezeFunctionExpressions: boolean;
|
339
|
+
enableEmitFreeze: {
|
340
|
+
source: string;
|
341
|
+
importSpecifierName: string;
|
342
|
+
} | null;
|
343
|
+
enableEmitHookGuards: {
|
344
|
+
source: string;
|
345
|
+
importSpecifierName: string;
|
346
|
+
} | null;
|
347
|
+
enableInstructionReordering: boolean;
|
348
|
+
enableFunctionOutlining: boolean;
|
349
|
+
enableJsxOutlining: boolean;
|
350
|
+
enableEmitInstrumentForget: {
|
351
|
+
fn: {
|
352
|
+
source: string;
|
353
|
+
importSpecifierName: string;
|
354
|
+
};
|
355
|
+
gating: {
|
356
|
+
source: string;
|
357
|
+
importSpecifierName: string;
|
358
|
+
} | null;
|
359
|
+
globalGating: string | null;
|
360
|
+
} | null;
|
361
|
+
assertValidMutableRanges: boolean;
|
362
|
+
enableChangeVariableCodegen: boolean;
|
363
|
+
enableMemoizationComments: boolean;
|
364
|
+
throwUnknownException__testonly: boolean;
|
365
|
+
enableTreatFunctionDepsAsConditional: boolean;
|
366
|
+
disableMemoizationForDebugging: boolean;
|
367
|
+
enableMinimalTransformsForRetry: boolean;
|
368
|
+
enableChangeDetectionForDebugging: {
|
369
|
+
source: string;
|
370
|
+
importSpecifierName: string;
|
371
|
+
} | null;
|
372
|
+
enableCustomTypeDefinitionForReanimated: boolean;
|
373
|
+
hookPattern: string | null;
|
374
|
+
enableTreatRefLikeIdentifiersAsRefs: boolean;
|
375
|
+
lowerContextAccess: {
|
376
|
+
source: string;
|
377
|
+
importSpecifierName: string;
|
378
|
+
} | null;
|
379
|
+
}, {
|
380
|
+
customHooks?: Map<string, {
|
381
|
+
effectKind: Effect;
|
382
|
+
valueKind: ValueKind;
|
383
|
+
noAlias?: boolean | undefined;
|
384
|
+
transitiveMixedData?: boolean | undefined;
|
385
|
+
}> | undefined;
|
386
|
+
moduleTypeProvider?: ((args_0: string, ...args_1: unknown[]) => unknown) | null | undefined;
|
387
|
+
customMacros?: (string | [string, ({
|
388
|
+
type: "wildcard";
|
389
|
+
} | {
|
390
|
+
type: "name";
|
391
|
+
name: string;
|
392
|
+
})[]])[] | null | undefined;
|
393
|
+
enableResetCacheOnSourceFileChanges?: boolean | null | undefined;
|
394
|
+
enablePreserveExistingMemoizationGuarantees?: boolean | undefined;
|
395
|
+
validatePreserveExistingMemoizationGuarantees?: boolean | undefined;
|
396
|
+
enablePreserveExistingManualUseMemo?: boolean | undefined;
|
397
|
+
enableForest?: boolean | undefined;
|
398
|
+
enableUseTypeAnnotations?: boolean | undefined;
|
399
|
+
enableOptionalDependencies?: boolean | undefined;
|
400
|
+
enableFire?: boolean | undefined;
|
401
|
+
inferEffectDependencies?: {
|
402
|
+
function: {
|
403
|
+
source: string;
|
404
|
+
importSpecifierName: string;
|
405
|
+
};
|
406
|
+
numRequiredArgs: number;
|
407
|
+
}[] | null | undefined;
|
408
|
+
inlineJsxTransform?: {
|
409
|
+
elementSymbol: "react.element" | "react.transitional.element";
|
410
|
+
globalDevVar: string;
|
411
|
+
} | null | undefined;
|
412
|
+
validateHooksUsage?: boolean | undefined;
|
413
|
+
validateRefAccessDuringRender?: boolean | undefined;
|
414
|
+
validateNoSetStateInRender?: boolean | undefined;
|
415
|
+
validateNoSetStateInPassiveEffects?: boolean | undefined;
|
416
|
+
validateNoJSXInTryStatements?: boolean | undefined;
|
417
|
+
validateMemoizedEffectDependencies?: boolean | undefined;
|
418
|
+
validateNoCapitalizedCalls?: string[] | null | undefined;
|
419
|
+
validateBlocklistedImports?: string[] | null | undefined;
|
420
|
+
validateNoImpureFunctionsInRender?: boolean | undefined;
|
421
|
+
enableAssumeHooksFollowRulesOfReact?: boolean | undefined;
|
422
|
+
enableTransitivelyFreezeFunctionExpressions?: boolean | undefined;
|
423
|
+
enableEmitFreeze?: {
|
424
|
+
source: string;
|
425
|
+
importSpecifierName: string;
|
426
|
+
} | null | undefined;
|
427
|
+
enableEmitHookGuards?: {
|
428
|
+
source: string;
|
429
|
+
importSpecifierName: string;
|
430
|
+
} | null | undefined;
|
431
|
+
enableInstructionReordering?: boolean | undefined;
|
432
|
+
enableFunctionOutlining?: boolean | undefined;
|
433
|
+
enableJsxOutlining?: boolean | undefined;
|
434
|
+
enableEmitInstrumentForget?: {
|
435
|
+
fn: {
|
436
|
+
source: string;
|
437
|
+
importSpecifierName: string;
|
438
|
+
};
|
439
|
+
gating: {
|
440
|
+
source: string;
|
441
|
+
importSpecifierName: string;
|
442
|
+
} | null;
|
443
|
+
globalGating: string | null;
|
444
|
+
} | null | undefined;
|
445
|
+
assertValidMutableRanges?: boolean | undefined;
|
446
|
+
enableChangeVariableCodegen?: boolean | undefined;
|
447
|
+
enableMemoizationComments?: boolean | undefined;
|
448
|
+
throwUnknownException__testonly?: boolean | undefined;
|
449
|
+
enableTreatFunctionDepsAsConditional?: boolean | undefined;
|
450
|
+
disableMemoizationForDebugging?: boolean | undefined;
|
451
|
+
enableMinimalTransformsForRetry?: boolean | undefined;
|
452
|
+
enableChangeDetectionForDebugging?: {
|
453
|
+
source: string;
|
454
|
+
importSpecifierName: string;
|
455
|
+
} | null | undefined;
|
456
|
+
enableCustomTypeDefinitionForReanimated?: boolean | undefined;
|
457
|
+
hookPattern?: string | null | undefined;
|
458
|
+
enableTreatRefLikeIdentifiersAsRefs?: boolean | undefined;
|
459
|
+
lowerContextAccess?: {
|
460
|
+
source: string;
|
461
|
+
importSpecifierName: string;
|
462
|
+
} | null | undefined;
|
463
|
+
}>;
|
464
|
+
type EnvironmentConfig = z.infer<typeof EnvironmentConfigSchema>;
|
465
|
+
declare function parseConfigPragmaForTests(pragma: string, defaults: {
|
466
|
+
compilationMode: CompilationMode;
|
467
|
+
}): PluginOptions;
|
468
|
+
type PartialEnvironmentConfig = Partial<EnvironmentConfig>;
|
469
|
+
type ReactFunctionType = 'Component' | 'Hook' | 'Other';
|
470
|
+
declare class Environment {
|
471
|
+
#private;
|
472
|
+
logger: Logger | null;
|
473
|
+
filename: string | null;
|
474
|
+
code: string | null;
|
475
|
+
config: EnvironmentConfig;
|
476
|
+
fnType: ReactFunctionType;
|
477
|
+
useMemoCacheIdentifier: string;
|
478
|
+
hasLoweredContextAccess: boolean;
|
479
|
+
hasFireRewrite: boolean;
|
480
|
+
constructor(scope: Scope, fnType: ReactFunctionType, config: EnvironmentConfig, contextIdentifiers: Set<t.Identifier>, logger: Logger | null, filename: string | null, code: string | null, useMemoCacheIdentifier: string);
|
481
|
+
get nextIdentifierId(): IdentifierId;
|
482
|
+
get nextBlockId(): BlockId;
|
483
|
+
get nextScopeId(): ScopeId;
|
484
|
+
isContextIdentifier(node: t.Identifier): boolean;
|
485
|
+
isHoistedIdentifier(node: t.Identifier): boolean;
|
486
|
+
generateGloballyUniqueIdentifierName(name: string | null): ValidatedIdentifier;
|
487
|
+
outlineFunction(fn: HIRFunction, type: ReactFunctionType | null): void;
|
488
|
+
getOutlinedFunctions(): Array<{
|
489
|
+
fn: HIRFunction;
|
490
|
+
type: ReactFunctionType | null;
|
491
|
+
}>;
|
492
|
+
getGlobalDeclaration(binding: NonLocalBinding, loc: SourceLocation): Global | null;
|
493
|
+
getPropertyType(receiver: Type, property: string): BuiltInType | PolyType | null;
|
494
|
+
getFunctionSignature(type: FunctionType): FunctionSignature | null;
|
495
|
+
addHoistedIdentifier(node: t.Identifier): void;
|
496
|
+
}
|
497
|
+
declare function validateEnvironmentConfig(partialConfig: PartialEnvironmentConfig): EnvironmentConfig;
|
498
|
+
|
499
|
+
declare const GeneratedSource: unique symbol;
|
500
|
+
type SourceLocation = t.SourceLocation | typeof GeneratedSource;
|
501
|
+
type ReactiveFunction = {
|
502
|
+
loc: SourceLocation;
|
503
|
+
id: string | null;
|
504
|
+
params: Array<Place | SpreadPattern>;
|
505
|
+
generator: boolean;
|
506
|
+
async: boolean;
|
507
|
+
body: ReactiveBlock;
|
508
|
+
env: Environment;
|
509
|
+
directives: Array<string>;
|
510
|
+
};
|
511
|
+
type ReactiveScopeBlock = {
|
512
|
+
kind: 'scope';
|
513
|
+
scope: ReactiveScope;
|
514
|
+
instructions: ReactiveBlock;
|
515
|
+
};
|
516
|
+
type PrunedReactiveScopeBlock = {
|
517
|
+
kind: 'pruned-scope';
|
518
|
+
scope: ReactiveScope;
|
519
|
+
instructions: ReactiveBlock;
|
520
|
+
};
|
521
|
+
type ReactiveBlock = Array<ReactiveStatement>;
|
522
|
+
type ReactiveStatement = ReactiveInstructionStatement | ReactiveTerminalStatement | ReactiveScopeBlock | PrunedReactiveScopeBlock;
|
523
|
+
type ReactiveInstructionStatement = {
|
524
|
+
kind: 'instruction';
|
525
|
+
instruction: ReactiveInstruction;
|
526
|
+
};
|
527
|
+
type ReactiveTerminalStatement<Tterminal extends ReactiveTerminal = ReactiveTerminal> = {
|
528
|
+
kind: 'terminal';
|
529
|
+
terminal: Tterminal;
|
530
|
+
label: {
|
531
|
+
id: BlockId;
|
532
|
+
implicit: boolean;
|
533
|
+
} | null;
|
534
|
+
};
|
535
|
+
type ReactiveInstruction = {
|
536
|
+
id: InstructionId;
|
537
|
+
lvalue: Place | null;
|
538
|
+
value: ReactiveValue;
|
539
|
+
loc: SourceLocation;
|
540
|
+
};
|
541
|
+
type ReactiveValue = InstructionValue | ReactiveLogicalValue | ReactiveSequenceValue | ReactiveTernaryValue | ReactiveOptionalCallValue;
|
542
|
+
type ReactiveLogicalValue = {
|
543
|
+
kind: 'LogicalExpression';
|
544
|
+
operator: t.LogicalExpression['operator'];
|
545
|
+
left: ReactiveValue;
|
546
|
+
right: ReactiveValue;
|
547
|
+
loc: SourceLocation;
|
548
|
+
};
|
549
|
+
type ReactiveTernaryValue = {
|
550
|
+
kind: 'ConditionalExpression';
|
551
|
+
test: ReactiveValue;
|
552
|
+
consequent: ReactiveValue;
|
553
|
+
alternate: ReactiveValue;
|
554
|
+
loc: SourceLocation;
|
555
|
+
};
|
556
|
+
type ReactiveSequenceValue = {
|
557
|
+
kind: 'SequenceExpression';
|
558
|
+
instructions: Array<ReactiveInstruction>;
|
559
|
+
id: InstructionId;
|
560
|
+
value: ReactiveValue;
|
561
|
+
loc: SourceLocation;
|
562
|
+
};
|
563
|
+
type ReactiveOptionalCallValue = {
|
564
|
+
kind: 'OptionalExpression';
|
565
|
+
id: InstructionId;
|
566
|
+
value: ReactiveValue;
|
567
|
+
optional: boolean;
|
568
|
+
loc: SourceLocation;
|
569
|
+
};
|
570
|
+
type ReactiveTerminal = ReactiveBreakTerminal | ReactiveContinueTerminal | ReactiveReturnTerminal | ReactiveThrowTerminal | ReactiveSwitchTerminal | ReactiveDoWhileTerminal | ReactiveWhileTerminal | ReactiveForTerminal | ReactiveForOfTerminal | ReactiveForInTerminal | ReactiveIfTerminal | ReactiveLabelTerminal | ReactiveTryTerminal;
|
571
|
+
type ReactiveTerminalTargetKind = 'implicit' | 'labeled' | 'unlabeled';
|
572
|
+
type ReactiveBreakTerminal = {
|
573
|
+
kind: 'break';
|
574
|
+
target: BlockId;
|
575
|
+
id: InstructionId;
|
576
|
+
targetKind: ReactiveTerminalTargetKind;
|
577
|
+
loc: SourceLocation;
|
578
|
+
};
|
579
|
+
type ReactiveContinueTerminal = {
|
580
|
+
kind: 'continue';
|
581
|
+
target: BlockId;
|
582
|
+
id: InstructionId;
|
583
|
+
targetKind: ReactiveTerminalTargetKind;
|
584
|
+
loc: SourceLocation;
|
585
|
+
};
|
586
|
+
type ReactiveReturnTerminal = {
|
587
|
+
kind: 'return';
|
588
|
+
value: Place;
|
589
|
+
id: InstructionId;
|
590
|
+
loc: SourceLocation;
|
591
|
+
};
|
592
|
+
type ReactiveThrowTerminal = {
|
593
|
+
kind: 'throw';
|
594
|
+
value: Place;
|
595
|
+
id: InstructionId;
|
596
|
+
loc: SourceLocation;
|
597
|
+
};
|
598
|
+
type ReactiveSwitchTerminal = {
|
599
|
+
kind: 'switch';
|
600
|
+
test: Place;
|
601
|
+
cases: Array<{
|
602
|
+
test: Place | null;
|
603
|
+
block: ReactiveBlock | void;
|
604
|
+
}>;
|
605
|
+
id: InstructionId;
|
606
|
+
loc: SourceLocation;
|
607
|
+
};
|
608
|
+
type ReactiveDoWhileTerminal = {
|
609
|
+
kind: 'do-while';
|
610
|
+
loop: ReactiveBlock;
|
611
|
+
test: ReactiveValue;
|
612
|
+
id: InstructionId;
|
613
|
+
loc: SourceLocation;
|
614
|
+
};
|
615
|
+
type ReactiveWhileTerminal = {
|
616
|
+
kind: 'while';
|
617
|
+
test: ReactiveValue;
|
618
|
+
loop: ReactiveBlock;
|
619
|
+
id: InstructionId;
|
620
|
+
loc: SourceLocation;
|
621
|
+
};
|
622
|
+
type ReactiveForTerminal = {
|
623
|
+
kind: 'for';
|
624
|
+
init: ReactiveValue;
|
625
|
+
test: ReactiveValue;
|
626
|
+
update: ReactiveValue | null;
|
627
|
+
loop: ReactiveBlock;
|
628
|
+
id: InstructionId;
|
629
|
+
loc: SourceLocation;
|
630
|
+
};
|
631
|
+
type ReactiveForOfTerminal = {
|
632
|
+
kind: 'for-of';
|
633
|
+
init: ReactiveValue;
|
634
|
+
test: ReactiveValue;
|
635
|
+
loop: ReactiveBlock;
|
636
|
+
id: InstructionId;
|
637
|
+
loc: SourceLocation;
|
638
|
+
};
|
639
|
+
type ReactiveForInTerminal = {
|
640
|
+
kind: 'for-in';
|
641
|
+
init: ReactiveValue;
|
642
|
+
loop: ReactiveBlock;
|
643
|
+
id: InstructionId;
|
644
|
+
loc: SourceLocation;
|
645
|
+
};
|
646
|
+
type ReactiveIfTerminal = {
|
647
|
+
kind: 'if';
|
648
|
+
test: Place;
|
649
|
+
consequent: ReactiveBlock;
|
650
|
+
alternate: ReactiveBlock | null;
|
651
|
+
id: InstructionId;
|
652
|
+
loc: SourceLocation;
|
653
|
+
};
|
654
|
+
type ReactiveLabelTerminal = {
|
655
|
+
kind: 'label';
|
656
|
+
block: ReactiveBlock;
|
657
|
+
id: InstructionId;
|
658
|
+
loc: SourceLocation;
|
659
|
+
};
|
660
|
+
type ReactiveTryTerminal = {
|
661
|
+
kind: 'try';
|
662
|
+
block: ReactiveBlock;
|
663
|
+
handlerBinding: Place | null;
|
664
|
+
handler: ReactiveBlock;
|
665
|
+
id: InstructionId;
|
666
|
+
loc: SourceLocation;
|
667
|
+
};
|
668
|
+
type HIRFunction = {
|
669
|
+
loc: SourceLocation;
|
670
|
+
id: string | null;
|
671
|
+
fnType: ReactFunctionType;
|
672
|
+
env: Environment;
|
673
|
+
params: Array<Place | SpreadPattern>;
|
674
|
+
returnTypeAnnotation: t.FlowType | t.TSType | null;
|
675
|
+
returnType: Type;
|
676
|
+
context: Array<Place>;
|
677
|
+
effects: Array<FunctionEffect> | null;
|
678
|
+
body: HIR;
|
679
|
+
generator: boolean;
|
680
|
+
async: boolean;
|
681
|
+
directives: Array<string>;
|
682
|
+
};
|
683
|
+
type FunctionEffect = {
|
684
|
+
kind: 'GlobalMutation';
|
685
|
+
error: CompilerErrorDetailOptions;
|
686
|
+
} | {
|
687
|
+
kind: 'ReactMutation';
|
688
|
+
error: CompilerErrorDetailOptions;
|
689
|
+
} | {
|
690
|
+
kind: 'ContextMutation';
|
691
|
+
places: ReadonlySet<Place>;
|
692
|
+
effect: Effect;
|
693
|
+
loc: SourceLocation;
|
694
|
+
};
|
695
|
+
type HIR = {
|
696
|
+
entry: BlockId;
|
697
|
+
blocks: Map<BlockId, BasicBlock>;
|
698
|
+
};
|
699
|
+
type BlockKind = 'block' | 'value' | 'loop' | 'sequence' | 'catch';
|
700
|
+
type BasicBlock = {
|
701
|
+
kind: BlockKind;
|
702
|
+
id: BlockId;
|
703
|
+
instructions: Array<Instruction>;
|
704
|
+
terminal: Terminal;
|
705
|
+
preds: Set<BlockId>;
|
706
|
+
phis: Set<Phi>;
|
707
|
+
};
|
708
|
+
type Terminal = UnsupportedTerminal | UnreachableTerminal | ThrowTerminal | ReturnTerminal | GotoTerminal | IfTerminal | BranchTerminal | SwitchTerminal | ForTerminal | ForOfTerminal | ForInTerminal | DoWhileTerminal | WhileTerminal | LogicalTerminal | TernaryTerminal | OptionalTerminal | LabelTerminal | SequenceTerminal | MaybeThrowTerminal | TryTerminal | ReactiveScopeTerminal | PrunedScopeTerminal;
|
709
|
+
type UnsupportedTerminal = {
|
710
|
+
kind: 'unsupported';
|
711
|
+
id: InstructionId;
|
712
|
+
loc: SourceLocation;
|
713
|
+
fallthrough?: never;
|
714
|
+
};
|
715
|
+
type UnreachableTerminal = {
|
716
|
+
kind: 'unreachable';
|
717
|
+
id: InstructionId;
|
718
|
+
loc: SourceLocation;
|
719
|
+
fallthrough?: never;
|
720
|
+
};
|
721
|
+
type ThrowTerminal = {
|
722
|
+
kind: 'throw';
|
723
|
+
value: Place;
|
724
|
+
id: InstructionId;
|
725
|
+
loc: SourceLocation;
|
726
|
+
fallthrough?: never;
|
727
|
+
};
|
728
|
+
type Case = {
|
729
|
+
test: Place | null;
|
730
|
+
block: BlockId;
|
731
|
+
};
|
732
|
+
type ReturnTerminal = {
|
733
|
+
kind: 'return';
|
734
|
+
loc: SourceLocation;
|
735
|
+
value: Place;
|
736
|
+
id: InstructionId;
|
737
|
+
fallthrough?: never;
|
738
|
+
};
|
739
|
+
type GotoTerminal = {
|
740
|
+
kind: 'goto';
|
741
|
+
block: BlockId;
|
742
|
+
variant: GotoVariant;
|
743
|
+
id: InstructionId;
|
744
|
+
loc: SourceLocation;
|
745
|
+
fallthrough?: never;
|
746
|
+
};
|
747
|
+
declare enum GotoVariant {
|
748
|
+
Break = "Break",
|
749
|
+
Continue = "Continue",
|
750
|
+
Try = "Try"
|
751
|
+
}
|
752
|
+
type IfTerminal = {
|
753
|
+
kind: 'if';
|
754
|
+
test: Place;
|
755
|
+
consequent: BlockId;
|
756
|
+
alternate: BlockId;
|
757
|
+
fallthrough: BlockId;
|
758
|
+
id: InstructionId;
|
759
|
+
loc: SourceLocation;
|
760
|
+
};
|
761
|
+
type BranchTerminal = {
|
762
|
+
kind: 'branch';
|
763
|
+
test: Place;
|
764
|
+
consequent: BlockId;
|
765
|
+
alternate: BlockId;
|
766
|
+
id: InstructionId;
|
767
|
+
loc: SourceLocation;
|
768
|
+
fallthrough: BlockId;
|
769
|
+
};
|
770
|
+
type SwitchTerminal = {
|
771
|
+
kind: 'switch';
|
772
|
+
test: Place;
|
773
|
+
cases: Array<Case>;
|
774
|
+
fallthrough: BlockId;
|
775
|
+
id: InstructionId;
|
776
|
+
loc: SourceLocation;
|
777
|
+
};
|
778
|
+
type DoWhileTerminal = {
|
779
|
+
kind: 'do-while';
|
780
|
+
loop: BlockId;
|
781
|
+
test: BlockId;
|
782
|
+
fallthrough: BlockId;
|
783
|
+
id: InstructionId;
|
784
|
+
loc: SourceLocation;
|
785
|
+
};
|
786
|
+
type WhileTerminal = {
|
787
|
+
kind: 'while';
|
788
|
+
loc: SourceLocation;
|
789
|
+
test: BlockId;
|
790
|
+
loop: BlockId;
|
791
|
+
fallthrough: BlockId;
|
792
|
+
id: InstructionId;
|
793
|
+
};
|
794
|
+
type ForTerminal = {
|
795
|
+
kind: 'for';
|
796
|
+
loc: SourceLocation;
|
797
|
+
init: BlockId;
|
798
|
+
test: BlockId;
|
799
|
+
update: BlockId | null;
|
800
|
+
loop: BlockId;
|
801
|
+
fallthrough: BlockId;
|
802
|
+
id: InstructionId;
|
803
|
+
};
|
804
|
+
type ForOfTerminal = {
|
805
|
+
kind: 'for-of';
|
806
|
+
loc: SourceLocation;
|
807
|
+
init: BlockId;
|
808
|
+
test: BlockId;
|
809
|
+
loop: BlockId;
|
810
|
+
fallthrough: BlockId;
|
811
|
+
id: InstructionId;
|
812
|
+
};
|
813
|
+
type ForInTerminal = {
|
814
|
+
kind: 'for-in';
|
815
|
+
loc: SourceLocation;
|
816
|
+
init: BlockId;
|
817
|
+
loop: BlockId;
|
818
|
+
fallthrough: BlockId;
|
819
|
+
id: InstructionId;
|
820
|
+
};
|
821
|
+
type LogicalTerminal = {
|
822
|
+
kind: 'logical';
|
823
|
+
operator: t.LogicalExpression['operator'];
|
824
|
+
test: BlockId;
|
825
|
+
fallthrough: BlockId;
|
826
|
+
id: InstructionId;
|
827
|
+
loc: SourceLocation;
|
828
|
+
};
|
829
|
+
type TernaryTerminal = {
|
830
|
+
kind: 'ternary';
|
831
|
+
test: BlockId;
|
832
|
+
fallthrough: BlockId;
|
833
|
+
id: InstructionId;
|
834
|
+
loc: SourceLocation;
|
835
|
+
};
|
836
|
+
type LabelTerminal = {
|
837
|
+
kind: 'label';
|
838
|
+
block: BlockId;
|
839
|
+
fallthrough: BlockId;
|
840
|
+
id: InstructionId;
|
841
|
+
loc: SourceLocation;
|
842
|
+
};
|
843
|
+
type OptionalTerminal = {
|
844
|
+
kind: 'optional';
|
845
|
+
optional: boolean;
|
846
|
+
test: BlockId;
|
847
|
+
fallthrough: BlockId;
|
848
|
+
id: InstructionId;
|
849
|
+
loc: SourceLocation;
|
850
|
+
};
|
851
|
+
type SequenceTerminal = {
|
852
|
+
kind: 'sequence';
|
853
|
+
block: BlockId;
|
854
|
+
fallthrough: BlockId;
|
855
|
+
id: InstructionId;
|
856
|
+
loc: SourceLocation;
|
857
|
+
};
|
858
|
+
type TryTerminal = {
|
859
|
+
kind: 'try';
|
860
|
+
block: BlockId;
|
861
|
+
handlerBinding: Place | null;
|
862
|
+
handler: BlockId;
|
863
|
+
fallthrough: BlockId;
|
864
|
+
id: InstructionId;
|
865
|
+
loc: SourceLocation;
|
866
|
+
};
|
867
|
+
type MaybeThrowTerminal = {
|
868
|
+
kind: 'maybe-throw';
|
869
|
+
continuation: BlockId;
|
870
|
+
handler: BlockId;
|
871
|
+
id: InstructionId;
|
872
|
+
loc: SourceLocation;
|
873
|
+
fallthrough?: never;
|
874
|
+
};
|
875
|
+
type ReactiveScopeTerminal = {
|
876
|
+
kind: 'scope';
|
877
|
+
fallthrough: BlockId;
|
878
|
+
block: BlockId;
|
879
|
+
scope: ReactiveScope;
|
880
|
+
id: InstructionId;
|
881
|
+
loc: SourceLocation;
|
882
|
+
};
|
883
|
+
type PrunedScopeTerminal = {
|
884
|
+
kind: 'pruned-scope';
|
885
|
+
fallthrough: BlockId;
|
886
|
+
block: BlockId;
|
887
|
+
scope: ReactiveScope;
|
888
|
+
id: InstructionId;
|
889
|
+
loc: SourceLocation;
|
890
|
+
};
|
891
|
+
type Instruction = {
|
892
|
+
id: InstructionId;
|
893
|
+
lvalue: Place;
|
894
|
+
value: InstructionValue;
|
895
|
+
loc: SourceLocation;
|
896
|
+
};
|
897
|
+
type LValue = {
|
898
|
+
place: Place;
|
899
|
+
kind: InstructionKind;
|
900
|
+
};
|
901
|
+
type LValuePattern = {
|
902
|
+
pattern: Pattern;
|
903
|
+
kind: InstructionKind;
|
904
|
+
};
|
905
|
+
type ArrayExpression = {
|
906
|
+
kind: 'ArrayExpression';
|
907
|
+
elements: Array<Place | SpreadPattern | Hole>;
|
908
|
+
loc: SourceLocation;
|
909
|
+
};
|
910
|
+
type Pattern = ArrayPattern | ObjectPattern;
|
911
|
+
type Hole = {
|
912
|
+
kind: 'Hole';
|
913
|
+
};
|
914
|
+
type SpreadPattern = {
|
915
|
+
kind: 'Spread';
|
916
|
+
place: Place;
|
917
|
+
};
|
918
|
+
type ArrayPattern = {
|
919
|
+
kind: 'ArrayPattern';
|
920
|
+
items: Array<Place | SpreadPattern | Hole>;
|
921
|
+
};
|
922
|
+
type ObjectPattern = {
|
923
|
+
kind: 'ObjectPattern';
|
924
|
+
properties: Array<ObjectProperty | SpreadPattern>;
|
925
|
+
};
|
926
|
+
type ObjectPropertyKey = {
|
927
|
+
kind: 'string';
|
928
|
+
name: string;
|
929
|
+
} | {
|
930
|
+
kind: 'identifier';
|
931
|
+
name: string;
|
932
|
+
} | {
|
933
|
+
kind: 'computed';
|
934
|
+
name: Place;
|
935
|
+
};
|
936
|
+
type ObjectProperty = {
|
937
|
+
kind: 'ObjectProperty';
|
938
|
+
key: ObjectPropertyKey;
|
939
|
+
type: 'property' | 'method';
|
940
|
+
place: Place;
|
941
|
+
};
|
942
|
+
type LoweredFunction = {
|
943
|
+
func: HIRFunction;
|
944
|
+
};
|
945
|
+
type ObjectMethod = {
|
946
|
+
kind: 'ObjectMethod';
|
947
|
+
loc: SourceLocation;
|
948
|
+
loweredFunc: LoweredFunction;
|
949
|
+
};
|
950
|
+
declare enum InstructionKind {
|
951
|
+
Const = "Const",
|
952
|
+
Let = "Let",
|
953
|
+
Reassign = "Reassign",
|
954
|
+
Catch = "Catch",
|
955
|
+
HoistedConst = "HoistedConst",
|
956
|
+
HoistedLet = "HoistedLet",
|
957
|
+
HoistedFunction = "HoistedFunction",
|
958
|
+
Function = "Function"
|
959
|
+
}
|
960
|
+
type Phi = {
|
961
|
+
kind: 'Phi';
|
962
|
+
place: Place;
|
963
|
+
operands: Map<BlockId, Place>;
|
964
|
+
};
|
965
|
+
type ManualMemoDependency = {
|
966
|
+
root: {
|
967
|
+
kind: 'NamedLocal';
|
968
|
+
value: Place;
|
969
|
+
} | {
|
970
|
+
kind: 'Global';
|
971
|
+
identifierName: string;
|
972
|
+
};
|
973
|
+
path: DependencyPath;
|
974
|
+
};
|
975
|
+
type StartMemoize = {
|
976
|
+
kind: 'StartMemoize';
|
977
|
+
manualMemoId: number;
|
978
|
+
deps: Array<ManualMemoDependency> | null;
|
979
|
+
loc: SourceLocation;
|
980
|
+
};
|
981
|
+
type FinishMemoize = {
|
982
|
+
kind: 'FinishMemoize';
|
983
|
+
manualMemoId: number;
|
984
|
+
decl: Place;
|
985
|
+
pruned?: true;
|
986
|
+
loc: SourceLocation;
|
987
|
+
};
|
988
|
+
type MethodCall = {
|
989
|
+
kind: 'MethodCall';
|
990
|
+
receiver: Place;
|
991
|
+
property: Place;
|
992
|
+
args: Array<Place | SpreadPattern>;
|
993
|
+
loc: SourceLocation;
|
994
|
+
};
|
995
|
+
type CallExpression = {
|
996
|
+
kind: 'CallExpression';
|
997
|
+
callee: Place;
|
998
|
+
args: Array<Place | SpreadPattern>;
|
999
|
+
loc: SourceLocation;
|
1000
|
+
typeArguments?: Array<t.FlowType>;
|
1001
|
+
};
|
1002
|
+
type LoadLocal = {
|
1003
|
+
kind: 'LoadLocal';
|
1004
|
+
place: Place;
|
1005
|
+
loc: SourceLocation;
|
1006
|
+
};
|
1007
|
+
type LoadContext = {
|
1008
|
+
kind: 'LoadContext';
|
1009
|
+
place: Place;
|
1010
|
+
loc: SourceLocation;
|
1011
|
+
};
|
1012
|
+
type InstructionValue = LoadLocal | LoadContext | {
|
1013
|
+
kind: 'DeclareLocal';
|
1014
|
+
lvalue: LValue;
|
1015
|
+
type: t.FlowType | t.TSType | null;
|
1016
|
+
loc: SourceLocation;
|
1017
|
+
} | {
|
1018
|
+
kind: 'DeclareContext';
|
1019
|
+
lvalue: {
|
1020
|
+
kind: InstructionKind.Let | InstructionKind.HoistedConst | InstructionKind.HoistedLet | InstructionKind.HoistedFunction;
|
1021
|
+
place: Place;
|
1022
|
+
};
|
1023
|
+
loc: SourceLocation;
|
1024
|
+
} | StoreLocal | {
|
1025
|
+
kind: 'StoreContext';
|
1026
|
+
lvalue: {
|
1027
|
+
kind: InstructionKind.Reassign;
|
1028
|
+
place: Place;
|
1029
|
+
};
|
1030
|
+
value: Place;
|
1031
|
+
loc: SourceLocation;
|
1032
|
+
} | Destructure | {
|
1033
|
+
kind: 'Primitive';
|
1034
|
+
value: number | boolean | string | null | undefined;
|
1035
|
+
loc: SourceLocation;
|
1036
|
+
} | JSXText | {
|
1037
|
+
kind: 'BinaryExpression';
|
1038
|
+
operator: Exclude<t.BinaryExpression['operator'], '|>'>;
|
1039
|
+
left: Place;
|
1040
|
+
right: Place;
|
1041
|
+
loc: SourceLocation;
|
1042
|
+
} | {
|
1043
|
+
kind: 'NewExpression';
|
1044
|
+
callee: Place;
|
1045
|
+
args: Array<Place | SpreadPattern>;
|
1046
|
+
loc: SourceLocation;
|
1047
|
+
} | CallExpression | MethodCall | {
|
1048
|
+
kind: 'UnaryExpression';
|
1049
|
+
operator: Exclude<t.UnaryExpression['operator'], 'throw' | 'delete'>;
|
1050
|
+
value: Place;
|
1051
|
+
loc: SourceLocation;
|
1052
|
+
} | {
|
1053
|
+
kind: 'TypeCastExpression';
|
1054
|
+
value: Place;
|
1055
|
+
typeAnnotation: t.FlowType | t.TSType;
|
1056
|
+
type: Type;
|
1057
|
+
loc: SourceLocation;
|
1058
|
+
} | JsxExpression | {
|
1059
|
+
kind: 'ObjectExpression';
|
1060
|
+
properties: Array<ObjectProperty | SpreadPattern>;
|
1061
|
+
loc: SourceLocation;
|
1062
|
+
} | ObjectMethod | ArrayExpression | {
|
1063
|
+
kind: 'JsxFragment';
|
1064
|
+
children: Array<Place>;
|
1065
|
+
loc: SourceLocation;
|
1066
|
+
} | {
|
1067
|
+
kind: 'RegExpLiteral';
|
1068
|
+
pattern: string;
|
1069
|
+
flags: string;
|
1070
|
+
loc: SourceLocation;
|
1071
|
+
} | {
|
1072
|
+
kind: 'MetaProperty';
|
1073
|
+
meta: string;
|
1074
|
+
property: string;
|
1075
|
+
loc: SourceLocation;
|
1076
|
+
} | {
|
1077
|
+
kind: 'PropertyStore';
|
1078
|
+
object: Place;
|
1079
|
+
property: PropertyLiteral;
|
1080
|
+
value: Place;
|
1081
|
+
loc: SourceLocation;
|
1082
|
+
} | PropertyLoad | {
|
1083
|
+
kind: 'PropertyDelete';
|
1084
|
+
object: Place;
|
1085
|
+
property: PropertyLiteral;
|
1086
|
+
loc: SourceLocation;
|
1087
|
+
} | {
|
1088
|
+
kind: 'ComputedStore';
|
1089
|
+
object: Place;
|
1090
|
+
property: Place;
|
1091
|
+
value: Place;
|
1092
|
+
loc: SourceLocation;
|
1093
|
+
} | {
|
1094
|
+
kind: 'ComputedLoad';
|
1095
|
+
object: Place;
|
1096
|
+
property: Place;
|
1097
|
+
loc: SourceLocation;
|
1098
|
+
} | {
|
1099
|
+
kind: 'ComputedDelete';
|
1100
|
+
object: Place;
|
1101
|
+
property: Place;
|
1102
|
+
loc: SourceLocation;
|
1103
|
+
} | LoadGlobal | StoreGlobal | FunctionExpression | {
|
1104
|
+
kind: 'TaggedTemplateExpression';
|
1105
|
+
tag: Place;
|
1106
|
+
value: {
|
1107
|
+
raw: string;
|
1108
|
+
cooked?: string;
|
1109
|
+
};
|
1110
|
+
loc: SourceLocation;
|
1111
|
+
} | {
|
1112
|
+
kind: 'TemplateLiteral';
|
1113
|
+
subexprs: Array<Place>;
|
1114
|
+
quasis: Array<{
|
1115
|
+
raw: string;
|
1116
|
+
cooked?: string;
|
1117
|
+
}>;
|
1118
|
+
loc: SourceLocation;
|
1119
|
+
} | {
|
1120
|
+
kind: 'Await';
|
1121
|
+
value: Place;
|
1122
|
+
loc: SourceLocation;
|
1123
|
+
} | {
|
1124
|
+
kind: 'GetIterator';
|
1125
|
+
collection: Place;
|
1126
|
+
loc: SourceLocation;
|
1127
|
+
} | {
|
1128
|
+
kind: 'IteratorNext';
|
1129
|
+
iterator: Place;
|
1130
|
+
collection: Place;
|
1131
|
+
loc: SourceLocation;
|
1132
|
+
} | {
|
1133
|
+
kind: 'NextPropertyOf';
|
1134
|
+
value: Place;
|
1135
|
+
loc: SourceLocation;
|
1136
|
+
} | {
|
1137
|
+
kind: 'PrefixUpdate';
|
1138
|
+
lvalue: Place;
|
1139
|
+
operation: t.UpdateExpression['operator'];
|
1140
|
+
value: Place;
|
1141
|
+
loc: SourceLocation;
|
1142
|
+
} | {
|
1143
|
+
kind: 'PostfixUpdate';
|
1144
|
+
lvalue: Place;
|
1145
|
+
operation: t.UpdateExpression['operator'];
|
1146
|
+
value: Place;
|
1147
|
+
loc: SourceLocation;
|
1148
|
+
} | {
|
1149
|
+
kind: 'Debugger';
|
1150
|
+
loc: SourceLocation;
|
1151
|
+
} | StartMemoize | FinishMemoize | {
|
1152
|
+
kind: 'UnsupportedNode';
|
1153
|
+
node: t.Node;
|
1154
|
+
loc: SourceLocation;
|
1155
|
+
};
|
1156
|
+
type JsxExpression = {
|
1157
|
+
kind: 'JsxExpression';
|
1158
|
+
tag: Place | BuiltinTag;
|
1159
|
+
props: Array<JsxAttribute>;
|
1160
|
+
children: Array<Place> | null;
|
1161
|
+
loc: SourceLocation;
|
1162
|
+
openingLoc: SourceLocation;
|
1163
|
+
closingLoc: SourceLocation;
|
1164
|
+
};
|
1165
|
+
type JsxAttribute = {
|
1166
|
+
kind: 'JsxSpreadAttribute';
|
1167
|
+
argument: Place;
|
1168
|
+
} | {
|
1169
|
+
kind: 'JsxAttribute';
|
1170
|
+
name: string;
|
1171
|
+
place: Place;
|
1172
|
+
};
|
1173
|
+
type FunctionExpression = {
|
1174
|
+
kind: 'FunctionExpression';
|
1175
|
+
name: string | null;
|
1176
|
+
loweredFunc: LoweredFunction;
|
1177
|
+
type: 'ArrowFunctionExpression' | 'FunctionExpression' | 'FunctionDeclaration';
|
1178
|
+
loc: SourceLocation;
|
1179
|
+
};
|
1180
|
+
type Destructure = {
|
1181
|
+
kind: 'Destructure';
|
1182
|
+
lvalue: LValuePattern;
|
1183
|
+
value: Place;
|
1184
|
+
loc: SourceLocation;
|
1185
|
+
};
|
1186
|
+
type Place = {
|
1187
|
+
kind: 'Identifier';
|
1188
|
+
identifier: Identifier;
|
1189
|
+
effect: Effect;
|
1190
|
+
reactive: boolean;
|
1191
|
+
loc: SourceLocation;
|
1192
|
+
};
|
1193
|
+
type JSXText = {
|
1194
|
+
kind: 'JSXText';
|
1195
|
+
value: string;
|
1196
|
+
loc: SourceLocation;
|
1197
|
+
};
|
1198
|
+
type StoreLocal = {
|
1199
|
+
kind: 'StoreLocal';
|
1200
|
+
lvalue: LValue;
|
1201
|
+
value: Place;
|
1202
|
+
type: t.FlowType | t.TSType | null;
|
1203
|
+
loc: SourceLocation;
|
1204
|
+
};
|
1205
|
+
type PropertyLoad = {
|
1206
|
+
kind: 'PropertyLoad';
|
1207
|
+
object: Place;
|
1208
|
+
property: PropertyLiteral;
|
1209
|
+
loc: SourceLocation;
|
1210
|
+
};
|
1211
|
+
type LoadGlobal = {
|
1212
|
+
kind: 'LoadGlobal';
|
1213
|
+
binding: NonLocalBinding;
|
1214
|
+
loc: SourceLocation;
|
1215
|
+
};
|
1216
|
+
type StoreGlobal = {
|
1217
|
+
kind: 'StoreGlobal';
|
1218
|
+
name: string;
|
1219
|
+
value: Place;
|
1220
|
+
loc: SourceLocation;
|
1221
|
+
};
|
1222
|
+
type BuiltinTag = {
|
1223
|
+
kind: 'BuiltinTag';
|
1224
|
+
name: string;
|
1225
|
+
loc: SourceLocation;
|
1226
|
+
};
|
1227
|
+
type MutableRange = {
|
1228
|
+
start: InstructionId;
|
1229
|
+
end: InstructionId;
|
1230
|
+
};
|
1231
|
+
type NonLocalBinding = {
|
1232
|
+
kind: 'ImportDefault';
|
1233
|
+
name: string;
|
1234
|
+
module: string;
|
1235
|
+
} | {
|
1236
|
+
kind: 'ImportNamespace';
|
1237
|
+
name: string;
|
1238
|
+
module: string;
|
1239
|
+
} | {
|
1240
|
+
kind: 'ImportSpecifier';
|
1241
|
+
name: string;
|
1242
|
+
module: string;
|
1243
|
+
imported: string;
|
1244
|
+
} | {
|
1245
|
+
kind: 'ModuleLocal';
|
1246
|
+
name: string;
|
1247
|
+
} | {
|
1248
|
+
kind: 'Global';
|
1249
|
+
name: string;
|
1250
|
+
};
|
1251
|
+
type Identifier = {
|
1252
|
+
id: IdentifierId;
|
1253
|
+
declarationId: DeclarationId;
|
1254
|
+
name: IdentifierName | null;
|
1255
|
+
mutableRange: MutableRange;
|
1256
|
+
scope: ReactiveScope | null;
|
1257
|
+
type: Type;
|
1258
|
+
loc: SourceLocation;
|
1259
|
+
};
|
1260
|
+
type IdentifierName = ValidatedIdentifier | PromotedIdentifier;
|
1261
|
+
type ValidatedIdentifier = {
|
1262
|
+
kind: 'named';
|
1263
|
+
value: ValidIdentifierName;
|
1264
|
+
};
|
1265
|
+
type PromotedIdentifier = {
|
1266
|
+
kind: 'promoted';
|
1267
|
+
value: string;
|
1268
|
+
};
|
1269
|
+
declare const opaqueValidIdentifierName: unique symbol;
|
1270
|
+
type ValidIdentifierName = string & {
|
1271
|
+
[opaqueValidIdentifierName]: 'ValidIdentifierName';
|
1272
|
+
};
|
1273
|
+
declare enum ValueReason {
|
1274
|
+
Global = "global",
|
1275
|
+
JsxCaptured = "jsx-captured",
|
1276
|
+
KnownReturnSignature = "known-return-signature",
|
1277
|
+
Context = "context",
|
1278
|
+
State = "state",
|
1279
|
+
ReducerState = "reducer-state",
|
1280
|
+
ReactiveFunctionArgument = "reactive-function-argument",
|
1281
|
+
Other = "other"
|
1282
|
+
}
|
1283
|
+
declare enum ValueKind {
|
1284
|
+
MaybeFrozen = "maybefrozen",
|
1285
|
+
Frozen = "frozen",
|
1286
|
+
Primitive = "primitive",
|
1287
|
+
Global = "global",
|
1288
|
+
Mutable = "mutable",
|
1289
|
+
Context = "context"
|
1290
|
+
}
|
1291
|
+
declare enum Effect {
|
1292
|
+
Unknown = "<unknown>",
|
1293
|
+
Freeze = "freeze",
|
1294
|
+
Read = "read",
|
1295
|
+
Capture = "capture",
|
1296
|
+
ConditionallyMutate = "mutate?",
|
1297
|
+
Mutate = "mutate",
|
1298
|
+
Store = "store"
|
1299
|
+
}
|
1300
|
+
type ReactiveScope = {
|
1301
|
+
id: ScopeId;
|
1302
|
+
range: MutableRange;
|
1303
|
+
dependencies: ReactiveScopeDependencies;
|
1304
|
+
declarations: Map<IdentifierId, ReactiveScopeDeclaration>;
|
1305
|
+
reassignments: Set<Identifier>;
|
1306
|
+
earlyReturnValue: {
|
1307
|
+
value: Identifier;
|
1308
|
+
loc: SourceLocation;
|
1309
|
+
label: BlockId;
|
1310
|
+
} | null;
|
1311
|
+
merged: Set<ScopeId>;
|
1312
|
+
loc: SourceLocation;
|
1313
|
+
};
|
1314
|
+
type ReactiveScopeDependencies = Set<ReactiveScopeDependency>;
|
1315
|
+
type ReactiveScopeDeclaration = {
|
1316
|
+
identifier: Identifier;
|
1317
|
+
scope: ReactiveScope;
|
1318
|
+
};
|
1319
|
+
declare const opaquePropertyLiteral: unique symbol;
|
1320
|
+
type PropertyLiteral = (string | number) & {
|
1321
|
+
[opaquePropertyLiteral]: 'PropertyLiteral';
|
1322
|
+
};
|
1323
|
+
type DependencyPathEntry = {
|
1324
|
+
property: PropertyLiteral;
|
1325
|
+
optional: boolean;
|
1326
|
+
};
|
1327
|
+
type DependencyPath = Array<DependencyPathEntry>;
|
1328
|
+
type ReactiveScopeDependency = {
|
1329
|
+
identifier: Identifier;
|
1330
|
+
path: DependencyPath;
|
1331
|
+
};
|
1332
|
+
declare const opaqueBlockId: unique symbol;
|
1333
|
+
type BlockId = number & {
|
1334
|
+
[opaqueBlockId]: 'BlockId';
|
1335
|
+
};
|
1336
|
+
declare const opaqueScopeId: unique symbol;
|
1337
|
+
type ScopeId = number & {
|
1338
|
+
[opaqueScopeId]: 'ScopeId';
|
1339
|
+
};
|
1340
|
+
declare const opaqueIdentifierId: unique symbol;
|
1341
|
+
type IdentifierId = number & {
|
1342
|
+
[opaqueIdentifierId]: 'IdentifierId';
|
1343
|
+
};
|
1344
|
+
declare const opageDeclarationId: unique symbol;
|
1345
|
+
type DeclarationId = number & {
|
1346
|
+
[opageDeclarationId]: 'DeclarationId';
|
1347
|
+
};
|
1348
|
+
declare const opaqueInstructionId: unique symbol;
|
1349
|
+
type InstructionId = number & {
|
1350
|
+
[opaqueInstructionId]: 'IdentifierId';
|
1351
|
+
};
|
1352
|
+
|
1353
|
+
type Options = {
|
1354
|
+
indent: number;
|
1355
|
+
};
|
1356
|
+
declare function printHIR(ir: HIR, options?: Options | null): string;
|
1357
|
+
|
1358
|
+
declare enum ErrorSeverity {
|
1359
|
+
InvalidJS = "InvalidJS",
|
1360
|
+
InvalidReact = "InvalidReact",
|
1361
|
+
InvalidConfig = "InvalidConfig",
|
1362
|
+
CannotPreserveMemoization = "CannotPreserveMemoization",
|
1363
|
+
Todo = "Todo",
|
1364
|
+
Invariant = "Invariant"
|
1365
|
+
}
|
1366
|
+
declare enum CompilerSuggestionOperation {
|
1367
|
+
InsertBefore = 0,
|
1368
|
+
InsertAfter = 1,
|
1369
|
+
Remove = 2,
|
1370
|
+
Replace = 3
|
1371
|
+
}
|
1372
|
+
type CompilerSuggestion = {
|
1373
|
+
op: CompilerSuggestionOperation.InsertAfter | CompilerSuggestionOperation.InsertBefore | CompilerSuggestionOperation.Replace;
|
1374
|
+
range: [number, number];
|
1375
|
+
description: string;
|
1376
|
+
text: string;
|
1377
|
+
} | {
|
1378
|
+
op: CompilerSuggestionOperation.Remove;
|
1379
|
+
range: [number, number];
|
1380
|
+
description: string;
|
1381
|
+
};
|
1382
|
+
type CompilerErrorDetailOptions = {
|
1383
|
+
reason: string;
|
1384
|
+
description?: string | null | undefined;
|
1385
|
+
severity: ErrorSeverity;
|
1386
|
+
loc: SourceLocation | null;
|
1387
|
+
suggestions?: Array<CompilerSuggestion> | null | undefined;
|
1388
|
+
};
|
1389
|
+
declare class CompilerErrorDetail {
|
1390
|
+
options: CompilerErrorDetailOptions;
|
1391
|
+
constructor(options: CompilerErrorDetailOptions);
|
1392
|
+
get reason(): CompilerErrorDetailOptions['reason'];
|
1393
|
+
get description(): CompilerErrorDetailOptions['description'];
|
1394
|
+
get severity(): CompilerErrorDetailOptions['severity'];
|
1395
|
+
get loc(): CompilerErrorDetailOptions['loc'];
|
1396
|
+
get suggestions(): CompilerErrorDetailOptions['suggestions'];
|
1397
|
+
printErrorMessage(): string;
|
1398
|
+
toString(): string;
|
1399
|
+
}
|
1400
|
+
declare class CompilerError extends Error {
|
1401
|
+
details: Array<CompilerErrorDetail>;
|
1402
|
+
static invariant(condition: unknown, options: Omit<CompilerErrorDetailOptions, 'severity'>): asserts condition;
|
1403
|
+
static throwTodo(options: Omit<CompilerErrorDetailOptions, 'severity'>): never;
|
1404
|
+
static throwInvalidJS(options: Omit<CompilerErrorDetailOptions, 'severity'>): never;
|
1405
|
+
static throwInvalidReact(options: Omit<CompilerErrorDetailOptions, 'severity'>): never;
|
1406
|
+
static throwInvalidConfig(options: Omit<CompilerErrorDetailOptions, 'severity'>): never;
|
1407
|
+
static throw(options: CompilerErrorDetailOptions): never;
|
1408
|
+
constructor(...args: Array<any>);
|
1409
|
+
get message(): string;
|
1410
|
+
set message(_message: string);
|
1411
|
+
toString(): string;
|
1412
|
+
push(options: CompilerErrorDetailOptions): CompilerErrorDetail;
|
1413
|
+
pushErrorDetail(detail: CompilerErrorDetail): CompilerErrorDetail;
|
1414
|
+
hasErrors(): boolean;
|
1415
|
+
isCritical(): boolean;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
type CodegenFunction = {
|
1419
|
+
type: 'CodegenFunction';
|
1420
|
+
id: t.Identifier | null;
|
1421
|
+
params: t.FunctionDeclaration['params'];
|
1422
|
+
body: t.BlockStatement;
|
1423
|
+
generator: boolean;
|
1424
|
+
async: boolean;
|
1425
|
+
loc: SourceLocation;
|
1426
|
+
memoSlotsUsed: number;
|
1427
|
+
memoBlocks: number;
|
1428
|
+
memoValues: number;
|
1429
|
+
prunedMemoBlocks: number;
|
1430
|
+
prunedMemoValues: number;
|
1431
|
+
outlined: Array<{
|
1432
|
+
fn: CodegenFunction;
|
1433
|
+
type: ReactFunctionType | null;
|
1434
|
+
}>;
|
1435
|
+
hasLoweredContextAccess: boolean;
|
1436
|
+
hasFireRewrite: boolean;
|
1437
|
+
};
|
1438
|
+
|
1439
|
+
declare function printReactiveFunction(fn: ReactiveFunction): string;
|
1440
|
+
|
1441
|
+
type CompilerPipelineValue = {
|
1442
|
+
kind: 'ast';
|
1443
|
+
name: string;
|
1444
|
+
value: CodegenFunction;
|
1445
|
+
} | {
|
1446
|
+
kind: 'hir';
|
1447
|
+
name: string;
|
1448
|
+
value: HIRFunction;
|
1449
|
+
} | {
|
1450
|
+
kind: 'reactive';
|
1451
|
+
name: string;
|
1452
|
+
value: ReactiveFunction;
|
1453
|
+
} | {
|
1454
|
+
kind: 'debug';
|
1455
|
+
name: string;
|
1456
|
+
value: string;
|
1457
|
+
};
|
1458
|
+
declare function compileFn(func: NodePath<t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression>, config: EnvironmentConfig, fnType: ReactFunctionType, useMemoCacheIdentifier: string, logger: Logger | null, filename: string | null, code: string | null): CodegenFunction;
|
1459
|
+
|
1460
|
+
declare const PanicThresholdOptionsSchema: z.ZodEnum<["all_errors", "critical_errors", "none"]>;
|
1461
|
+
type PanicThresholdOptions = z.infer<typeof PanicThresholdOptionsSchema>;
|
1462
|
+
type PluginOptions = {
|
1463
|
+
environment: EnvironmentConfig;
|
1464
|
+
logger: Logger | null;
|
1465
|
+
gating: ExternalFunction | null;
|
1466
|
+
panicThreshold: PanicThresholdOptions;
|
1467
|
+
noEmit: boolean;
|
1468
|
+
compilationMode: CompilationMode;
|
1469
|
+
eslintSuppressionRules?: Array<string> | null | undefined;
|
1470
|
+
flowSuppressions: boolean;
|
1471
|
+
ignoreUseNoForget: boolean;
|
1472
|
+
sources?: Array<string> | ((filename: string) => boolean) | null;
|
1473
|
+
enableReanimatedCheck: boolean;
|
1474
|
+
target: CompilerReactTarget;
|
1475
|
+
};
|
1476
|
+
declare const CompilerReactTargetSchema: z.ZodUnion<[z.ZodLiteral<"17">, z.ZodLiteral<"18">, z.ZodLiteral<"19">, z.ZodObject<{
|
1477
|
+
kind: z.ZodLiteral<"donotuse_meta_internal">;
|
1478
|
+
runtimeModule: z.ZodDefault<z.ZodString>;
|
1479
|
+
}, "strip", z.ZodTypeAny, {
|
1480
|
+
kind: "donotuse_meta_internal";
|
1481
|
+
runtimeModule: string;
|
1482
|
+
}, {
|
1483
|
+
kind: "donotuse_meta_internal";
|
1484
|
+
runtimeModule?: string | undefined;
|
1485
|
+
}>]>;
|
1486
|
+
type CompilerReactTarget = z.infer<typeof CompilerReactTargetSchema>;
|
1487
|
+
declare const CompilationModeSchema: z.ZodEnum<["infer", "syntax", "annotation", "all"]>;
|
1488
|
+
type CompilationMode = z.infer<typeof CompilationModeSchema>;
|
1489
|
+
type LoggerEvent = CompileSuccessEvent | CompileErrorEvent | CompileDiagnosticEvent | CompileSkipEvent | PipelineErrorEvent | TimingEvent;
|
1490
|
+
type CompileErrorEvent = {
|
1491
|
+
kind: 'CompileError';
|
1492
|
+
fnLoc: t.SourceLocation | null;
|
1493
|
+
detail: CompilerErrorDetailOptions;
|
1494
|
+
};
|
1495
|
+
type CompileDiagnosticEvent = {
|
1496
|
+
kind: 'CompileDiagnostic';
|
1497
|
+
fnLoc: t.SourceLocation | null;
|
1498
|
+
detail: Omit<Omit<CompilerErrorDetailOptions, 'severity'>, 'suggestions'>;
|
1499
|
+
};
|
1500
|
+
type CompileSuccessEvent = {
|
1501
|
+
kind: 'CompileSuccess';
|
1502
|
+
fnLoc: t.SourceLocation | null;
|
1503
|
+
fnName: string | null;
|
1504
|
+
memoSlots: number;
|
1505
|
+
memoBlocks: number;
|
1506
|
+
memoValues: number;
|
1507
|
+
prunedMemoBlocks: number;
|
1508
|
+
prunedMemoValues: number;
|
1509
|
+
};
|
1510
|
+
type CompileSkipEvent = {
|
1511
|
+
kind: 'CompileSkip';
|
1512
|
+
fnLoc: t.SourceLocation | null;
|
1513
|
+
reason: string;
|
1514
|
+
loc: t.SourceLocation | null;
|
1515
|
+
};
|
1516
|
+
type PipelineErrorEvent = {
|
1517
|
+
kind: 'PipelineError';
|
1518
|
+
fnLoc: t.SourceLocation | null;
|
1519
|
+
data: string;
|
1520
|
+
};
|
1521
|
+
type TimingEvent = {
|
1522
|
+
kind: 'Timing';
|
1523
|
+
measurement: PerformanceMeasure;
|
1524
|
+
};
|
1525
|
+
type Logger = {
|
1526
|
+
logEvent: (filename: string | null, event: LoggerEvent) => void;
|
1527
|
+
debugLogIRs?: (value: CompilerPipelineValue) => void;
|
1528
|
+
};
|
1529
|
+
declare function parsePluginOptions(obj: unknown): PluginOptions;
|
1530
|
+
|
1531
|
+
type CompilerPass = {
|
1532
|
+
opts: PluginOptions;
|
1533
|
+
filename: string | null;
|
1534
|
+
comments: Array<t.CommentBlock | t.CommentLine>;
|
1535
|
+
code: string | null;
|
1536
|
+
};
|
1537
|
+
declare const OPT_IN_DIRECTIVES: Set<string>;
|
1538
|
+
declare const OPT_OUT_DIRECTIVES: Set<string>;
|
1539
|
+
declare function findDirectiveEnablingMemoization(directives: Array<t.Directive>): Array<t.Directive>;
|
1540
|
+
declare function findDirectiveDisablingMemoization(directives: Array<t.Directive>): Array<t.Directive>;
|
1541
|
+
declare function compileProgram(program: NodePath$1<t.Program>, pass: CompilerPass): void;
|
1542
|
+
|
1543
|
+
declare function runBabelPluginReactCompiler(text: string, file: string, language: 'flow' | 'typescript', options: Partial<PluginOptions> | null, includeAst?: boolean): BabelCore.BabelFileResult;
|
1544
|
+
|
1545
|
+
declare function BabelPluginReactCompiler(_babel: typeof BabelCore): BabelCore.PluginObj;
|
1546
|
+
|
1547
|
+
declare global {
|
1548
|
+
let __DEV__: boolean | null | undefined;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
export { CompilerError, CompilerErrorDetail, type CompilerErrorDetailOptions, type CompilerPipelineValue, CompilerSuggestionOperation, Effect, type EnvironmentConfig, ErrorSeverity, type ExternalFunction, type Hook, OPT_IN_DIRECTIVES, OPT_OUT_DIRECTIVES, type PluginOptions, type SourceLocation, ValueKind, compileFn as compile, compileProgram, BabelPluginReactCompiler as default, findDirectiveDisablingMemoization, findDirectiveEnablingMemoization, parseConfigPragmaForTests, parsePluginOptions, printHIR, printReactiveFunction, runBabelPluginReactCompiler, validateEnvironmentConfig };
|