Home / File/ index.ts — vite Source File

index.ts — vite Source File

Architecture documentation for index.ts, a typescript file in the vite codebase. 4 imports, 1 dependents.

File typescript ModuleRunner SourcemapHandler 4 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d["index.ts"]
  29e248d2_9983_1037_00e6_8bcd9ee87840["runner.ts"]
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d --> 29e248d2_9983_1037_00e6_8bcd9ee87840
  1d3ff778_7ac6_0038_640f_997e968c3c8f["ModuleRunner"]
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d --> 1d3ff778_7ac6_0038_640f_997e968c3c8f
  95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"]
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d --> 95cae2f2_ad8c_91c1_5a74_93d939dbc47b
  dcb2b4e7_ff7f_675e_b5df_3152ca6e9684["interceptStackTrace"]
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d --> dcb2b4e7_ff7f_675e_b5df_3152ca6e9684
  29e248d2_9983_1037_00e6_8bcd9ee87840["runner.ts"]
  29e248d2_9983_1037_00e6_8bcd9ee87840 --> bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d
  style bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ModuleRunner } from '../runner'
import { interceptStackTrace } from './interceptor'

export function enableSourceMapSupport(runner: ModuleRunner): () => void {
  if (runner.options.sourcemapInterceptor === 'node') {
    if (typeof process === 'undefined') {
      throw new TypeError(
        `Cannot use "sourcemapInterceptor: 'node'" because global "process" variable is not available.`,
      )
    }
    /* eslint-disable n/no-unsupported-features/node-builtins -- process.setSourceMapsEnabled and process.sourceMapsEnabled */
    if (typeof process.setSourceMapsEnabled !== 'function') {
      throw new TypeError(
        `Cannot use "sourcemapInterceptor: 'node'" because "process.setSourceMapsEnabled" function is not available. Please use Node >= 16.6.0.`,
      )
    }
    const isEnabledAlready = process.sourceMapsEnabled ?? false
    process.setSourceMapsEnabled(true)
    return () => !isEnabledAlready && process.setSourceMapsEnabled(false)
    /* eslint-enable n/no-unsupported-features/node-builtins */
  }
  return interceptStackTrace(
    runner,
    typeof runner.options.sourcemapInterceptor === 'object'
      ? runner.options.sourcemapInterceptor
      : undefined,
  )
}

Domain

Subdomains

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the vite codebase, written in typescript. It belongs to the ModuleRunner domain, SourcemapHandler subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): enableSourceMapSupport.
What does index.ts depend on?
index.ts imports 4 module(s): ModuleRunner, interceptStackTrace, interceptor.ts, runner.ts.
What files import index.ts?
index.ts is imported by 1 file(s): runner.ts.
Where is index.ts in the architecture?
index.ts is located at packages/vite/src/module-runner/sourcemap/index.ts (domain: ModuleRunner, subdomain: SourcemapHandler, directory: packages/vite/src/module-runner/sourcemap).

Analyze Your Own Codebase

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

Try Supermodel Free