@sanity/cli-build 0.1.1 → 0.2.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.
Files changed (90) hide show
  1. package/dist/_exports/_internal/build.d.ts +2418 -0
  2. package/dist/_exports/_internal/build.js +10 -0
  3. package/dist/_exports/_internal/build.js.map +1 -0
  4. package/dist/_exports/_internal/extract.d.ts +120 -0
  5. package/dist/_exports/_internal/extract.js +9 -0
  6. package/dist/_exports/_internal/extract.js.map +1 -0
  7. package/dist/actions/build/buildDebug.js +4 -0
  8. package/dist/actions/build/buildDebug.js.map +1 -0
  9. package/dist/actions/build/buildVendorDependencies.js +149 -0
  10. package/dist/actions/build/buildVendorDependencies.js.map +1 -0
  11. package/dist/actions/build/checkStudioDependencyVersions.js +155 -0
  12. package/dist/actions/build/checkStudioDependencyVersions.js.map +1 -0
  13. package/dist/actions/build/createExternalFromImportMap.js +11 -0
  14. package/dist/actions/build/createExternalFromImportMap.js.map +1 -0
  15. package/dist/actions/build/decorateIndexWithAutoGeneratedWarning.js +13 -0
  16. package/dist/actions/build/decorateIndexWithAutoGeneratedWarning.js.map +1 -0
  17. package/dist/actions/build/decorateIndexWithBridgeScript.js +17 -0
  18. package/dist/actions/build/decorateIndexWithBridgeScript.js.map +1 -0
  19. package/dist/actions/build/decorateIndexWithStagingScript.js +16 -0
  20. package/dist/actions/build/decorateIndexWithStagingScript.js.map +1 -0
  21. package/dist/actions/build/getEntryModule.js +46 -0
  22. package/dist/actions/build/getEntryModule.js.map +1 -0
  23. package/dist/actions/build/getPossibleDocumentComponentLocations.js +11 -0
  24. package/dist/actions/build/getPossibleDocumentComponentLocations.js.map +1 -0
  25. package/dist/actions/build/getViteConfig.js +204 -0
  26. package/dist/actions/build/getViteConfig.js.map +1 -0
  27. package/dist/actions/build/normalizeBasePath.js +9 -0
  28. package/dist/actions/build/normalizeBasePath.js.map +1 -0
  29. package/dist/actions/build/renderDocument.js +50 -0
  30. package/dist/actions/build/renderDocument.js.map +1 -0
  31. package/dist/actions/build/renderDocument.worker.js +9 -0
  32. package/dist/actions/build/renderDocument.worker.js.map +1 -0
  33. package/dist/actions/build/renderDocumentWorker/addTimestampImportMapScriptToHtml.js +79 -0
  34. package/dist/actions/build/renderDocumentWorker/addTimestampImportMapScriptToHtml.js.map +1 -0
  35. package/dist/actions/build/renderDocumentWorker/components/BasicDocument.js +61 -0
  36. package/dist/actions/build/renderDocumentWorker/components/BasicDocument.js.map +1 -0
  37. package/dist/actions/build/renderDocumentWorker/components/DefaultDocument.js +165 -0
  38. package/dist/actions/build/renderDocumentWorker/components/DefaultDocument.js.map +1 -0
  39. package/dist/actions/build/renderDocumentWorker/components/Favicons.js +28 -0
  40. package/dist/actions/build/renderDocumentWorker/components/Favicons.js.map +1 -0
  41. package/dist/actions/build/renderDocumentWorker/components/GlobalErrorHandler.js +178 -0
  42. package/dist/actions/build/renderDocumentWorker/components/GlobalErrorHandler.js.map +1 -0
  43. package/dist/actions/build/renderDocumentWorker/components/NoJavascript.js +51 -0
  44. package/dist/actions/build/renderDocumentWorker/components/NoJavascript.js.map +1 -0
  45. package/dist/actions/build/renderDocumentWorker/getDocumentComponent.js +41 -0
  46. package/dist/actions/build/renderDocumentWorker/getDocumentComponent.js.map +1 -0
  47. package/dist/actions/build/renderDocumentWorker/getDocumentHtml.js +55 -0
  48. package/dist/actions/build/renderDocumentWorker/getDocumentHtml.js.map +1 -0
  49. package/dist/actions/build/renderDocumentWorker/renderDocumentWorker.js +31 -0
  50. package/dist/actions/build/renderDocumentWorker/renderDocumentWorker.js.map +1 -0
  51. package/dist/actions/build/renderDocumentWorker/tryLoadDocumentComponent.js +30 -0
  52. package/dist/actions/build/renderDocumentWorker/tryLoadDocumentComponent.js.map +1 -0
  53. package/dist/actions/build/renderDocumentWorker/types.js +5 -0
  54. package/dist/actions/build/renderDocumentWorker/types.js.map +1 -0
  55. package/dist/actions/build/vite/plugin-sanity-build-entries.js +67 -0
  56. package/dist/actions/build/vite/plugin-sanity-build-entries.js.map +1 -0
  57. package/dist/actions/build/vite/plugin-sanity-favicons.js +72 -0
  58. package/dist/actions/build/vite/plugin-sanity-favicons.js.map +1 -0
  59. package/dist/actions/build/vite/plugin-sanity-runtime-rewrite.js +18 -0
  60. package/dist/actions/build/vite/plugin-sanity-runtime-rewrite.js.map +1 -0
  61. package/dist/actions/build/writeSanityRuntime.js +66 -0
  62. package/dist/actions/build/writeSanityRuntime.js.map +1 -0
  63. package/dist/actions/schema/extractSanitySchema.worker.js +32 -0
  64. package/dist/actions/schema/extractSanitySchema.worker.js.map +1 -0
  65. package/dist/actions/schema/formatSchemaValidation.js +78 -0
  66. package/dist/actions/schema/formatSchemaValidation.js.map +1 -0
  67. package/dist/actions/schema/getExtractOptions.js +23 -0
  68. package/dist/actions/schema/getExtractOptions.js.map +1 -0
  69. package/dist/actions/schema/matchSchemaPattern.js +21 -0
  70. package/dist/actions/schema/matchSchemaPattern.js.map +1 -0
  71. package/dist/actions/schema/runSchemaExtraction.js +39 -0
  72. package/dist/actions/schema/runSchemaExtraction.js.map +1 -0
  73. package/dist/actions/schema/types.js +9 -0
  74. package/dist/actions/schema/types.js.map +1 -0
  75. package/dist/actions/schema/utils/SchemaExtractionError.js +10 -0
  76. package/dist/actions/schema/utils/SchemaExtractionError.js.map +1 -0
  77. package/dist/actions/schema/utils/extractValidationFromSchemaError.js +12 -0
  78. package/dist/actions/schema/utils/extractValidationFromSchemaError.js.map +1 -0
  79. package/dist/actions/schema/vite/plugin-schema-extraction.js +201 -0
  80. package/dist/actions/schema/vite/plugin-schema-extraction.js.map +1 -0
  81. package/dist/constants.js +8 -0
  82. package/dist/constants.js.map +1 -0
  83. package/dist/telemetry/build.telemetry.js +13 -0
  84. package/dist/telemetry/build.telemetry.js.map +1 -0
  85. package/dist/telemetry/extractSchema.telemetry.js +18 -0
  86. package/dist/telemetry/extractSchema.telemetry.js.map +1 -0
  87. package/package.json +38 -9
  88. package/dist/_exports/_internal.d.ts +0 -45
  89. package/dist/_exports/_internal.js +0 -5
  90. package/dist/_exports/_internal.js.map +0 -1
@@ -0,0 +1,2418 @@
1
+ import { CliConfig } from "@sanity/cli-core";
2
+ import { ConfigEnv } from "vite";
3
+ import { Debugger } from "debug";
4
+ import { DefinedTelemetryTrace } from "@sanity/telemetry";
5
+ import { FSWatcher } from "chokidar";
6
+ import { InlineConfig } from "vite";
7
+ import { NodePath } from "@babel/core";
8
+ import { NodePath as NodePath_2 } from "@babel/traverse";
9
+ import { Output } from "@sanity/cli-core";
10
+ import { Plugin as Plugin_2 } from "vite";
11
+ import { Scope } from "@babel/traverse";
12
+ import * as t from "@babel/types";
13
+ import { UserViteConfig } from "@sanity/cli-core";
14
+ import { z } from "zod";
15
+
16
+ declare type AliasingEffect =
17
+ | {
18
+ kind: "Freeze";
19
+ value: Place;
20
+ reason: ValueReason;
21
+ }
22
+ | {
23
+ kind: "Mutate";
24
+ value: Place;
25
+ reason?: MutationReason | null;
26
+ }
27
+ | {
28
+ kind: "MutateConditionally";
29
+ value: Place;
30
+ }
31
+ | {
32
+ kind: "MutateTransitive";
33
+ value: Place;
34
+ }
35
+ | {
36
+ kind: "MutateTransitiveConditionally";
37
+ value: Place;
38
+ }
39
+ | {
40
+ kind: "Capture";
41
+ from: Place;
42
+ into: Place;
43
+ }
44
+ | {
45
+ kind: "Alias";
46
+ from: Place;
47
+ into: Place;
48
+ }
49
+ | {
50
+ kind: "MaybeAlias";
51
+ from: Place;
52
+ into: Place;
53
+ }
54
+ | {
55
+ kind: "Assign";
56
+ from: Place;
57
+ into: Place;
58
+ }
59
+ | {
60
+ kind: "Create";
61
+ into: Place;
62
+ value: ValueKind;
63
+ reason: ValueReason;
64
+ }
65
+ | {
66
+ kind: "CreateFrom";
67
+ from: Place;
68
+ into: Place;
69
+ }
70
+ | {
71
+ kind: "ImmutableCapture";
72
+ from: Place;
73
+ into: Place;
74
+ }
75
+ | {
76
+ kind: "Apply";
77
+ receiver: Place;
78
+ function: Place;
79
+ mutatesFunction: boolean;
80
+ args: Array<Place | SpreadPattern | Hole>;
81
+ into: Place;
82
+ signature: FunctionSignature | null;
83
+ loc: SourceLocation;
84
+ }
85
+ | {
86
+ kind: "CreateFunction";
87
+ captures: Array<Place>;
88
+ function: FunctionExpression | ObjectMethod;
89
+ into: Place;
90
+ }
91
+ | {
92
+ kind: "MutateFrozen";
93
+ place: Place;
94
+ error: CompilerDiagnostic;
95
+ }
96
+ | {
97
+ kind: "MutateGlobal";
98
+ place: Place;
99
+ error: CompilerDiagnostic;
100
+ }
101
+ | {
102
+ kind: "Impure";
103
+ place: Place;
104
+ error: CompilerDiagnostic;
105
+ }
106
+ | {
107
+ kind: "Render";
108
+ place: Place;
109
+ };
110
+
111
+ declare type AliasingSignature = {
112
+ receiver: IdentifierId;
113
+ params: Array<IdentifierId>;
114
+ rest: IdentifierId | null;
115
+ returns: IdentifierId;
116
+ effects: Array<AliasingEffect>;
117
+ temporaries: Array<Place>;
118
+ };
119
+
120
+ export declare const AppBuildTrace: DefinedTelemetryTrace<
121
+ {
122
+ outputSize: number;
123
+ },
124
+ void
125
+ >;
126
+
127
+ declare type ArrayExpression = {
128
+ kind: "ArrayExpression";
129
+ elements: Array<Place | SpreadPattern | Hole>;
130
+ loc: SourceLocation;
131
+ };
132
+
133
+ declare type ArrayPattern = {
134
+ kind: "ArrayPattern";
135
+ items: Array<Place | SpreadPattern | Hole>;
136
+ };
137
+
138
+ declare type AutoDepsDecorationsEvent = {
139
+ kind: "AutoDepsDecorations";
140
+ fnLoc: t.SourceLocation;
141
+ decorations: Array<t.SourceLocation>;
142
+ };
143
+
144
+ declare type AutoDepsEligibleEvent = {
145
+ kind: "AutoDepsEligible";
146
+ fnLoc: t.SourceLocation;
147
+ depArrayLoc: t.SourceLocation;
148
+ };
149
+
150
+ declare type BabelFn =
151
+ | NodePath<t.FunctionDeclaration>
152
+ | NodePath<t.FunctionExpression>
153
+ | NodePath<t.ArrowFunctionExpression>;
154
+
155
+ declare type BasicBlock = {
156
+ kind: BlockKind;
157
+ id: BlockId;
158
+ instructions: Array<Instruction>;
159
+ terminal: Terminal;
160
+ preds: Set<BlockId>;
161
+ phis: Set<Phi>;
162
+ };
163
+
164
+ declare type BlockId = number & {
165
+ [opaqueBlockId]: "BlockId";
166
+ };
167
+
168
+ declare type BlockKind = "block" | "value" | "loop" | "sequence" | "catch";
169
+
170
+ declare type BranchTerminal = {
171
+ kind: "branch";
172
+ test: Place;
173
+ consequent: BlockId;
174
+ alternate: BlockId;
175
+ id: InstructionId;
176
+ loc: SourceLocation;
177
+ fallthrough: BlockId;
178
+ };
179
+
180
+ export declare const buildDebug: Debugger;
181
+
182
+ /**
183
+ * Builds the ESM browser compatible versions of the vendor packages
184
+ * specified in VENDOR_IMPORTS. Returns the `imports` object of an import map.
185
+ */
186
+ export declare function buildVendorDependencies({
187
+ basePath,
188
+ cwd,
189
+ isApp,
190
+ outputDir,
191
+ }: VendorBuildOptions): Promise<Record<string, string>>;
192
+
193
+ declare type BuiltinTag = {
194
+ kind: "BuiltinTag";
195
+ name: string;
196
+ loc: SourceLocation;
197
+ };
198
+
199
+ declare type BuiltInType = PrimitiveType | FunctionType | ObjectType;
200
+
201
+ declare type CallExpression = {
202
+ kind: "CallExpression";
203
+ callee: Place;
204
+ args: Array<Place | SpreadPattern>;
205
+ loc: SourceLocation;
206
+ typeArguments?: Array<t.FlowType>;
207
+ };
208
+
209
+ declare type Case = {
210
+ test: Place | null;
211
+ block: BlockId;
212
+ };
213
+
214
+ export declare function checkStudioDependencyVersions(
215
+ workDir: string,
216
+ output: Output,
217
+ {
218
+ packages,
219
+ }?: {
220
+ packages?: TrackedPackage[];
221
+ },
222
+ ): Promise<void>;
223
+
224
+ declare type CodegenFunction = {
225
+ type: "CodegenFunction";
226
+ id: t.Identifier | null;
227
+ nameHint: string | null;
228
+ params: t.FunctionDeclaration["params"];
229
+ body: t.BlockStatement;
230
+ generator: boolean;
231
+ async: boolean;
232
+ loc: SourceLocation;
233
+ memoSlotsUsed: number;
234
+ memoBlocks: number;
235
+ memoValues: number;
236
+ prunedMemoBlocks: number;
237
+ prunedMemoValues: number;
238
+ outlined: Array<{
239
+ fn: CodegenFunction;
240
+ type: ReactFunctionType | null;
241
+ }>;
242
+ hasInferredEffect: boolean;
243
+ inferredEffectLocations: Set<SourceLocation>;
244
+ hasFireRewrite: boolean;
245
+ };
246
+
247
+ declare type CompilationMode = z.infer<typeof CompilationModeSchema>;
248
+
249
+ declare const CompilationModeSchema: z.ZodEnum<{
250
+ syntax: "syntax";
251
+ infer: "infer";
252
+ annotation: "annotation";
253
+ all: "all";
254
+ }>;
255
+
256
+ declare type CompileDiagnosticEvent = {
257
+ kind: "CompileDiagnostic";
258
+ fnLoc: t.SourceLocation | null;
259
+ detail: Omit<Omit<CompilerErrorDetailOptions, "severity">, "suggestions">;
260
+ };
261
+
262
+ declare type CompileErrorEvent = {
263
+ kind: "CompileError";
264
+ fnLoc: t.SourceLocation | null;
265
+ detail: CompilerErrorDetail | CompilerDiagnostic;
266
+ };
267
+
268
+ declare class CompilerDiagnostic {
269
+ options: CompilerDiagnosticOptions;
270
+ constructor(options: CompilerDiagnosticOptions);
271
+ static create(
272
+ options: Omit<CompilerDiagnosticOptions, "details">,
273
+ ): CompilerDiagnostic;
274
+ get reason(): CompilerDiagnosticOptions["reason"];
275
+ get description(): CompilerDiagnosticOptions["description"];
276
+ get severity(): ErrorSeverity;
277
+ get suggestions(): CompilerDiagnosticOptions["suggestions"];
278
+ get category(): ErrorCategory;
279
+ withDetails(...details: Array<CompilerDiagnosticDetail>): CompilerDiagnostic;
280
+ primaryLocation(): SourceLocation | null;
281
+ printErrorMessage(source: string, options: PrintErrorMessageOptions): string;
282
+ toString(): string;
283
+ }
284
+
285
+ declare type CompilerDiagnosticDetail =
286
+ | {
287
+ kind: "error";
288
+ loc: SourceLocation | null;
289
+ message: string | null;
290
+ }
291
+ | {
292
+ kind: "hint";
293
+ message: string;
294
+ };
295
+
296
+ declare type CompilerDiagnosticOptions = {
297
+ category: ErrorCategory;
298
+ reason: string;
299
+ description: string | null;
300
+ details: Array<CompilerDiagnosticDetail>;
301
+ suggestions?: Array<CompilerSuggestion> | null | undefined;
302
+ };
303
+
304
+ declare class CompilerError extends Error {
305
+ details: Array<CompilerErrorDetail | CompilerDiagnostic>;
306
+ disabledDetails: Array<CompilerErrorDetail | CompilerDiagnostic>;
307
+ printedMessage: string | null;
308
+ static invariant(
309
+ condition: unknown,
310
+ options: Omit<CompilerDiagnosticOptions, "category">,
311
+ ): asserts condition;
312
+ static throwDiagnostic(options: CompilerDiagnosticOptions): never;
313
+ static throwTodo(
314
+ options: Omit<CompilerErrorDetailOptions, "category">,
315
+ ): never;
316
+ static throwInvalidJS(
317
+ options: Omit<CompilerErrorDetailOptions, "category">,
318
+ ): never;
319
+ static throwInvalidReact(options: CompilerErrorDetailOptions): never;
320
+ static throwInvalidConfig(
321
+ options: Omit<CompilerErrorDetailOptions, "category">,
322
+ ): never;
323
+ static throw(options: CompilerErrorDetailOptions): never;
324
+ constructor(...args: Array<any>);
325
+ get message(): string;
326
+ set message(_message: string);
327
+ toString(): string;
328
+ withPrintedMessage(
329
+ source: string,
330
+ options: PrintErrorMessageOptions,
331
+ ): CompilerError;
332
+ printErrorMessage(source: string, options: PrintErrorMessageOptions): string;
333
+ merge(other: CompilerError): void;
334
+ pushDiagnostic(diagnostic: CompilerDiagnostic): void;
335
+ push(options: CompilerErrorDetailOptions): CompilerErrorDetail;
336
+ pushErrorDetail(detail: CompilerErrorDetail): CompilerErrorDetail;
337
+ hasAnyErrors(): boolean;
338
+ asResult(): Result<void, CompilerError>;
339
+ hasErrors(): boolean;
340
+ hasWarning(): boolean;
341
+ hasHints(): boolean;
342
+ }
343
+
344
+ declare class CompilerErrorDetail {
345
+ options: CompilerErrorDetailOptions;
346
+ constructor(options: CompilerErrorDetailOptions);
347
+ get reason(): CompilerErrorDetailOptions["reason"];
348
+ get description(): CompilerErrorDetailOptions["description"];
349
+ get severity(): ErrorSeverity;
350
+ get loc(): CompilerErrorDetailOptions["loc"];
351
+ get suggestions(): CompilerErrorDetailOptions["suggestions"];
352
+ get category(): ErrorCategory;
353
+ primaryLocation(): SourceLocation | null;
354
+ printErrorMessage(source: string, options: PrintErrorMessageOptions): string;
355
+ toString(): string;
356
+ }
357
+
358
+ declare type CompilerErrorDetailOptions = {
359
+ category: ErrorCategory;
360
+ reason: string;
361
+ description?: string | null | undefined;
362
+ loc: SourceLocation | null;
363
+ suggestions?: Array<CompilerSuggestion> | null | undefined;
364
+ };
365
+
366
+ declare type CompilerMode = "all_features" | "no_inferred_memo";
367
+
368
+ declare type CompilerPipelineValue =
369
+ | {
370
+ kind: "ast";
371
+ name: string;
372
+ value: CodegenFunction;
373
+ }
374
+ | {
375
+ kind: "hir";
376
+ name: string;
377
+ value: HIRFunction;
378
+ }
379
+ | {
380
+ kind: "reactive";
381
+ name: string;
382
+ value: ReactiveFunction;
383
+ }
384
+ | {
385
+ kind: "debug";
386
+ name: string;
387
+ value: string;
388
+ };
389
+
390
+ declare type CompilerReactTarget = z.infer<typeof CompilerReactTargetSchema>;
391
+
392
+ declare const CompilerReactTargetSchema: z.ZodUnion<
393
+ readonly [
394
+ z.ZodLiteral<"17">,
395
+ z.ZodLiteral<"18">,
396
+ z.ZodLiteral<"19">,
397
+ z.ZodObject<
398
+ {
399
+ kind: z.ZodLiteral<"donotuse_meta_internal">;
400
+ runtimeModule: z.ZodDefault<z.ZodString>;
401
+ },
402
+ z.core.$strip
403
+ >,
404
+ ]
405
+ >;
406
+
407
+ declare type CompilerSuggestion =
408
+ | {
409
+ op:
410
+ | CompilerSuggestionOperation.InsertAfter
411
+ | CompilerSuggestionOperation.InsertBefore
412
+ | CompilerSuggestionOperation.Replace;
413
+ range: [number, number];
414
+ description: string;
415
+ text: string;
416
+ }
417
+ | {
418
+ op: CompilerSuggestionOperation.Remove;
419
+ range: [number, number];
420
+ description: string;
421
+ };
422
+
423
+ declare enum CompilerSuggestionOperation {
424
+ InsertBefore = 0,
425
+ InsertAfter = 1,
426
+ Remove = 2,
427
+ Replace = 3,
428
+ }
429
+
430
+ declare type CompileSkipEvent = {
431
+ kind: "CompileSkip";
432
+ fnLoc: t.SourceLocation | null;
433
+ reason: string;
434
+ loc: t.SourceLocation | null;
435
+ };
436
+
437
+ declare type CompileSuccessEvent = {
438
+ kind: "CompileSuccess";
439
+ fnLoc: t.SourceLocation | null;
440
+ fnName: string | null;
441
+ memoSlots: number;
442
+ memoBlocks: number;
443
+ memoValues: number;
444
+ prunedMemoBlocks: number;
445
+ prunedMemoValues: number;
446
+ };
447
+
448
+ declare type ComponentType<T> = {
449
+ kind: "Component";
450
+ props: Map<string, T>;
451
+ children: null | T;
452
+ };
453
+
454
+ declare type ConcreteType<T> =
455
+ | {
456
+ kind: "Enum";
457
+ }
458
+ | {
459
+ kind: "Mixed";
460
+ }
461
+ | {
462
+ kind: "Number";
463
+ }
464
+ | {
465
+ kind: "String";
466
+ }
467
+ | {
468
+ kind: "Boolean";
469
+ }
470
+ | {
471
+ kind: "Void";
472
+ }
473
+ | {
474
+ kind: "Nullable";
475
+ type: T;
476
+ }
477
+ | {
478
+ kind: "Array";
479
+ element: T;
480
+ }
481
+ | {
482
+ kind: "Set";
483
+ element: T;
484
+ }
485
+ | {
486
+ kind: "Map";
487
+ key: T;
488
+ value: T;
489
+ }
490
+ | {
491
+ kind: "Function";
492
+ typeParameters: null | Array<TypeParameter<T>>;
493
+ params: Array<T>;
494
+ returnType: T;
495
+ }
496
+ | ComponentType<T>
497
+ | {
498
+ kind: "Generic";
499
+ id: TypeParameterId;
500
+ bound: T;
501
+ }
502
+ | {
503
+ kind: "Object";
504
+ id: NominalId;
505
+ members: Map<string, ResolvedType>;
506
+ }
507
+ | {
508
+ kind: "Tuple";
509
+ id: NominalId;
510
+ members: Array<T>;
511
+ }
512
+ | {
513
+ kind: "Structural";
514
+ id: LinearId;
515
+ }
516
+ | {
517
+ kind: "Union";
518
+ members: Array<T>;
519
+ }
520
+ | {
521
+ kind: "Instance";
522
+ name: string;
523
+ members: Map<string, ResolvedType>;
524
+ };
525
+
526
+ /**
527
+ * Copies a directory from one location to another
528
+ *
529
+ * @internal
530
+ *
531
+ * @param srcDir - Source directory
532
+ * @param destDir - Destination directory
533
+ * @param skipExisting - Skip existing files
534
+ */
535
+ export declare function copyDir(
536
+ srcDir: string,
537
+ destDir: string,
538
+ skipExisting?: boolean,
539
+ ): Promise<void>;
540
+
541
+ declare type CustomOptOutDirective = z.infer<
542
+ typeof CustomOptOutDirectiveSchema
543
+ >;
544
+
545
+ declare const CustomOptOutDirectiveSchema: z.ZodDefault<
546
+ z.ZodNullable<z.ZodArray<z.ZodString>>
547
+ >;
548
+
549
+ declare type DeclarationId = number & {
550
+ [opageDeclarationId]: "DeclarationId";
551
+ };
552
+
553
+ declare type DependencyPath = Array<DependencyPathEntry>;
554
+
555
+ declare type DependencyPathEntry = {
556
+ property: PropertyLiteral;
557
+ optional: boolean;
558
+ };
559
+
560
+ declare type Destructure = {
561
+ kind: "Destructure";
562
+ lvalue: LValuePattern;
563
+ value: Place;
564
+ loc: SourceLocation;
565
+ };
566
+
567
+ declare type DoWhileTerminal = {
568
+ kind: "do-while";
569
+ loop: BlockId;
570
+ test: BlockId;
571
+ fallthrough: BlockId;
572
+ id: InstructionId;
573
+ loc: SourceLocation;
574
+ };
575
+
576
+ declare type DynamicGatingOptions = z.infer<typeof DynamicGatingOptionsSchema>;
577
+
578
+ declare const DynamicGatingOptionsSchema: z.ZodObject<
579
+ {
580
+ source: z.ZodString;
581
+ },
582
+ z.core.$strip
583
+ >;
584
+
585
+ declare enum Effect {
586
+ Unknown = "<unknown>",
587
+ Freeze = "freeze",
588
+ Read = "read",
589
+ Capture = "capture",
590
+ ConditionallyMutateIterator = "mutate-iterator?",
591
+ ConditionallyMutate = "mutate?",
592
+ Mutate = "mutate",
593
+ Store = "store",
594
+ }
595
+
596
+ declare class Environment {
597
+ #private;
598
+ logger: Logger | null;
599
+ filename: string | null;
600
+ code: string | null;
601
+ config: EnvironmentConfig;
602
+ fnType: ReactFunctionType;
603
+ compilerMode: CompilerMode;
604
+ programContext: ProgramContext;
605
+ hasFireRewrite: boolean;
606
+ hasInferredEffect: boolean;
607
+ inferredEffectLocations: Set<SourceLocation>;
608
+ parentFunction: NodePath_2<t.Function>;
609
+ constructor(
610
+ scope: Scope,
611
+ fnType: ReactFunctionType,
612
+ compilerMode: CompilerMode,
613
+ config: EnvironmentConfig,
614
+ contextIdentifiers: Set<t.Identifier>,
615
+ parentFunction: NodePath_2<t.Function>,
616
+ logger: Logger | null,
617
+ filename: string | null,
618
+ code: string | null,
619
+ programContext: ProgramContext,
620
+ );
621
+ get typeContext(): FlowTypeEnv;
622
+ get isInferredMemoEnabled(): boolean;
623
+ get nextIdentifierId(): IdentifierId;
624
+ get nextBlockId(): BlockId;
625
+ get nextScopeId(): ScopeId;
626
+ get scope(): Scope;
627
+ logErrors(errors: Result<void, CompilerError>): void;
628
+ isContextIdentifier(node: t.Identifier): boolean;
629
+ isHoistedIdentifier(node: t.Identifier): boolean;
630
+ generateGloballyUniqueIdentifierName(
631
+ name: string | null,
632
+ ): ValidatedIdentifier;
633
+ outlineFunction(fn: HIRFunction, type: ReactFunctionType | null): void;
634
+ getOutlinedFunctions(): Array<{
635
+ fn: HIRFunction;
636
+ type: ReactFunctionType | null;
637
+ }>;
638
+ getGlobalDeclaration(
639
+ binding: NonLocalBinding,
640
+ loc: SourceLocation,
641
+ ): Global_2 | null;
642
+ static knownReactModules: ReadonlyArray<string>;
643
+ getFallthroughPropertyType(
644
+ receiver: Type,
645
+ _property: Type,
646
+ ): BuiltInType | PolyType | null;
647
+ getPropertyType(
648
+ receiver: Type,
649
+ property: string | number,
650
+ ): BuiltInType | PolyType | null;
651
+ getFunctionSignature(type: FunctionType): FunctionSignature | null;
652
+ addHoistedIdentifier(node: t.Identifier): void;
653
+ }
654
+
655
+ declare type EnvironmentConfig = z.infer<typeof EnvironmentConfigSchema>;
656
+
657
+ declare const EnvironmentConfigSchema: z.ZodObject<
658
+ {
659
+ customHooks: z.ZodDefault<
660
+ z.ZodMap<
661
+ z.ZodString,
662
+ z.ZodObject<
663
+ {
664
+ effectKind: z.ZodEnum<typeof Effect>;
665
+ valueKind: z.ZodEnum<typeof ValueKind>;
666
+ noAlias: z.ZodDefault<z.ZodBoolean>;
667
+ transitiveMixedData: z.ZodDefault<z.ZodBoolean>;
668
+ },
669
+ z.core.$strip
670
+ >
671
+ >
672
+ >;
673
+ moduleTypeProvider: z.ZodDefault<z.ZodNullable<z.ZodAny>>;
674
+ customMacros: z.ZodDefault<
675
+ z.ZodNullable<
676
+ z.ZodArray<
677
+ z.ZodUnion<
678
+ readonly [
679
+ z.ZodString,
680
+ z.ZodTuple<
681
+ [
682
+ z.ZodString,
683
+ z.ZodArray<
684
+ z.ZodUnion<
685
+ readonly [
686
+ z.ZodObject<
687
+ {
688
+ type: z.ZodLiteral<"wildcard">;
689
+ },
690
+ z.core.$strip
691
+ >,
692
+ z.ZodObject<
693
+ {
694
+ type: z.ZodLiteral<"name">;
695
+ name: z.ZodString;
696
+ },
697
+ z.core.$strip
698
+ >,
699
+ ]
700
+ >
701
+ >,
702
+ ],
703
+ null
704
+ >,
705
+ ]
706
+ >
707
+ >
708
+ >
709
+ >;
710
+ enableResetCacheOnSourceFileChanges: z.ZodDefault<
711
+ z.ZodNullable<z.ZodBoolean>
712
+ >;
713
+ enablePreserveExistingMemoizationGuarantees: z.ZodDefault<z.ZodBoolean>;
714
+ validatePreserveExistingMemoizationGuarantees: z.ZodDefault<z.ZodBoolean>;
715
+ enablePreserveExistingManualUseMemo: z.ZodDefault<z.ZodBoolean>;
716
+ enableForest: z.ZodDefault<z.ZodBoolean>;
717
+ enableUseTypeAnnotations: z.ZodDefault<z.ZodBoolean>;
718
+ flowTypeProvider: z.ZodDefault<z.ZodNullable<z.ZodAny>>;
719
+ enableOptionalDependencies: z.ZodDefault<z.ZodBoolean>;
720
+ enableFire: z.ZodDefault<z.ZodBoolean>;
721
+ enableNameAnonymousFunctions: z.ZodDefault<z.ZodBoolean>;
722
+ inferEffectDependencies: z.ZodDefault<
723
+ z.ZodNullable<
724
+ z.ZodArray<
725
+ z.ZodObject<
726
+ {
727
+ function: z.ZodObject<
728
+ {
729
+ source: z.ZodString;
730
+ importSpecifierName: z.ZodString;
731
+ },
732
+ z.core.$strip
733
+ >;
734
+ autodepsIndex: z.ZodNumber;
735
+ },
736
+ z.core.$strip
737
+ >
738
+ >
739
+ >
740
+ >;
741
+ inlineJsxTransform: z.ZodDefault<
742
+ z.ZodNullable<
743
+ z.ZodObject<
744
+ {
745
+ elementSymbol: z.ZodUnion<
746
+ readonly [
747
+ z.ZodLiteral<"react.element">,
748
+ z.ZodLiteral<"react.transitional.element">,
749
+ ]
750
+ >;
751
+ globalDevVar: z.ZodString;
752
+ },
753
+ z.core.$strip
754
+ >
755
+ >
756
+ >;
757
+ validateHooksUsage: z.ZodDefault<z.ZodBoolean>;
758
+ validateRefAccessDuringRender: z.ZodDefault<z.ZodBoolean>;
759
+ validateNoSetStateInRender: z.ZodDefault<z.ZodBoolean>;
760
+ validateNoSetStateInEffects: z.ZodDefault<z.ZodBoolean>;
761
+ validateNoDerivedComputationsInEffects: z.ZodDefault<z.ZodBoolean>;
762
+ validateNoJSXInTryStatements: z.ZodDefault<z.ZodBoolean>;
763
+ validateStaticComponents: z.ZodDefault<z.ZodBoolean>;
764
+ validateMemoizedEffectDependencies: z.ZodDefault<z.ZodBoolean>;
765
+ validateNoCapitalizedCalls: z.ZodDefault<
766
+ z.ZodNullable<z.ZodArray<z.ZodString>>
767
+ >;
768
+ validateBlocklistedImports: z.ZodDefault<
769
+ z.ZodNullable<z.ZodArray<z.ZodString>>
770
+ >;
771
+ validateNoImpureFunctionsInRender: z.ZodDefault<z.ZodBoolean>;
772
+ validateNoFreezingKnownMutableFunctions: z.ZodDefault<z.ZodBoolean>;
773
+ enableAssumeHooksFollowRulesOfReact: z.ZodDefault<z.ZodBoolean>;
774
+ enableTransitivelyFreezeFunctionExpressions: z.ZodDefault<z.ZodBoolean>;
775
+ enableEmitFreeze: z.ZodDefault<
776
+ z.ZodNullable<
777
+ z.ZodObject<
778
+ {
779
+ source: z.ZodString;
780
+ importSpecifierName: z.ZodString;
781
+ },
782
+ z.core.$strip
783
+ >
784
+ >
785
+ >;
786
+ enableEmitHookGuards: z.ZodDefault<
787
+ z.ZodNullable<
788
+ z.ZodObject<
789
+ {
790
+ source: z.ZodString;
791
+ importSpecifierName: z.ZodString;
792
+ },
793
+ z.core.$strip
794
+ >
795
+ >
796
+ >;
797
+ enableInstructionReordering: z.ZodDefault<z.ZodBoolean>;
798
+ enableFunctionOutlining: z.ZodDefault<z.ZodBoolean>;
799
+ enableJsxOutlining: z.ZodDefault<z.ZodBoolean>;
800
+ enableEmitInstrumentForget: z.ZodDefault<
801
+ z.ZodNullable<
802
+ z.ZodObject<
803
+ {
804
+ fn: z.ZodObject<
805
+ {
806
+ source: z.ZodString;
807
+ importSpecifierName: z.ZodString;
808
+ },
809
+ z.core.$strip
810
+ >;
811
+ gating: z.ZodNullable<
812
+ z.ZodObject<
813
+ {
814
+ source: z.ZodString;
815
+ importSpecifierName: z.ZodString;
816
+ },
817
+ z.core.$strip
818
+ >
819
+ >;
820
+ globalGating: z.ZodNullable<z.ZodString>;
821
+ },
822
+ z.core.$strip
823
+ >
824
+ >
825
+ >;
826
+ assertValidMutableRanges: z.ZodDefault<z.ZodBoolean>;
827
+ enableChangeVariableCodegen: z.ZodDefault<z.ZodBoolean>;
828
+ enableMemoizationComments: z.ZodDefault<z.ZodBoolean>;
829
+ throwUnknownException__testonly: z.ZodDefault<z.ZodBoolean>;
830
+ enableTreatFunctionDepsAsConditional: z.ZodDefault<z.ZodBoolean>;
831
+ disableMemoizationForDebugging: z.ZodDefault<z.ZodBoolean>;
832
+ enableChangeDetectionForDebugging: z.ZodDefault<
833
+ z.ZodNullable<
834
+ z.ZodObject<
835
+ {
836
+ source: z.ZodString;
837
+ importSpecifierName: z.ZodString;
838
+ },
839
+ z.core.$strip
840
+ >
841
+ >
842
+ >;
843
+ enableCustomTypeDefinitionForReanimated: z.ZodDefault<z.ZodBoolean>;
844
+ hookPattern: z.ZodDefault<z.ZodNullable<z.ZodString>>;
845
+ enableTreatRefLikeIdentifiersAsRefs: z.ZodDefault<z.ZodBoolean>;
846
+ enableTreatSetIdentifiersAsStateSetters: z.ZodDefault<z.ZodBoolean>;
847
+ lowerContextAccess: z.ZodDefault<
848
+ z.ZodNullable<
849
+ z.ZodObject<
850
+ {
851
+ source: z.ZodString;
852
+ importSpecifierName: z.ZodString;
853
+ },
854
+ z.core.$strip
855
+ >
856
+ >
857
+ >;
858
+ validateNoVoidUseMemo: z.ZodDefault<z.ZodBoolean>;
859
+ validateNoDynamicallyCreatedComponentsOrHooks: z.ZodDefault<z.ZodBoolean>;
860
+ enableAllowSetStateFromRefsInEffects: z.ZodDefault<z.ZodBoolean>;
861
+ },
862
+ z.core.$strip
863
+ >;
864
+
865
+ declare class ErrImpl<E> implements Result<never, E> {
866
+ #private;
867
+ constructor(val: E);
868
+ map<U>(_fn: (val: never) => U): Result<U, E>;
869
+ mapErr<F>(fn: (val: E) => F): Result<never, F>;
870
+ mapOr<U>(fallback: U, _fn: (val: never) => U): U;
871
+ mapOrElse<U>(fallback: () => U, _fn: (val: never) => U): U;
872
+ andThen<U>(_fn: (val: never) => Result<U, E>): Result<U, E>;
873
+ and<U>(_res: Result<U, E>): Result<U, E>;
874
+ or(res: Result<never, E>): Result<never, E>;
875
+ orElse<F>(fn: (val: E) => ErrImpl<F>): Result<never, F>;
876
+ isOk(): this is OkImpl<never>;
877
+ isErr(): this is ErrImpl<E>;
878
+ expect(msg: string): never;
879
+ expectErr(_msg: string): E;
880
+ unwrap(): never;
881
+ unwrapOr<T>(fallback: T): T;
882
+ unwrapOrElse<T>(fallback: (val: E) => T): T;
883
+ unwrapErr(): E;
884
+ }
885
+
886
+ declare enum ErrorCategory {
887
+ Hooks = "Hooks",
888
+ CapitalizedCalls = "CapitalizedCalls",
889
+ StaticComponents = "StaticComponents",
890
+ UseMemo = "UseMemo",
891
+ Factories = "Factories",
892
+ PreserveManualMemo = "PreserveManualMemo",
893
+ IncompatibleLibrary = "IncompatibleLibrary",
894
+ Immutability = "Immutability",
895
+ Globals = "Globals",
896
+ Refs = "Refs",
897
+ EffectDependencies = "EffectDependencies",
898
+ EffectSetState = "EffectSetState",
899
+ EffectDerivationsOfState = "EffectDerivationsOfState",
900
+ ErrorBoundaries = "ErrorBoundaries",
901
+ Purity = "Purity",
902
+ RenderSetState = "RenderSetState",
903
+ Invariant = "Invariant",
904
+ Todo = "Todo",
905
+ Syntax = "Syntax",
906
+ UnsupportedSyntax = "UnsupportedSyntax",
907
+ Config = "Config",
908
+ Gating = "Gating",
909
+ Suppression = "Suppression",
910
+ AutomaticEffectDependencies = "AutomaticEffectDependencies",
911
+ Fire = "Fire",
912
+ FBT = "FBT",
913
+ }
914
+
915
+ declare enum ErrorSeverity {
916
+ Error = "Error",
917
+ Warning = "Warning",
918
+ Hint = "Hint",
919
+ Off = "Off",
920
+ }
921
+
922
+ /**
923
+ * Merge user-provided Vite configuration object or function
924
+ *
925
+ * @param defaultConfig - Default configuration object
926
+ * @param userConfig - User-provided configuration object or function
927
+ * @returns Merged configuration
928
+ * @internal
929
+ */
930
+ export declare function extendViteConfigWithUserConfig(
931
+ env: ConfigEnv,
932
+ defaultConfig: InlineConfig,
933
+ userConfig: UserViteConfig,
934
+ ): Promise<InlineConfig>;
935
+
936
+ declare type ExternalFunction = z.infer<typeof ExternalFunctionSchema>;
937
+
938
+ declare const ExternalFunctionSchema: z.ZodObject<
939
+ {
940
+ source: z.ZodString;
941
+ importSpecifierName: z.ZodString;
942
+ },
943
+ z.core.$strip
944
+ >;
945
+
946
+ /**
947
+ * Ensure Sanity entry chunk is always loaded
948
+ *
949
+ * @param config - User-modified configuration
950
+ * @returns Merged configuration
951
+ * @internal
952
+ */
953
+ export declare function finalizeViteConfig(
954
+ config: InlineConfig,
955
+ ): Promise<InlineConfig>;
956
+
957
+ declare type FinishMemoize = {
958
+ kind: "FinishMemoize";
959
+ manualMemoId: number;
960
+ decl: Place;
961
+ pruned?: true;
962
+ loc: SourceLocation;
963
+ };
964
+
965
+ declare class FlowTypeEnv implements ITypeEnv {
966
+ #private;
967
+ moduleEnv: Map<string, ResolvedType>;
968
+ init(env: Environment, source: string): void;
969
+ setType(identifier: Identifier, type: ResolvedType): void;
970
+ getType(identifier: Identifier): ResolvedType;
971
+ getTypeOrNull(identifier: Identifier): ResolvedType | null;
972
+ getTypeByLoc(loc: SourceLocation): ResolvedType | null;
973
+ nextNominalId(): NominalId;
974
+ nextTypeParameterId(): TypeParameterId;
975
+ addBinding(bindingIdentifier: t.Identifier, type: ResolvedType): void;
976
+ resolveBinding(bindingIdentifier: t.Identifier): ResolvedType | null;
977
+ pushGeneric(name: string, generic: TypeParameter<ResolvedType>): void;
978
+ popGeneric(name: string): void;
979
+ getGeneric(name: string): null | TypeParameter<ResolvedType>;
980
+ }
981
+
982
+ declare type ForInTerminal = {
983
+ kind: "for-in";
984
+ loc: SourceLocation;
985
+ init: BlockId;
986
+ loop: BlockId;
987
+ fallthrough: BlockId;
988
+ id: InstructionId;
989
+ };
990
+
991
+ declare type ForOfTerminal = {
992
+ kind: "for-of";
993
+ loc: SourceLocation;
994
+ init: BlockId;
995
+ test: BlockId;
996
+ loop: BlockId;
997
+ fallthrough: BlockId;
998
+ id: InstructionId;
999
+ };
1000
+
1001
+ declare type ForTerminal = {
1002
+ kind: "for";
1003
+ loc: SourceLocation;
1004
+ init: BlockId;
1005
+ test: BlockId;
1006
+ update: BlockId | null;
1007
+ loop: BlockId;
1008
+ fallthrough: BlockId;
1009
+ id: InstructionId;
1010
+ };
1011
+
1012
+ declare type FunctionExpression = {
1013
+ kind: "FunctionExpression";
1014
+ name: ValidIdentifierName | null;
1015
+ nameHint: string | null;
1016
+ loweredFunc: LoweredFunction;
1017
+ type:
1018
+ | "ArrowFunctionExpression"
1019
+ | "FunctionExpression"
1020
+ | "FunctionDeclaration";
1021
+ loc: SourceLocation;
1022
+ };
1023
+
1024
+ declare type FunctionSignature = {
1025
+ positionalParams: Array<Effect>;
1026
+ restParam: Effect | null;
1027
+ returnType: BuiltInType | PolyType;
1028
+ returnValueKind: ValueKind;
1029
+ returnValueReason?: ValueReason;
1030
+ calleeEffect: Effect;
1031
+ hookKind: HookKind | null;
1032
+ noAlias?: boolean;
1033
+ mutableOnlyIfOperandsAreMutable?: boolean;
1034
+ impure?: boolean;
1035
+ knownIncompatible?: string | null | undefined;
1036
+ canonicalName?: string;
1037
+ aliasing?: AliasingSignature | null | undefined;
1038
+ };
1039
+
1040
+ declare type FunctionType = {
1041
+ kind: "Function";
1042
+ shapeId: string | null;
1043
+ return: Type;
1044
+ isConstructor: boolean;
1045
+ };
1046
+
1047
+ declare const GeneratedSource: unique symbol;
1048
+
1049
+ /**
1050
+ * Get a configuration object for Vite based on the passed options
1051
+ *
1052
+ * @internal Only meant for consumption inside of Sanity modules, do not depend on this externally
1053
+ */
1054
+ export declare function getViteConfig(
1055
+ options: ViteOptions,
1056
+ ): Promise<InlineConfig>;
1057
+
1058
+ declare type Global_2 = BuiltInType | PolyType;
1059
+
1060
+ declare type GotoTerminal = {
1061
+ kind: "goto";
1062
+ block: BlockId;
1063
+ variant: GotoVariant;
1064
+ id: InstructionId;
1065
+ loc: SourceLocation;
1066
+ fallthrough?: never;
1067
+ };
1068
+
1069
+ declare enum GotoVariant {
1070
+ Break = "Break",
1071
+ Continue = "Continue",
1072
+ Try = "Try",
1073
+ }
1074
+
1075
+ declare type HIR = {
1076
+ entry: BlockId;
1077
+ blocks: Map<BlockId, BasicBlock>;
1078
+ };
1079
+
1080
+ declare type HIRFunction = {
1081
+ loc: SourceLocation;
1082
+ id: ValidIdentifierName | null;
1083
+ nameHint: string | null;
1084
+ fnType: ReactFunctionType;
1085
+ env: Environment;
1086
+ params: Array<Place | SpreadPattern>;
1087
+ returnTypeAnnotation: t.FlowType | t.TSType | null;
1088
+ returns: Place;
1089
+ context: Array<Place>;
1090
+ body: HIR;
1091
+ generator: boolean;
1092
+ async: boolean;
1093
+ directives: Array<string>;
1094
+ aliasingEffects: Array<AliasingEffect> | null;
1095
+ };
1096
+
1097
+ declare type Hole = {
1098
+ kind: "Hole";
1099
+ };
1100
+
1101
+ declare type HookKind =
1102
+ | "useContext"
1103
+ | "useState"
1104
+ | "useActionState"
1105
+ | "useReducer"
1106
+ | "useRef"
1107
+ | "useEffect"
1108
+ | "useLayoutEffect"
1109
+ | "useInsertionEffect"
1110
+ | "useMemo"
1111
+ | "useCallback"
1112
+ | "useTransition"
1113
+ | "useImperativeHandle"
1114
+ | "useEffectEvent"
1115
+ | "Custom";
1116
+
1117
+ declare type Identifier = {
1118
+ id: IdentifierId;
1119
+ declarationId: DeclarationId;
1120
+ name: IdentifierName | null;
1121
+ mutableRange: MutableRange;
1122
+ scope: ReactiveScope | null;
1123
+ type: Type;
1124
+ loc: SourceLocation;
1125
+ };
1126
+
1127
+ declare type IdentifierId = number & {
1128
+ [opaqueIdentifierId]: "IdentifierId";
1129
+ };
1130
+
1131
+ declare type IdentifierName = ValidatedIdentifier | PromotedIdentifier;
1132
+
1133
+ declare type IfTerminal = {
1134
+ kind: "if";
1135
+ test: Place;
1136
+ consequent: BlockId;
1137
+ alternate: BlockId;
1138
+ fallthrough: BlockId;
1139
+ id: InstructionId;
1140
+ loc: SourceLocation;
1141
+ };
1142
+
1143
+ declare type Instruction = {
1144
+ id: InstructionId;
1145
+ lvalue: Place;
1146
+ value: InstructionValue;
1147
+ loc: SourceLocation;
1148
+ effects: Array<AliasingEffect> | null;
1149
+ };
1150
+
1151
+ declare type InstructionId = number & {
1152
+ [opaqueInstructionId]: "IdentifierId";
1153
+ };
1154
+
1155
+ declare enum InstructionKind {
1156
+ Const = "Const",
1157
+ Let = "Let",
1158
+ Reassign = "Reassign",
1159
+ Catch = "Catch",
1160
+ HoistedConst = "HoistedConst",
1161
+ HoistedLet = "HoistedLet",
1162
+ HoistedFunction = "HoistedFunction",
1163
+ Function = "Function",
1164
+ }
1165
+
1166
+ declare type InstructionValue =
1167
+ | LoadLocal
1168
+ | LoadContext
1169
+ | {
1170
+ kind: "DeclareLocal";
1171
+ lvalue: LValue;
1172
+ type: t.FlowType | t.TSType | null;
1173
+ loc: SourceLocation;
1174
+ }
1175
+ | {
1176
+ kind: "DeclareContext";
1177
+ lvalue: {
1178
+ kind:
1179
+ | InstructionKind.Let
1180
+ | InstructionKind.HoistedConst
1181
+ | InstructionKind.HoistedLet
1182
+ | InstructionKind.HoistedFunction;
1183
+ place: Place;
1184
+ };
1185
+ loc: SourceLocation;
1186
+ }
1187
+ | StoreLocal
1188
+ | {
1189
+ kind: "StoreContext";
1190
+ lvalue: {
1191
+ kind:
1192
+ | InstructionKind.Reassign
1193
+ | InstructionKind.Const
1194
+ | InstructionKind.Let
1195
+ | InstructionKind.Function;
1196
+ place: Place;
1197
+ };
1198
+ value: Place;
1199
+ loc: SourceLocation;
1200
+ }
1201
+ | Destructure
1202
+ | {
1203
+ kind: "Primitive";
1204
+ value: number | boolean | string | null | undefined;
1205
+ loc: SourceLocation;
1206
+ }
1207
+ | JSXText
1208
+ | {
1209
+ kind: "BinaryExpression";
1210
+ operator: Exclude<t.BinaryExpression["operator"], "|>">;
1211
+ left: Place;
1212
+ right: Place;
1213
+ loc: SourceLocation;
1214
+ }
1215
+ | NewExpression
1216
+ | CallExpression
1217
+ | MethodCall
1218
+ | {
1219
+ kind: "UnaryExpression";
1220
+ operator: Exclude<t.UnaryExpression["operator"], "throw" | "delete">;
1221
+ value: Place;
1222
+ loc: SourceLocation;
1223
+ }
1224
+ | ({
1225
+ kind: "TypeCastExpression";
1226
+ value: Place;
1227
+ type: Type;
1228
+ loc: SourceLocation;
1229
+ } & (
1230
+ | {
1231
+ typeAnnotation: t.FlowType;
1232
+ typeAnnotationKind: "cast";
1233
+ }
1234
+ | {
1235
+ typeAnnotation: t.TSType;
1236
+ typeAnnotationKind: "as" | "satisfies";
1237
+ }
1238
+ ))
1239
+ | JsxExpression
1240
+ | {
1241
+ kind: "ObjectExpression";
1242
+ properties: Array<ObjectProperty | SpreadPattern>;
1243
+ loc: SourceLocation;
1244
+ }
1245
+ | ObjectMethod
1246
+ | ArrayExpression
1247
+ | {
1248
+ kind: "JsxFragment";
1249
+ children: Array<Place>;
1250
+ loc: SourceLocation;
1251
+ }
1252
+ | {
1253
+ kind: "RegExpLiteral";
1254
+ pattern: string;
1255
+ flags: string;
1256
+ loc: SourceLocation;
1257
+ }
1258
+ | {
1259
+ kind: "MetaProperty";
1260
+ meta: string;
1261
+ property: string;
1262
+ loc: SourceLocation;
1263
+ }
1264
+ | {
1265
+ kind: "PropertyStore";
1266
+ object: Place;
1267
+ property: PropertyLiteral;
1268
+ value: Place;
1269
+ loc: SourceLocation;
1270
+ }
1271
+ | PropertyLoad
1272
+ | {
1273
+ kind: "PropertyDelete";
1274
+ object: Place;
1275
+ property: PropertyLiteral;
1276
+ loc: SourceLocation;
1277
+ }
1278
+ | {
1279
+ kind: "ComputedStore";
1280
+ object: Place;
1281
+ property: Place;
1282
+ value: Place;
1283
+ loc: SourceLocation;
1284
+ }
1285
+ | {
1286
+ kind: "ComputedLoad";
1287
+ object: Place;
1288
+ property: Place;
1289
+ loc: SourceLocation;
1290
+ }
1291
+ | {
1292
+ kind: "ComputedDelete";
1293
+ object: Place;
1294
+ property: Place;
1295
+ loc: SourceLocation;
1296
+ }
1297
+ | LoadGlobal
1298
+ | StoreGlobal
1299
+ | FunctionExpression
1300
+ | {
1301
+ kind: "TaggedTemplateExpression";
1302
+ tag: Place;
1303
+ value: {
1304
+ raw: string;
1305
+ cooked?: string;
1306
+ };
1307
+ loc: SourceLocation;
1308
+ }
1309
+ | {
1310
+ kind: "TemplateLiteral";
1311
+ subexprs: Array<Place>;
1312
+ quasis: Array<{
1313
+ raw: string;
1314
+ cooked?: string;
1315
+ }>;
1316
+ loc: SourceLocation;
1317
+ }
1318
+ | {
1319
+ kind: "Await";
1320
+ value: Place;
1321
+ loc: SourceLocation;
1322
+ }
1323
+ | {
1324
+ kind: "GetIterator";
1325
+ collection: Place;
1326
+ loc: SourceLocation;
1327
+ }
1328
+ | {
1329
+ kind: "IteratorNext";
1330
+ iterator: Place;
1331
+ collection: Place;
1332
+ loc: SourceLocation;
1333
+ }
1334
+ | {
1335
+ kind: "NextPropertyOf";
1336
+ value: Place;
1337
+ loc: SourceLocation;
1338
+ }
1339
+ | {
1340
+ kind: "PrefixUpdate";
1341
+ lvalue: Place;
1342
+ operation: t.UpdateExpression["operator"];
1343
+ value: Place;
1344
+ loc: SourceLocation;
1345
+ }
1346
+ | {
1347
+ kind: "PostfixUpdate";
1348
+ lvalue: Place;
1349
+ operation: t.UpdateExpression["operator"];
1350
+ value: Place;
1351
+ loc: SourceLocation;
1352
+ }
1353
+ | {
1354
+ kind: "Debugger";
1355
+ loc: SourceLocation;
1356
+ }
1357
+ | StartMemoize
1358
+ | FinishMemoize
1359
+ | {
1360
+ kind: "UnsupportedNode";
1361
+ node: t.Node;
1362
+ loc: SourceLocation;
1363
+ };
1364
+
1365
+ declare interface ITypeEnv {
1366
+ popGeneric(name: string): void;
1367
+ getGeneric(name: string): null | TypeParameter<ResolvedType>;
1368
+ pushGeneric(
1369
+ name: string,
1370
+ binding: {
1371
+ name: string;
1372
+ id: TypeParameterId;
1373
+ bound: ResolvedType;
1374
+ },
1375
+ ): void;
1376
+ getType(id: Identifier): ResolvedType;
1377
+ getTypeOrNull(id: Identifier): ResolvedType | null;
1378
+ setType(id: Identifier, type: ResolvedType): void;
1379
+ nextNominalId(): NominalId;
1380
+ nextTypeParameterId(): TypeParameterId;
1381
+ moduleEnv: Map<string, ResolvedType>;
1382
+ addBinding(bindingIdentifier: t.Identifier, type: ResolvedType): void;
1383
+ resolveBinding(bindingIdentifier: t.Identifier): ResolvedType | null;
1384
+ }
1385
+
1386
+ declare type JsxAttribute =
1387
+ | {
1388
+ kind: "JsxSpreadAttribute";
1389
+ argument: Place;
1390
+ }
1391
+ | {
1392
+ kind: "JsxAttribute";
1393
+ name: string;
1394
+ place: Place;
1395
+ };
1396
+
1397
+ declare type JsxExpression = {
1398
+ kind: "JsxExpression";
1399
+ tag: Place | BuiltinTag;
1400
+ props: Array<JsxAttribute>;
1401
+ children: Array<Place> | null;
1402
+ loc: SourceLocation;
1403
+ openingLoc: SourceLocation;
1404
+ closingLoc: SourceLocation;
1405
+ };
1406
+
1407
+ declare type JSXText = {
1408
+ kind: "JSXText";
1409
+ value: string;
1410
+ loc: SourceLocation;
1411
+ };
1412
+
1413
+ declare type LabelTerminal = {
1414
+ kind: "label";
1415
+ block: BlockId;
1416
+ fallthrough: BlockId;
1417
+ id: InstructionId;
1418
+ loc: SourceLocation;
1419
+ };
1420
+
1421
+ declare type LinearId = number & {
1422
+ [opaqueLinearId]: "LinearId";
1423
+ };
1424
+
1425
+ declare type LoadContext = {
1426
+ kind: "LoadContext";
1427
+ place: Place;
1428
+ loc: SourceLocation;
1429
+ };
1430
+
1431
+ declare type LoadGlobal = {
1432
+ kind: "LoadGlobal";
1433
+ binding: NonLocalBinding;
1434
+ loc: SourceLocation;
1435
+ };
1436
+
1437
+ declare type LoadLocal = {
1438
+ kind: "LoadLocal";
1439
+ place: Place;
1440
+ loc: SourceLocation;
1441
+ };
1442
+
1443
+ declare type Logger = {
1444
+ logEvent: (filename: string | null, event: LoggerEvent) => void;
1445
+ debugLogIRs?: (value: CompilerPipelineValue) => void;
1446
+ };
1447
+
1448
+ declare type LoggerEvent =
1449
+ | CompileSuccessEvent
1450
+ | CompileErrorEvent
1451
+ | CompileDiagnosticEvent
1452
+ | CompileSkipEvent
1453
+ | PipelineErrorEvent
1454
+ | TimingEvent
1455
+ | AutoDepsDecorationsEvent
1456
+ | AutoDepsEligibleEvent;
1457
+
1458
+ declare type LogicalTerminal = {
1459
+ kind: "logical";
1460
+ operator: t.LogicalExpression["operator"];
1461
+ test: BlockId;
1462
+ fallthrough: BlockId;
1463
+ id: InstructionId;
1464
+ loc: SourceLocation;
1465
+ };
1466
+
1467
+ declare type LoweredFunction = {
1468
+ func: HIRFunction;
1469
+ };
1470
+
1471
+ declare type LValue = {
1472
+ place: Place;
1473
+ kind: InstructionKind;
1474
+ };
1475
+
1476
+ declare type LValuePattern = {
1477
+ pattern: Pattern;
1478
+ kind: InstructionKind;
1479
+ };
1480
+
1481
+ declare type ManualMemoDependency = {
1482
+ root:
1483
+ | {
1484
+ kind: "NamedLocal";
1485
+ value: Place;
1486
+ }
1487
+ | {
1488
+ kind: "Global";
1489
+ identifierName: string;
1490
+ };
1491
+ path: DependencyPath;
1492
+ };
1493
+
1494
+ declare type MaybeThrowTerminal = {
1495
+ kind: "maybe-throw";
1496
+ continuation: BlockId;
1497
+ handler: BlockId;
1498
+ id: InstructionId;
1499
+ loc: SourceLocation;
1500
+ fallthrough?: never;
1501
+ effects: Array<AliasingEffect> | null;
1502
+ };
1503
+
1504
+ declare type MethodCall = {
1505
+ kind: "MethodCall";
1506
+ receiver: Place;
1507
+ property: Place;
1508
+ args: Array<Place | SpreadPattern>;
1509
+ loc: SourceLocation;
1510
+ };
1511
+
1512
+ declare type MutableRange = {
1513
+ start: InstructionId;
1514
+ end: InstructionId;
1515
+ };
1516
+
1517
+ declare type MutationReason = {
1518
+ kind: "AssignCurrentProperty";
1519
+ };
1520
+
1521
+ declare type NewExpression = {
1522
+ kind: "NewExpression";
1523
+ callee: Place;
1524
+ args: Array<Place | SpreadPattern>;
1525
+ loc: SourceLocation;
1526
+ };
1527
+
1528
+ declare type NominalId = number & {
1529
+ [opaqueNominalId]: "NominalId";
1530
+ };
1531
+
1532
+ declare type NonLocalBinding =
1533
+ | {
1534
+ kind: "ImportDefault";
1535
+ name: string;
1536
+ module: string;
1537
+ }
1538
+ | {
1539
+ kind: "ImportNamespace";
1540
+ name: string;
1541
+ module: string;
1542
+ }
1543
+ | NonLocalImportSpecifier
1544
+ | {
1545
+ kind: "ModuleLocal";
1546
+ name: string;
1547
+ }
1548
+ | {
1549
+ kind: "Global";
1550
+ name: string;
1551
+ };
1552
+
1553
+ declare type NonLocalImportSpecifier = {
1554
+ kind: "ImportSpecifier";
1555
+ name: string;
1556
+ module: string;
1557
+ imported: string;
1558
+ };
1559
+
1560
+ declare type ObjectMethod$1 = {
1561
+ kind: "ObjectMethod";
1562
+ };
1563
+
1564
+ declare type ObjectMethod = {
1565
+ kind: "ObjectMethod";
1566
+ loc: SourceLocation;
1567
+ loweredFunc: LoweredFunction;
1568
+ };
1569
+
1570
+ declare type ObjectPattern = {
1571
+ kind: "ObjectPattern";
1572
+ properties: Array<ObjectProperty | SpreadPattern>;
1573
+ };
1574
+
1575
+ declare type ObjectProperty = {
1576
+ kind: "ObjectProperty";
1577
+ key: ObjectPropertyKey;
1578
+ type: "property" | "method";
1579
+ place: Place;
1580
+ };
1581
+
1582
+ declare type ObjectPropertyKey =
1583
+ | {
1584
+ kind: "string";
1585
+ name: string;
1586
+ }
1587
+ | {
1588
+ kind: "identifier";
1589
+ name: string;
1590
+ }
1591
+ | {
1592
+ kind: "computed";
1593
+ name: Place;
1594
+ }
1595
+ | {
1596
+ kind: "number";
1597
+ name: number;
1598
+ };
1599
+
1600
+ declare type ObjectType = {
1601
+ kind: "Object";
1602
+ shapeId: string | null;
1603
+ };
1604
+
1605
+ declare class OkImpl<T> implements Result<T, never> {
1606
+ #private;
1607
+ constructor(val: T);
1608
+ map<U>(fn: (val: T) => U): Result<U, never>;
1609
+ mapErr<F>(_fn: (val: never) => F): Result<T, F>;
1610
+ mapOr<U>(_fallback: U, fn: (val: T) => U): U;
1611
+ mapOrElse<U>(_fallback: () => U, fn: (val: T) => U): U;
1612
+ andThen<U>(fn: (val: T) => Result<U, never>): Result<U, never>;
1613
+ and<U>(res: Result<U, never>): Result<U, never>;
1614
+ or(_res: Result<T, never>): Result<T, never>;
1615
+ orElse<F>(_fn: (val: never) => Result<T, F>): Result<T, F>;
1616
+ isOk(): this is OkImpl<T>;
1617
+ isErr(): this is ErrImpl<never>;
1618
+ expect(_msg: string): T;
1619
+ expectErr(msg: string): never;
1620
+ unwrap(): T;
1621
+ unwrapOr(_fallback: T): T;
1622
+ unwrapOrElse(_fallback: (val: never) => T): T;
1623
+ unwrapErr(): never;
1624
+ }
1625
+
1626
+ declare const opageDeclarationId: unique symbol;
1627
+
1628
+ declare const opaqueBlockId: unique symbol;
1629
+
1630
+ declare const opaqueIdentifierId: unique symbol;
1631
+
1632
+ declare const opaqueInstructionId: unique symbol;
1633
+
1634
+ declare const opaqueLinearId: unique symbol;
1635
+
1636
+ declare const opaqueNominalId: unique symbol;
1637
+
1638
+ declare const opaquePropertyLiteral: unique symbol;
1639
+
1640
+ declare const opaqueScopeId: unique symbol;
1641
+
1642
+ declare const opaqueTypeId: unique symbol;
1643
+
1644
+ declare const opaqueTypeParameterId: unique symbol;
1645
+
1646
+ declare const opaqueValidIdentifierName: unique symbol;
1647
+
1648
+ declare type OptionalTerminal = {
1649
+ kind: "optional";
1650
+ optional: boolean;
1651
+ test: BlockId;
1652
+ fallthrough: BlockId;
1653
+ id: InstructionId;
1654
+ loc: SourceLocation;
1655
+ };
1656
+
1657
+ declare type PanicThresholdOptions = z.infer<
1658
+ typeof PanicThresholdOptionsSchema
1659
+ >;
1660
+
1661
+ declare const PanicThresholdOptionsSchema: z.ZodEnum<{
1662
+ none: "none";
1663
+ all_errors: "all_errors";
1664
+ critical_errors: "critical_errors";
1665
+ }>;
1666
+
1667
+ declare type ParsedPluginOptions = Required<
1668
+ Omit<PluginOptions, "environment">
1669
+ > & {
1670
+ environment: EnvironmentConfig;
1671
+ };
1672
+
1673
+ declare type Pattern = ArrayPattern | ObjectPattern;
1674
+
1675
+ declare type Phi = {
1676
+ kind: "Phi";
1677
+ place: Place;
1678
+ operands: Map<BlockId, Place>;
1679
+ };
1680
+
1681
+ declare type PhiType = {
1682
+ kind: "Phi";
1683
+ operands: Array<Type>;
1684
+ };
1685
+
1686
+ declare type PipelineErrorEvent = {
1687
+ kind: "PipelineError";
1688
+ fnLoc: t.SourceLocation | null;
1689
+ data: string;
1690
+ };
1691
+
1692
+ declare type Place = {
1693
+ kind: "Identifier";
1694
+ identifier: Identifier;
1695
+ effect: Effect;
1696
+ reactive: boolean;
1697
+ loc: SourceLocation;
1698
+ };
1699
+
1700
+ declare type Platform = "client" | "server" | "shared";
1701
+
1702
+ declare type PluginOptions = Partial<{
1703
+ environment: Partial<EnvironmentConfig>;
1704
+ logger: Logger | null;
1705
+ gating: ExternalFunction | null;
1706
+ dynamicGating: DynamicGatingOptions | null;
1707
+ panicThreshold: PanicThresholdOptions;
1708
+ noEmit: boolean;
1709
+ compilationMode: CompilationMode;
1710
+ eslintSuppressionRules: Array<string> | null | undefined;
1711
+ flowSuppressions: boolean;
1712
+ ignoreUseNoForget: boolean;
1713
+ customOptOutDirectives: CustomOptOutDirective;
1714
+ sources: Array<string> | ((filename: string) => boolean) | null;
1715
+ enableReanimatedCheck: boolean;
1716
+ target: CompilerReactTarget;
1717
+ }>;
1718
+
1719
+ declare type PolyType = {
1720
+ kind: "Poly";
1721
+ };
1722
+
1723
+ declare type PrimitiveType = {
1724
+ kind: "Primitive";
1725
+ };
1726
+
1727
+ declare type PrintErrorMessageOptions = {
1728
+ eslint: boolean;
1729
+ };
1730
+
1731
+ declare class ProgramContext {
1732
+ scope: Scope;
1733
+ opts: ParsedPluginOptions;
1734
+ filename: string | null;
1735
+ code: string | null;
1736
+ reactRuntimeModule: string;
1737
+ suppressions: Array<SuppressionRange>;
1738
+ hasModuleScopeOptOut: boolean;
1739
+ alreadyCompiled: WeakSet<object> | Set<object>;
1740
+ knownReferencedNames: Set<string>;
1741
+ imports: Map<string, Map<string, NonLocalImportSpecifier>>;
1742
+ retryErrors: Array<{
1743
+ fn: BabelFn;
1744
+ error: CompilerError;
1745
+ }>;
1746
+ inferredEffectLocations: Set<t.SourceLocation>;
1747
+ constructor({
1748
+ program,
1749
+ suppressions,
1750
+ opts,
1751
+ filename,
1752
+ code,
1753
+ hasModuleScopeOptOut,
1754
+ }: ProgramContextOptions);
1755
+ isHookName(name: string): boolean;
1756
+ hasReference(name: string): boolean;
1757
+ newUid(name: string): string;
1758
+ addMemoCacheImport(): NonLocalImportSpecifier;
1759
+ addImportSpecifier(
1760
+ { source: module, importSpecifierName: specifier }: ExternalFunction,
1761
+ nameHint?: string,
1762
+ ): NonLocalImportSpecifier;
1763
+ addNewReference(name: string): void;
1764
+ assertGlobalBinding(
1765
+ name: string,
1766
+ localScope?: Scope,
1767
+ ): Result<void, CompilerError>;
1768
+ logEvent(event: LoggerEvent): void;
1769
+ }
1770
+
1771
+ declare type ProgramContextOptions = {
1772
+ program: NodePath<t.Program>;
1773
+ suppressions: Array<SuppressionRange>;
1774
+ opts: ParsedPluginOptions;
1775
+ filename: string | null;
1776
+ code: string | null;
1777
+ hasModuleScopeOptOut: boolean;
1778
+ };
1779
+
1780
+ declare type PromotedIdentifier = {
1781
+ kind: "promoted";
1782
+ value: string;
1783
+ };
1784
+
1785
+ declare type PropertyLiteral = (string | number) & {
1786
+ [opaquePropertyLiteral]: "PropertyLiteral";
1787
+ };
1788
+
1789
+ declare type PropertyLoad = {
1790
+ kind: "PropertyLoad";
1791
+ object: Place;
1792
+ property: PropertyLiteral;
1793
+ loc: SourceLocation;
1794
+ };
1795
+
1796
+ declare type PropType = {
1797
+ kind: "Property";
1798
+ objectType: Type;
1799
+ objectName: string;
1800
+ propertyName:
1801
+ | {
1802
+ kind: "literal";
1803
+ value: PropertyLiteral;
1804
+ }
1805
+ | {
1806
+ kind: "computed";
1807
+ value: Type;
1808
+ };
1809
+ };
1810
+
1811
+ declare type PrunedReactiveScopeBlock = {
1812
+ kind: "pruned-scope";
1813
+ scope: ReactiveScope;
1814
+ instructions: ReactiveBlock;
1815
+ };
1816
+
1817
+ declare type PrunedScopeTerminal = {
1818
+ kind: "pruned-scope";
1819
+ fallthrough: BlockId;
1820
+ block: BlockId;
1821
+ scope: ReactiveScope;
1822
+ id: InstructionId;
1823
+ loc: SourceLocation;
1824
+ };
1825
+
1826
+ declare type ReactFunctionType = "Component" | "Hook" | "Other";
1827
+
1828
+ declare type ReactiveBlock = Array<ReactiveStatement>;
1829
+
1830
+ declare type ReactiveBreakTerminal = {
1831
+ kind: "break";
1832
+ target: BlockId;
1833
+ id: InstructionId;
1834
+ targetKind: ReactiveTerminalTargetKind;
1835
+ loc: SourceLocation;
1836
+ };
1837
+
1838
+ declare type ReactiveContinueTerminal = {
1839
+ kind: "continue";
1840
+ target: BlockId;
1841
+ id: InstructionId;
1842
+ targetKind: ReactiveTerminalTargetKind;
1843
+ loc: SourceLocation;
1844
+ };
1845
+
1846
+ declare type ReactiveDoWhileTerminal = {
1847
+ kind: "do-while";
1848
+ loop: ReactiveBlock;
1849
+ test: ReactiveValue;
1850
+ id: InstructionId;
1851
+ loc: SourceLocation;
1852
+ };
1853
+
1854
+ declare type ReactiveForInTerminal = {
1855
+ kind: "for-in";
1856
+ init: ReactiveValue;
1857
+ loop: ReactiveBlock;
1858
+ id: InstructionId;
1859
+ loc: SourceLocation;
1860
+ };
1861
+
1862
+ declare type ReactiveForOfTerminal = {
1863
+ kind: "for-of";
1864
+ init: ReactiveValue;
1865
+ test: ReactiveValue;
1866
+ loop: ReactiveBlock;
1867
+ id: InstructionId;
1868
+ loc: SourceLocation;
1869
+ };
1870
+
1871
+ declare type ReactiveForTerminal = {
1872
+ kind: "for";
1873
+ init: ReactiveValue;
1874
+ test: ReactiveValue;
1875
+ update: ReactiveValue | null;
1876
+ loop: ReactiveBlock;
1877
+ id: InstructionId;
1878
+ loc: SourceLocation;
1879
+ };
1880
+
1881
+ declare type ReactiveFunction = {
1882
+ loc: SourceLocation;
1883
+ id: ValidIdentifierName | null;
1884
+ nameHint: string | null;
1885
+ params: Array<Place | SpreadPattern>;
1886
+ generator: boolean;
1887
+ async: boolean;
1888
+ body: ReactiveBlock;
1889
+ env: Environment;
1890
+ directives: Array<string>;
1891
+ };
1892
+
1893
+ declare type ReactiveIfTerminal = {
1894
+ kind: "if";
1895
+ test: Place;
1896
+ consequent: ReactiveBlock;
1897
+ alternate: ReactiveBlock | null;
1898
+ id: InstructionId;
1899
+ loc: SourceLocation;
1900
+ };
1901
+
1902
+ declare type ReactiveInstruction = {
1903
+ id: InstructionId;
1904
+ lvalue: Place | null;
1905
+ value: ReactiveValue;
1906
+ effects?: Array<AliasingEffect> | null;
1907
+ loc: SourceLocation;
1908
+ };
1909
+
1910
+ declare type ReactiveInstructionStatement = {
1911
+ kind: "instruction";
1912
+ instruction: ReactiveInstruction;
1913
+ };
1914
+
1915
+ declare type ReactiveLabelTerminal = {
1916
+ kind: "label";
1917
+ block: ReactiveBlock;
1918
+ id: InstructionId;
1919
+ loc: SourceLocation;
1920
+ };
1921
+
1922
+ declare type ReactiveLogicalValue = {
1923
+ kind: "LogicalExpression";
1924
+ operator: t.LogicalExpression["operator"];
1925
+ left: ReactiveValue;
1926
+ right: ReactiveValue;
1927
+ loc: SourceLocation;
1928
+ };
1929
+
1930
+ declare type ReactiveOptionalCallValue = {
1931
+ kind: "OptionalExpression";
1932
+ id: InstructionId;
1933
+ value: ReactiveValue;
1934
+ optional: boolean;
1935
+ loc: SourceLocation;
1936
+ };
1937
+
1938
+ declare type ReactiveReturnTerminal = {
1939
+ kind: "return";
1940
+ value: Place;
1941
+ id: InstructionId;
1942
+ loc: SourceLocation;
1943
+ };
1944
+
1945
+ declare type ReactiveScope = {
1946
+ id: ScopeId;
1947
+ range: MutableRange;
1948
+ dependencies: ReactiveScopeDependencies;
1949
+ declarations: Map<IdentifierId, ReactiveScopeDeclaration>;
1950
+ reassignments: Set<Identifier>;
1951
+ earlyReturnValue: {
1952
+ value: Identifier;
1953
+ loc: SourceLocation;
1954
+ label: BlockId;
1955
+ } | null;
1956
+ merged: Set<ScopeId>;
1957
+ loc: SourceLocation;
1958
+ };
1959
+
1960
+ declare type ReactiveScopeBlock = {
1961
+ kind: "scope";
1962
+ scope: ReactiveScope;
1963
+ instructions: ReactiveBlock;
1964
+ };
1965
+
1966
+ declare type ReactiveScopeDeclaration = {
1967
+ identifier: Identifier;
1968
+ scope: ReactiveScope;
1969
+ };
1970
+
1971
+ declare type ReactiveScopeDependencies = Set<ReactiveScopeDependency>;
1972
+
1973
+ declare type ReactiveScopeDependency = {
1974
+ identifier: Identifier;
1975
+ reactive: boolean;
1976
+ path: DependencyPath;
1977
+ };
1978
+
1979
+ declare type ReactiveScopeTerminal = {
1980
+ kind: "scope";
1981
+ fallthrough: BlockId;
1982
+ block: BlockId;
1983
+ scope: ReactiveScope;
1984
+ id: InstructionId;
1985
+ loc: SourceLocation;
1986
+ };
1987
+
1988
+ declare type ReactiveSequenceValue = {
1989
+ kind: "SequenceExpression";
1990
+ instructions: Array<ReactiveInstruction>;
1991
+ id: InstructionId;
1992
+ value: ReactiveValue;
1993
+ loc: SourceLocation;
1994
+ };
1995
+
1996
+ declare type ReactiveStatement =
1997
+ | ReactiveInstructionStatement
1998
+ | ReactiveTerminalStatement
1999
+ | ReactiveScopeBlock
2000
+ | PrunedReactiveScopeBlock;
2001
+
2002
+ declare type ReactiveSwitchTerminal = {
2003
+ kind: "switch";
2004
+ test: Place;
2005
+ cases: Array<{
2006
+ test: Place | null;
2007
+ block: ReactiveBlock | void;
2008
+ }>;
2009
+ id: InstructionId;
2010
+ loc: SourceLocation;
2011
+ };
2012
+
2013
+ declare type ReactiveTerminal =
2014
+ | ReactiveBreakTerminal
2015
+ | ReactiveContinueTerminal
2016
+ | ReactiveReturnTerminal
2017
+ | ReactiveThrowTerminal
2018
+ | ReactiveSwitchTerminal
2019
+ | ReactiveDoWhileTerminal
2020
+ | ReactiveWhileTerminal
2021
+ | ReactiveForTerminal
2022
+ | ReactiveForOfTerminal
2023
+ | ReactiveForInTerminal
2024
+ | ReactiveIfTerminal
2025
+ | ReactiveLabelTerminal
2026
+ | ReactiveTryTerminal;
2027
+
2028
+ declare type ReactiveTerminalStatement<
2029
+ Tterminal extends ReactiveTerminal = ReactiveTerminal,
2030
+ > = {
2031
+ kind: "terminal";
2032
+ terminal: Tterminal;
2033
+ label: {
2034
+ id: BlockId;
2035
+ implicit: boolean;
2036
+ } | null;
2037
+ };
2038
+
2039
+ declare type ReactiveTerminalTargetKind = "implicit" | "labeled" | "unlabeled";
2040
+
2041
+ declare type ReactiveTernaryValue = {
2042
+ kind: "ConditionalExpression";
2043
+ test: ReactiveValue;
2044
+ consequent: ReactiveValue;
2045
+ alternate: ReactiveValue;
2046
+ loc: SourceLocation;
2047
+ };
2048
+
2049
+ declare type ReactiveThrowTerminal = {
2050
+ kind: "throw";
2051
+ value: Place;
2052
+ id: InstructionId;
2053
+ loc: SourceLocation;
2054
+ };
2055
+
2056
+ declare type ReactiveTryTerminal = {
2057
+ kind: "try";
2058
+ block: ReactiveBlock;
2059
+ handlerBinding: Place | null;
2060
+ handler: ReactiveBlock;
2061
+ id: InstructionId;
2062
+ loc: SourceLocation;
2063
+ };
2064
+
2065
+ declare type ReactiveValue =
2066
+ | InstructionValue
2067
+ | ReactiveLogicalValue
2068
+ | ReactiveSequenceValue
2069
+ | ReactiveTernaryValue
2070
+ | ReactiveOptionalCallValue;
2071
+
2072
+ declare type ReactiveWhileTerminal = {
2073
+ kind: "while";
2074
+ test: ReactiveValue;
2075
+ loop: ReactiveBlock;
2076
+ id: InstructionId;
2077
+ loc: SourceLocation;
2078
+ };
2079
+
2080
+ declare type ResolvedType = {
2081
+ kind: "Concrete";
2082
+ type: ConcreteType<ResolvedType>;
2083
+ platform: Platform;
2084
+ };
2085
+
2086
+ declare interface Result<T, E> {
2087
+ map<U>(fn: (val: T) => U): Result<U, E>;
2088
+ mapErr<F>(fn: (val: E) => F): Result<T, F>;
2089
+ mapOr<U>(fallback: U, fn: (val: T) => U): U;
2090
+ mapOrElse<U>(fallback: () => U, fn: (val: T) => U): U;
2091
+ andThen<U>(fn: (val: T) => Result<U, E>): Result<U, E>;
2092
+ and<U>(res: Result<U, E>): Result<U, E>;
2093
+ or(res: Result<T, E>): Result<T, E>;
2094
+ orElse<F>(fn: (val: E) => Result<T, F>): Result<T, F>;
2095
+ isOk(): this is OkImpl<T>;
2096
+ isErr(): this is ErrImpl<E>;
2097
+ expect(msg: string): T;
2098
+ expectErr(msg: string): E;
2099
+ unwrap(): T;
2100
+ unwrapOr(fallback: T): T;
2101
+ unwrapOrElse(fallback: (val: E) => T): T;
2102
+ unwrapErr(): E;
2103
+ }
2104
+
2105
+ declare type ReturnTerminal = {
2106
+ kind: "return";
2107
+ returnVariant: ReturnVariant;
2108
+ loc: SourceLocation;
2109
+ value: Place;
2110
+ id: InstructionId;
2111
+ fallthrough?: never;
2112
+ effects: Array<AliasingEffect> | null;
2113
+ };
2114
+
2115
+ declare type ReturnVariant = "Void" | "Implicit" | "Explicit";
2116
+
2117
+ declare interface RuntimeOptions {
2118
+ cwd: string;
2119
+ reactStrictMode: boolean;
2120
+ watch: boolean;
2121
+ appTitle?: string;
2122
+ basePath?: string;
2123
+ entry?: string;
2124
+ isApp?: boolean;
2125
+ }
2126
+
2127
+ declare type ScopeId = number & {
2128
+ [opaqueScopeId]: "ScopeId";
2129
+ };
2130
+
2131
+ declare type SequenceTerminal = {
2132
+ kind: "sequence";
2133
+ block: BlockId;
2134
+ fallthrough: BlockId;
2135
+ id: InstructionId;
2136
+ loc: SourceLocation;
2137
+ };
2138
+
2139
+ declare type SourceLocation = t.SourceLocation | typeof GeneratedSource;
2140
+
2141
+ declare type SpreadPattern = {
2142
+ kind: "Spread";
2143
+ place: Place;
2144
+ };
2145
+
2146
+ declare type StartMemoize = {
2147
+ kind: "StartMemoize";
2148
+ manualMemoId: number;
2149
+ deps: Array<ManualMemoDependency> | null;
2150
+ loc: SourceLocation;
2151
+ };
2152
+
2153
+ declare type StoreGlobal = {
2154
+ kind: "StoreGlobal";
2155
+ name: string;
2156
+ value: Place;
2157
+ loc: SourceLocation;
2158
+ };
2159
+
2160
+ declare type StoreLocal = {
2161
+ kind: "StoreLocal";
2162
+ lvalue: LValue;
2163
+ value: Place;
2164
+ type: t.FlowType | t.TSType | null;
2165
+ loc: SourceLocation;
2166
+ };
2167
+
2168
+ export declare const StudioBuildTrace: DefinedTelemetryTrace<
2169
+ {
2170
+ outputSize: number;
2171
+ },
2172
+ void
2173
+ >;
2174
+
2175
+ declare type SuppressionRange = {
2176
+ disableComment: t.Comment;
2177
+ enableComment: t.Comment | null;
2178
+ source: SuppressionSource;
2179
+ };
2180
+
2181
+ declare type SuppressionSource = "Eslint" | "Flow";
2182
+
2183
+ declare type SwitchTerminal = {
2184
+ kind: "switch";
2185
+ test: Place;
2186
+ cases: Array<Case>;
2187
+ fallthrough: BlockId;
2188
+ id: InstructionId;
2189
+ loc: SourceLocation;
2190
+ };
2191
+
2192
+ declare type Terminal =
2193
+ | UnsupportedTerminal
2194
+ | UnreachableTerminal
2195
+ | ThrowTerminal
2196
+ | ReturnTerminal
2197
+ | GotoTerminal
2198
+ | IfTerminal
2199
+ | BranchTerminal
2200
+ | SwitchTerminal
2201
+ | ForTerminal
2202
+ | ForOfTerminal
2203
+ | ForInTerminal
2204
+ | DoWhileTerminal
2205
+ | WhileTerminal
2206
+ | LogicalTerminal
2207
+ | TernaryTerminal
2208
+ | OptionalTerminal
2209
+ | LabelTerminal
2210
+ | SequenceTerminal
2211
+ | MaybeThrowTerminal
2212
+ | TryTerminal
2213
+ | ReactiveScopeTerminal
2214
+ | PrunedScopeTerminal;
2215
+
2216
+ declare type TernaryTerminal = {
2217
+ kind: "ternary";
2218
+ test: BlockId;
2219
+ fallthrough: BlockId;
2220
+ id: InstructionId;
2221
+ loc: SourceLocation;
2222
+ };
2223
+
2224
+ declare type ThrowTerminal = {
2225
+ kind: "throw";
2226
+ value: Place;
2227
+ id: InstructionId;
2228
+ loc: SourceLocation;
2229
+ fallthrough?: never;
2230
+ };
2231
+
2232
+ declare type TimingEvent = {
2233
+ kind: "Timing";
2234
+ measurement: PerformanceMeasure;
2235
+ };
2236
+
2237
+ declare interface TrackedPackage {
2238
+ deprecatedBelow: string | null;
2239
+ name: string;
2240
+ supported: string[];
2241
+ }
2242
+
2243
+ declare type TryTerminal = {
2244
+ kind: "try";
2245
+ block: BlockId;
2246
+ handlerBinding: Place | null;
2247
+ handler: BlockId;
2248
+ fallthrough: BlockId;
2249
+ id: InstructionId;
2250
+ loc: SourceLocation;
2251
+ };
2252
+
2253
+ declare type Type =
2254
+ | BuiltInType
2255
+ | PhiType
2256
+ | TypeVar
2257
+ | PolyType
2258
+ | PropType
2259
+ | ObjectMethod$1;
2260
+
2261
+ declare type TypeId = number & {
2262
+ [opaqueTypeId]: "IdentifierId";
2263
+ };
2264
+
2265
+ declare type TypeParameter<T> = {
2266
+ name: string;
2267
+ id: TypeParameterId;
2268
+ bound: T;
2269
+ };
2270
+
2271
+ declare type TypeParameterId = number & {
2272
+ [opaqueTypeParameterId]: "TypeParameterId";
2273
+ };
2274
+
2275
+ declare type TypeVar = {
2276
+ kind: "Type";
2277
+ id: TypeId;
2278
+ };
2279
+
2280
+ declare type UnreachableTerminal = {
2281
+ kind: "unreachable";
2282
+ id: InstructionId;
2283
+ loc: SourceLocation;
2284
+ fallthrough?: never;
2285
+ };
2286
+
2287
+ declare type UnsupportedTerminal = {
2288
+ kind: "unsupported";
2289
+ id: InstructionId;
2290
+ loc: SourceLocation;
2291
+ fallthrough?: never;
2292
+ };
2293
+
2294
+ declare type ValidatedIdentifier = {
2295
+ kind: "named";
2296
+ value: ValidIdentifierName;
2297
+ };
2298
+
2299
+ declare type ValidIdentifierName = string & {
2300
+ [opaqueValidIdentifierName]: "ValidIdentifierName";
2301
+ };
2302
+
2303
+ declare enum ValueKind {
2304
+ MaybeFrozen = "maybefrozen",
2305
+ Frozen = "frozen",
2306
+ Primitive = "primitive",
2307
+ Global = "global",
2308
+ Mutable = "mutable",
2309
+ Context = "context",
2310
+ }
2311
+
2312
+ declare enum ValueReason {
2313
+ Global = "global",
2314
+ JsxCaptured = "jsx-captured",
2315
+ HookCaptured = "hook-captured",
2316
+ HookReturn = "hook-return",
2317
+ Effect = "effect",
2318
+ KnownReturnSignature = "known-return-signature",
2319
+ Context = "context",
2320
+ State = "state",
2321
+ ReducerState = "reducer-state",
2322
+ ReactiveFunctionArgument = "reactive-function-argument",
2323
+ Other = "other",
2324
+ }
2325
+
2326
+ declare interface VendorBuildOptions {
2327
+ basePath: string;
2328
+ cwd: string;
2329
+ isApp: boolean;
2330
+ outputDir: string;
2331
+ }
2332
+
2333
+ declare interface ViteOptions {
2334
+ /**
2335
+ * Root path of the studio/sanity app
2336
+ */
2337
+ cwd: string;
2338
+ /**
2339
+ * Returns the environment variables to be injected into the config.
2340
+ */
2341
+ getEnvironmentVariables(): Record<string, string>;
2342
+ /**
2343
+ * Mode to run vite in - eg development or production
2344
+ */
2345
+ mode: "development" | "production";
2346
+ reactCompiler: PluginOptions | undefined;
2347
+ /**
2348
+ * Additional plugins when configured, eg. typegen
2349
+ */
2350
+ additionalPlugins?: Plugin_2[];
2351
+ /**
2352
+ * CSS URLs for auto-updated packages (loaded via module server)
2353
+ */
2354
+ autoUpdatesCssUrls?: string[];
2355
+ /**
2356
+ * Base path (eg under where to serve the app - `/studio` or similar)
2357
+ * Will be normalized to ensure it starts and ends with a `/`
2358
+ */
2359
+ basePath?: string;
2360
+ importMap?: {
2361
+ imports?: Record<string, string>;
2362
+ };
2363
+ isApp?: boolean;
2364
+ /**
2365
+ * Whether or not to minify the output (only used in `mode: 'production'`)
2366
+ */
2367
+ minify?: boolean;
2368
+ /**
2369
+ * Output directory (eg where to place the built files, if any)
2370
+ */
2371
+ outputDir?: string;
2372
+ /**
2373
+ * Schema extraction configuration
2374
+ */
2375
+ schemaExtraction?: CliConfig["schemaExtraction"];
2376
+ /**
2377
+ * HTTP development server configuration
2378
+ */
2379
+ server?: {
2380
+ host?: string;
2381
+ port?: number;
2382
+ };
2383
+ /**
2384
+ * Whether or not to enable source maps
2385
+ */
2386
+ sourceMap?: boolean;
2387
+ }
2388
+
2389
+ declare type WhileTerminal = {
2390
+ kind: "while";
2391
+ loc: SourceLocation;
2392
+ test: BlockId;
2393
+ loop: BlockId;
2394
+ fallthrough: BlockId;
2395
+ id: InstructionId;
2396
+ };
2397
+
2398
+ /**
2399
+ * @internal
2400
+ */
2401
+ export declare function writeFavicons(
2402
+ basePath: string,
2403
+ destDir: string,
2404
+ ): Promise<void>;
2405
+
2406
+ /**
2407
+ * Generates the `.sanity/runtime` directory, and optionally watches for custom
2408
+ * document files, rebuilding when they change
2409
+ *
2410
+ * @param options - Current working directory (Sanity root dir), and whether or not to watch
2411
+ * @returns A watcher instance if watch is enabled, undefined otherwise
2412
+ * @internal
2413
+ */
2414
+ export declare function writeSanityRuntime(
2415
+ options: RuntimeOptions,
2416
+ ): Promise<FSWatcher | undefined>;
2417
+
2418
+ export {};