Home / Function/ makePluginOptions() — react Function Reference

makePluginOptions() — react Function Reference

Architecture documentation for the makePluginOptions() function in compiler.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f4c5894c_f623_de40_477c_448f60514907["makePluginOptions()"]
  f294d5ab_dd3b_6bca_e120_e970909a7dc8["compiler.ts"]
  f4c5894c_f623_de40_477c_448f60514907 -->|defined in| f294d5ab_dd3b_6bca_e120_e970909a7dc8
  34f68e46_4ab8_f2b5_b44f_59f14d4d25b8["transformFixtureInput()"]
  34f68e46_4ab8_f2b5_b44f_59f14d4d25b8 -->|calls| f4c5894c_f623_de40_477c_448f60514907
  be453c75_64b7_4b3f_3c65_f13f8f53e2b9["makeSharedRuntimeTypeProvider()"]
  f4c5894c_f623_de40_477c_448f60514907 -->|calls| be453c75_64b7_4b3f_3c65_f13f8f53e2b9
  style f4c5894c_f623_de40_477c_448f60514907 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/snap/src/compiler.ts lines 48–103

function makePluginOptions(
  firstLine: string,
  parseConfigPragmaFn: typeof ParseConfigPragma,
  debugIRLogger: (value: CompilerPipelineValue) => void,
  EffectEnum: typeof Effect,
  ValueKindEnum: typeof ValueKind,
  ValueReasonEnum: typeof ValueReason,
): {
  options: PluginOptions;
  loggerTestOnly: boolean;
  logs: Array<{filename: string | null; event: LoggerEvent}>;
} {
  // TODO(@mofeiZ) rewrite snap fixtures to @validatePreserveExistingMemo:false
  let validatePreserveExistingMemoizationGuarantees = false;
  let target: CompilerReactTarget = '19';

  /**
   * Snap currently runs all fixtures without `validatePreserveExistingMemo` as
   * most fixtures are interested in compilation output, not whether the
   * compiler was able to preserve existing memo.
   *
   * TODO: flip the default. `useMemo` is rare in test fixtures -- fixtures that
   * use useMemo should be explicit about whether this flag is enabled
   */
  if (firstLine.includes('@validatePreserveExistingMemoizationGuarantees')) {
    validatePreserveExistingMemoizationGuarantees = true;
  }

  const loggerTestOnly = firstLine.includes('@loggerTestOnly');
  const logs: Array<{filename: string | null; event: LoggerEvent}> = [];
  const logger: Logger = {
    logEvent: (filename, event) => {
      logs.push({filename, event});
    },
    debugLogIRs: debugIRLogger,
  };

  const config = parseConfigPragmaFn(firstLine, {compilationMode: 'all'});
  const options = {
    ...config,
    environment: {
      ...config.environment,
      moduleTypeProvider: makeSharedRuntimeTypeProvider({
        EffectEnum,
        ValueKindEnum,
        ValueReasonEnum,
      }),
      assertValidMutableRanges: true,
      validatePreserveExistingMemoizationGuarantees,
    },
    logger,
    enableReanimatedCheck: false,
    target,
  };
  return {options, loggerTestOnly, logs};
}

Domain

Subdomains

Frequently Asked Questions

What does makePluginOptions() do?
makePluginOptions() is a function in the react codebase, defined in compiler/packages/snap/src/compiler.ts.
Where is makePluginOptions() defined?
makePluginOptions() is defined in compiler/packages/snap/src/compiler.ts at line 48.
What does makePluginOptions() call?
makePluginOptions() calls 1 function(s): makeSharedRuntimeTypeProvider.
What calls makePluginOptions()?
makePluginOptions() is called by 1 function(s): transformFixtureInput.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free