Home / File/ importMetaGlob.ts — vite Source File

importMetaGlob.ts — vite Source File

Architecture documentation for importMetaGlob.ts, a typescript file in the vite codebase. 28 imports, 5 dependents.

File typescript PluginSystem LegacySupport 28 imports 5 dependents 13 functions

Entity Profile

Dependency Diagram

graph LR
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb["importMetaGlob.ts"]
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  a3adc511_3c03_7f25_9d76_5d3ed9987eb5["moduleGraph.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> a3adc511_3c03_7f25_9d76_5d3ed9987eb5
  fc3efa20_5545_5daf_3cf9_fa65c8365591["EnvironmentModuleNode"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> fc3efa20_5545_5daf_3cf9_fa65c8365591
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  eb5604c2_58e1_1c00_5a1a_5d97ea5236ad["ResolvedConfig"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> eb5604c2_58e1_1c00_5a1a_5d97ea5236ad
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  59716ea1_465c_8cb5_daff_ba167d787a1e["evalValue"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 59716ea1_465c_8cb5_daff_ba167d787a1e
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> a4adb1a7_cf54_091f_eb63_8217e684a8e1
  6841c80c_8127_d8ce_ac5d_bb48de9eee42["transformStableResult"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> 6841c80c_8127_d8ce_ac5d_bb48de9eee42
  eca93de5_04d5_dda0_7ae6_2ceb5379ea81["logger.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> eca93de5_04d5_dda0_7ae6_2ceb5379ea81
  fff7f05e_fc73_d337_53a0_b846230bc8e2["Logger"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> fff7f05e_fc73_d337_53a0_b846230bc8e2
  abfc9e70_3c15_b3f0_a595_3cf27afb7e64["utils.ts"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> abfc9e70_3c15_b3f0_a595_3cf27afb7e64
  f094d39d_cd97_2548_86c3_38902c2f3301["slash"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb --> f094d39d_cd97_2548_86c3_38902c2f3301
  style b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isAbsolute, posix } from 'node:path'
import picomatch from 'picomatch'
import { stripLiteral } from 'strip-literal'
import colors from 'picocolors'
import type {
  ArrayExpression,
  Expression,
  Literal,
  Node,
  SpreadElement,
  TemplateLiteral,
} from 'estree'
import type { CustomPluginOptions, RollupError } from 'rolldown'
import MagicString from 'magic-string'
import { stringifyQuery } from 'ufo'
import { parseAstAsync } from 'rolldown/parseAst'
import { escapePath, glob } from 'tinyglobby'
import { viteImportGlobPlugin as nativeImportGlobPlugin } from 'rolldown/experimental'
import type { GeneralImportGlobOptions } from '#types/importGlob'
import type { Plugin } from '../plugin'
import type { EnvironmentModuleNode } from '../server/moduleGraph'
import type { ResolvedConfig } from '../config'
import { evalValue, normalizePath, transformStableResult } from '../utils'
import type { Logger } from '../logger'
import { slash } from '../../shared/utils'
import type { Environment } from '../environment'

export interface ParsedImportGlob {
  index: number
  globs: string[]
  globsResolved: string[]
  isRelative: boolean
  options: ParsedGeneralImportGlobOptions
  start: number
  end: number
  onlyKeys: boolean
  onlyValues: boolean
}

interface ParsedGeneralImportGlobOptions extends GeneralImportGlobOptions {
  query?: string
}

export function importGlobPlugin(config: ResolvedConfig): Plugin {
  if (config.isBundled && config.nativePluginEnabledLevel >= 1) {
    return nativeImportGlobPlugin({
      root: config.root,
      sourcemap: !!config.build.sourcemap,
      restoreQueryExtension: config.experimental.importGlobRestoreExtension,
    })
  }

  const importGlobMaps = new Map<
    Environment,
    Map<string, Array<(file: string) => boolean>>
  >()

  return {
    name: 'vite:import-glob',
    buildStart() {
// ... (657 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does importMetaGlob.ts do?
importMetaGlob.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain, LegacySupport subdomain.
What functions are defined in importMetaGlob.ts?
importMetaGlob.ts defines 13 function(s): err, findCorrespondingCloseParenthesisPosition, getCommonBase, globSafePath, globSafeResolvedPath, id, importGlobPlugin, isVirtualModule, lastNthChar, parseGlobOptions, and 3 more.
What does importMetaGlob.ts depend on?
importMetaGlob.ts imports 28 module(s): Environment, EnvironmentModuleNode, Logger, Plugin, ResolvedConfig, config.ts, environment.ts, estree, and 20 more.
What files import importMetaGlob.ts?
importMetaGlob.ts is imported by 5 file(s): fixture.spec.ts, index.ts, parse.spec.ts, scan.ts, utils.spec.ts.
Where is importMetaGlob.ts in the architecture?
importMetaGlob.ts is located at packages/vite/src/node/plugins/importMetaGlob.ts (domain: PluginSystem, subdomain: LegacySupport, directory: packages/vite/src/node/plugins).

Analyze Your Own Codebase

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

Try Supermodel Free