terser.spec.ts — vite Source File
Architecture documentation for terser.spec.ts, a typescript file in the vite codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 63e3e6d8_8d0a_3775_f49f_290b042141cc["terser.spec.ts"] be81372e_415b_426f_d3c1_132b2d458ce6["terser.ts"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> be81372e_415b_426f_d3c1_132b2d458ce6 3d5e3088_a287_0457_8ef8_b5974e6a1fe1["TerserOptions"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> 3d5e3088_a287_0457_8ef8_b5974e6a1fe1 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> 51e96894_3556_ed5c_1ede_97d449867adf a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> a340ba46_b2b7_3048_3bb3_6907a74c8464 54c37fea_4fe7_2693_71cb_1276b77f55f9["vite"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> 54c37fea_4fe7_2693_71cb_1276b77f55f9 6701bba9_3d8f_f5b8_c0a6_edc7752de5de["rollup"] 63e3e6d8_8d0a_3775_f49f_290b042141cc --> 6701bba9_3d8f_f5b8_c0a6_edc7752de5de style 63e3e6d8_8d0a_3775_f49f_290b042141cc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { resolve } from 'node:path'
import { describe, expect, test } from 'vitest'
import { build } from 'vite'
import type { RollupOutput } from 'rollup'
import type { TerserOptions } from '../../plugins/terser'
describe('terser', () => {
const run = async (terserOptions: TerserOptions) => {
const result = (await build({
root: resolve(import.meta.dirname, '../packages/build-project'),
logLevel: 'silent',
build: {
write: false,
minify: 'terser',
terserOptions,
},
plugins: [
{
name: 'test',
resolveId(id) {
if (id === 'entry.js') {
return '\0' + id
}
},
load(id) {
if (id === '\0entry.js') {
return `
const foo = 1;
console.log(foo);
const bar = { hello: 1, ["world"]: 2 };
console.log(bar.hello + bar["world"]);
`
}
},
},
],
})) as RollupOutput
return result.output[0].code
}
test('basic', async () => {
await run({})
})
test('nth', async () => {
const resultCode = await run({
mangle: {
nth_identifier: {
get: (n) => {
return 'prefix_' + n.toString()
},
},
},
})
expect(resultCode).toContain('prefix_')
})
test('nameCache', async () => {
const nameCache = {}
await run({
compress: false,
mangle: {
properties: {
keep_quoted: true,
},
},
nameCache,
})
expect(nameCache).toHaveProperty('props.props.$hello')
expect(nameCache).not.toHaveProperty('props.props.$world')
})
})
Domain
Dependencies
- TerserOptions
- node:path
- rollup
- terser.ts
- vite
- vitest
Source
Frequently Asked Questions
What does terser.spec.ts do?
terser.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does terser.spec.ts depend on?
terser.spec.ts imports 6 module(s): TerserOptions, node:path, rollup, terser.ts, vite, vitest.
Where is terser.spec.ts in the architecture?
terser.spec.ts is located at packages/vite/src/node/__tests__/plugins/terser.spec.ts (domain: ViteCore, directory: packages/vite/src/node/__tests__/plugins).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free