license.ts — vite Source File
Architecture documentation for license.ts, a typescript file in the vite codebase. 10 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 82f800f1_6da8_8cca_d4a5_6dbc08ca3747["license.ts"] 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7 1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> 031bc221_67a8_c579_f2bf_bb30a08beeb2 50ac7e51_9f94_e985_bfec_ae95273b23b0["isInNodeModules"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> 50ac7e51_9f94_e985_bfec_ae95273b23b0 b8325ee3_313b_4bc2_ecfd_3e3b5441a5f3["sortObjectKeys"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> b8325ee3_313b_4bc2_ecfd_3e3b5441a5f3 dff9cadb_1e8c_7fc9_4119_a173f1f21cbd["packages.ts"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> dff9cadb_1e8c_7fc9_4119_a173f1f21cbd ffeba997_76c6_90dc_3e13_ad296db4ed52["PackageCache"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> ffeba997_76c6_90dc_3e13_ad296db4ed52 d0858125_c73b_0a0a_6dee_ba3fba7e64aa["findNearestMainPackageData"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> d0858125_c73b_0a0a_6dee_ba3fba7e64aa e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> e6032fbc_44cf_58d6_868d_dd15106c18c5 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 --> 51e96894_3556_ed5c_1ede_97d449867adf 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 45981d85_cbdd_e969_8c88_c17072ea0eda --> 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 style 82f800f1_6da8_8cca_d4a5_6dbc08ca3747 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs'
import path from 'node:path'
import type { Plugin } from '../plugin'
import { isInNodeModules, sortObjectKeys } from '../utils'
import type { PackageCache } from '../packages'
import { findNearestMainPackageData } from '../packages'
export interface LicenseEntry {
/**
* Package name
*/
name: string
/**
* Package version
*/
version: string
/**
* SPDX license identifier (from package.json "license" field)
*/
identifier?: string
/**
* License file text
*/
text?: string
}
export interface LicenseOptions {
/**
* The output file name of the license file relative to the output directory.
* Specify a path that ends with `.json` to output the raw JSON metadata.
*
* @default '.vite/license.md'
*/
fileName: string
}
const licenseConfigDefaults = Object.freeze({
fileName: '.vite/license.md',
} satisfies LicenseOptions)
// https://github.com/npm/npm-packlist/blob/53b2a4f42b7fef0f63e8f26a3ea4692e23a58fed/lib/index.js#L284-L286
const licenseFiles = [/^license/i, /^licence/i, /^copying/i]
export function licensePlugin(): Plugin {
return {
name: 'vite:license',
async generateBundle(_, bundle) {
const licenseOption = this.environment.config.build.license
if (licenseOption === false) return
const packageCache: PackageCache = new Map()
// Track license via a key to its license entry.
// A key consists of "name@version" of a package.
const licenses: Record<string, LicenseEntry> = {}
for (const file in bundle) {
const chunk = bundle[file]
if (chunk.type === 'asset') continue
// ... (91 more lines)
Domain
Subdomains
Dependencies
Imported By
Source
Frequently Asked Questions
What does license.ts do?
license.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain, AssetManagement subdomain.
What functions are defined in license.ts?
license.ts defines 3 function(s): findLicenseFile, licenseEntryToMarkdown, licensePlugin.
What does license.ts depend on?
license.ts imports 10 module(s): PackageCache, Plugin, findNearestMainPackageData, isInNodeModules, node:fs, node:path, packages.ts, plugin.ts, and 2 more.
What files import license.ts?
license.ts is imported by 1 file(s): build.ts.
Where is license.ts in the architecture?
license.ts is located at packages/vite/src/node/plugins/license.ts (domain: PluginSystem, subdomain: AssetManagement, 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