packages.ts — vite Source File
Architecture documentation for packages.ts, a typescript file in the vite codebase. 12 imports, 9 dependents.
Entity Profile
Dependency Diagram
graph LR dff9cadb_1e8c_7fc9_4119_a173f1f21cbd["packages.ts"] 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 031bc221_67a8_c579_f2bf_bb30a08beeb2 50ac7e51_9f94_e985_bfec_ae95273b23b0["isInNodeModules"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 50ac7e51_9f94_e985_bfec_ae95273b23b0 a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> a4adb1a7_cf54_091f_eb63_8217e684a8e1 cd901a4b_1290_4e3f_0c59_f8621634cb5a["stripBomTag"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> cd901a4b_1290_4e3f_0c59_f8621634cb5a a9bd45ce_8339_2b77_7543_41c306ebdb02["tryStatSync"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> a9bd45ce_8339_2b77_7543_41c306ebdb02 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7 1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef dcff87b0_a8ea_57a2_3b29_a7b8f19986f3["resolve.ts"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> dcff87b0_a8ea_57a2_3b29_a7b8f19986f3 3b063797_1fb9_a959_f5c1_af0fc226ed57["InternalResolveOptions"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 3b063797_1fb9_a959_f5c1_af0fc226ed57 e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> e6032fbc_44cf_58d6_868d_dd15106c18c5 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> 51e96894_3556_ed5c_1ede_97d449867adf ad382781_051b_4f17_29a3_3e882464e6c0["node:module"] dff9cadb_1e8c_7fc9_4119_a173f1f21cbd --> ad382781_051b_4f17_29a3_3e882464e6c0 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 45981d85_cbdd_e969_8c88_c17072ea0eda --> dff9cadb_1e8c_7fc9_4119_a173f1f21cbd 7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"] 7da774f9_eca5_d54e_6e01_6bee7d460a2b --> dff9cadb_1e8c_7fc9_4119_a173f1f21cbd style dff9cadb_1e8c_7fc9_4119_a173f1f21cbd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs'
import path from 'node:path'
import { createRequire } from 'node:module'
import {
createFilter,
isInNodeModules,
normalizePath,
safeRealpathSync,
stripBomTag,
tryStatSync,
} from './utils'
import type { Plugin } from './plugin'
import type { InternalResolveOptions } from './plugins/resolve'
let pnp: typeof import('pnpapi') | undefined
if (process.versions.pnp) {
try {
pnp = createRequire(/** #__KEEP__ */ import.meta.url)('pnpapi')
} catch {}
}
/** Cache for package.json resolution and package.json contents */
export type PackageCache = Map<string, PackageData>
export interface PackageData {
dir: string
hasSideEffects: (id: string) => boolean | 'no-treeshake' | null
setResolvedCache: (
key: string,
entry: string,
options: InternalResolveOptions,
) => void
getResolvedCache: (
key: string,
options: InternalResolveOptions,
) => string | undefined
data: {
[field: string]: any
name: string
type: string
version: string
main: string
module: string
browser: string | Record<string, string | false>
exports: string | Record<string, any> | string[]
imports: Record<string, any>
dependencies: Record<string, string>
}
}
function invalidatePackageData(
packageCache: PackageCache,
pkgPath: string,
): void {
const pkgDir = normalizePath(path.dirname(pkgPath))
packageCache.forEach((pkg, cacheKey) => {
if (pkg.dir === pkgDir) {
packageCache.delete(cacheKey)
}
})
// ... (332 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- InternalResolveOptions
- Plugin
- isInNodeModules
- node:fs
- node:module
- node:path
- normalizePath
- plugin.ts
- resolve.ts
- stripBomTag
- tryStatSync
- utils.ts
Imported By
- packages/vite/src/node/build.ts
- packages/vite/src/node/config.ts
- packages/vite/src/node/plugins/css.ts
- packages/vite/src/node/plugins/index.ts
- packages/vite/src/node/plugins/license.ts
- packages/vite/src/node/optimizer/resolve.ts
- packages/vite/src/node/plugins/resolve.ts
- packages/vite/src/node/optimizer/rolldownDepPlugin.ts
- packages/vite/src/node/utils.ts
Source
Frequently Asked Questions
What does packages.ts do?
packages.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in packages.ts?
packages.ts defines 17 function(s): findNearestMainPackageData, findNearestNodeModules, findNearestPackageData, getFnpdCache, getFnpdCacheKey, getResolveCacheKey, getRpdCache, getRpdCacheKey, id, invalidatePackageData, and 7 more.
What does packages.ts depend on?
packages.ts imports 12 module(s): InternalResolveOptions, Plugin, isInNodeModules, node:fs, node:module, node:path, normalizePath, plugin.ts, and 4 more.
What files import packages.ts?
packages.ts is imported by 9 file(s): build.ts, config.ts, css.ts, index.ts, license.ts, resolve.ts, resolve.ts, rolldownDepPlugin.ts, and 1 more.
Where is packages.ts in the architecture?
packages.ts is located at packages/vite/src/node/packages.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free