js-sourcemap.spec.ts — vite Source File
Architecture documentation for js-sourcemap.spec.ts, a typescript file in the vite codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 17ec97fb_0e5f_a169_a810_444052192dbc["js-sourcemap.spec.ts"] fa6ef7e9_30f9_8e01_a71f_c84fe1d37fab["foo-with-sourcemap-plugin.ts"] 17ec97fb_0e5f_a169_a810_444052192dbc --> fa6ef7e9_30f9_8e01_a71f_c84fe1d37fab 6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"] 17ec97fb_0e5f_a169_a810_444052192dbc --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7 10809968_066c_58db_f8b4_cb0464da805e["node:util"] 17ec97fb_0e5f_a169_a810_444052192dbc --> 10809968_066c_58db_f8b4_cb0464da805e 2dd48a01_733b_e717_9c4b_f4fe7eb42567["node:child_process"] 17ec97fb_0e5f_a169_a810_444052192dbc --> 2dd48a01_733b_e717_9c4b_f4fe7eb42567 e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"] 17ec97fb_0e5f_a169_a810_444052192dbc --> e6032fbc_44cf_58d6_868d_dd15106c18c5 a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 17ec97fb_0e5f_a169_a810_444052192dbc --> a340ba46_b2b7_3048_3bb3_6907a74c8464 dc6f5c19_97fd_e1d7_2ae6_6a0d69e562e6["convert-source-map"] 17ec97fb_0e5f_a169_a810_444052192dbc --> dc6f5c19_97fd_e1d7_2ae6_6a0d69e562e6 d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"] 17ec97fb_0e5f_a169_a810_444052192dbc --> d3fd5575_295b_d6be_24dd_62d277645dc9 style 17ec97fb_0e5f_a169_a810_444052192dbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { URL, fileURLToPath } from 'node:url'
import { promisify } from 'node:util'
import { execFile } from 'node:child_process'
import { existsSync } from 'node:fs'
import { describe, expect, test } from 'vitest'
import { mapFileCommentRegex } from 'convert-source-map'
import { commentSourceMap } from '../foo-with-sourcemap-plugin'
import {
extractSourcemap,
findAssetFile,
formatSourcemapForSnapshot,
isBuild,
listAssets,
page,
readFile,
serverLogs,
} from '~utils'
if (!isBuild) {
test('js', async () => {
const res = await page.request.get(new URL('./foo.js', page.url()).href)
const js = await res.text()
const map = extractSourcemap(js)
expect(formatSourcemapForSnapshot(map, js)).toMatchInlineSnapshot(`
SourceMap {
content: {
"mappings": "AAAA,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;",
"sources": [
"foo.js",
],
"sourcesContent": [
"export const foo = 'foo'
",
],
"version": 3,
},
visualization: "https://evanw.github.io/source-map-visualization/#MjUAZXhwb3J0IGNvbnN0IGZvbyA9ICdmb28nCjE1MQB7InZlcnNpb24iOjMsInNvdXJjZXMiOlsiZm9vLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBmb28gPSAnZm9vJ1xuIl0sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHOyJ9"
}
`)
})
test('plugin return sourcemap with `sources: [""]`', async () => {
const res = await page.request.get(new URL('./zoo.js', page.url()).href)
const js = await res.text()
expect(js).toContain('// add comment')
const map = extractSourcemap(js)
expect(formatSourcemapForSnapshot(map, js)).toMatchInlineSnapshot(`
SourceMap {
content: {
"mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;",
"sources": [
"zoo.js",
],
"sourcesContent": [
"export const zoo = 'zoo'
",
],
"version": 3,
},
// ... (230 more lines)
Domain
Dependencies
- convert-source-map
- foo-with-sourcemap-plugin.ts
- node:child_process
- node:fs
- node:url
- node:util
- vitest
- ~utils
Source
Frequently Asked Questions
What does js-sourcemap.spec.ts do?
js-sourcemap.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does js-sourcemap.spec.ts depend on?
js-sourcemap.spec.ts imports 8 module(s): convert-source-map, foo-with-sourcemap-plugin.ts, node:child_process, node:fs, node:url, node:util, vitest, ~utils.
Where is js-sourcemap.spec.ts in the architecture?
js-sourcemap.spec.ts is located at playground/js-sourcemap/__tests__/js-sourcemap.spec.ts (domain: ViteCore, directory: playground/js-sourcemap/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free