Skip to content

Commit da2f52a

Browse files
committed
feat: Source Map Visualizer v1.2.1
This release improves .desc file handling and adds automated release tooling. ## Fixed - Fixed .desc file serialization for mappings without source information - No-source mappings now correctly output as [17] instead of [17,1,undefined,undefined,UNKNOWN] - Fixed .desc file content handling to always load fresh from disk - Content is now refreshed when files change or OUTPUT field is updated - Ensures .desc files always reflect current state of actual files ## Added - Automated release process with make release VERSION=x.x.x command - Comprehensive release automation and verification scripts - Claude project commands for common development workflows ## Changed - Improved release workflow documentation - Enhanced verification scripts to prevent development files from reaching master
1 parent 38c289e commit da2f52a

File tree

11 files changed

+513
-676
lines changed

11 files changed

+513
-676
lines changed

docs/USER_GUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ The `.desc` format is a human-readable source map description:
7878

7979
```
8080
INPUT: source-file.ext
81-
VERSION
82-
1.0.0
83-
-- Optional comments
81+
<contents of source-file.ext>
8482
8583
OUTPUT: generated-file.ext
86-
<generated code content>
84+
<contents of generated-file.ext>
8785
8886
# Mappings use 1-based indices
8987
[gen-col,src-idx,src-line,src-col,TYPE] -- optional comment
9088
[-] -- line break marker
9189
```
9290

91+
Note: The file contents shown after INPUT and OUTPUT lines are included for readability. When saving, these contents are always read fresh from disk to ensure they reflect the current state of the actual files.
92+
9393
Example:
9494
```
9595
INPUT: example.uwu

src/commands/convertToDesc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
22
import * as path from 'path';
33
import * as fs from 'fs';
44
import { MapToDescConverter } from '../converter/MapToDescConverter';
5-
import { DescSerializer } from '../converter/DescSerializer';
5+
import { DescParser } from '../editor/DescParser';
66
import { SourceMapV3 } from '../common/DescEditorMessages';
77
import { Logger } from '../common/logger';
88

@@ -43,7 +43,6 @@ export async function convertToDescCommand(uri?: vscode.Uri): Promise<void> {
4343

4444
// Convert to .desc format
4545
const descFile = MapToDescConverter.convert(sourceMap, fileUri.fsPath);
46-
const descContent = DescSerializer.serialize(descFile);
4746

4847
// Ask user where to save
4948
const defaultPath = fileUri.fsPath.replace(/\.map$/, '.desc');
@@ -56,6 +55,7 @@ export async function convertToDescCommand(uri?: vscode.Uri): Promise<void> {
5655
});
5756

5857
if (saveUri) {
58+
const descContent = await DescParser.serializeToFile(descFile, saveUri.fsPath);
5959
await fs.promises.writeFile(saveUri.fsPath, descContent);
6060
vscode.window.showInformationMessage(`Description file created at ${path.basename(saveUri.fsPath)}`);
6161

src/common/DescEditorMessages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface UpdateDescMessage extends BaseDescMessage {
2121
type: 'update';
2222
desc: DescFile;
2323
sourceContent: string;
24+
outputContent: string;
2425
documentUri: string;
2526
}
2627

src/converter/DescSerializer.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/converter/MapToDescConverter.ts

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SourceMapV3 } from '../common/DescEditorMessages';
2-
import { DescFile, DescHeader, DescOutput, DescMapping } from '../editor/DescParser';
2+
import { DescFile, DescHeader, DescMapping } from '../editor/DescParser';
33
import { decodeVLQ } from '../common/vlq';
44
import { FileService } from '../common/FileService';
55
import * as vscode from 'vscode';
@@ -21,30 +21,23 @@ export class MapToDescConverter {
2121
const mapFileUri = vscode.Uri.file(mapFilePath);
2222

2323
// Create header with resolved source file paths
24+
const resolvedOutputPath = sourceMap.file
25+
? fileService.resolveGeneratedFile(sourceMap.file, mapFileUri) || sourceMap.file
26+
: path.basename(mapFilePath, '.map');
27+
2428
const header: DescHeader = {
2529
inputs: sourceMap.sources.map(src => {
2630
// Use FileService to resolve paths with suffix matching
2731
return fileService.resolvePath(src, mapFileUri, sourceMap.sourceRoot);
2832
}),
29-
comments: []
30-
};
31-
32-
// Create output section with resolved generated file path
33-
const resolvedOutputPath = sourceMap.file
34-
? fileService.resolveGeneratedFile(sourceMap.file, mapFileUri) || sourceMap.file
35-
: path.basename(mapFilePath, '.map');
36-
37-
const output: DescOutput = {
38-
filename: resolvedOutputPath,
39-
content: this.generateOutputContent(sourceMap, decodedMappings)
33+
output: resolvedOutputPath
4034
};
4135

4236
// Convert decoded mappings to DescMapping format
4337
const mappings: DescMapping[] = this.convertToDescMappings(decodedMappings, sourceMap.names);
4438

4539
return {
4640
header,
47-
output,
4841
mappings
4942
};
5043
}
@@ -142,23 +135,6 @@ export class MapToDescConverter {
142135
/**
143136
* Generate output content with line numbers
144137
*/
145-
private static generateOutputContent(_sourceMap: SourceMapV3, mappings: DecodedMapping[]): string {
146-
// Find the maximum line number to determine content length
147-
let maxLine = 0;
148-
for (const mapping of mappings) {
149-
if (mapping.genLine > maxLine) {
150-
maxLine = mapping.genLine;
151-
}
152-
}
153-
154-
// Generate placeholder content with line numbers
155-
const lines: string[] = [];
156-
for (let i = 1; i <= maxLine; i++) {
157-
lines.push(`// Line ${i}`);
158-
}
159-
160-
return lines.join('\n');
161-
}
162138

163139
/**
164140
* Convert decoded mappings to DescMapping format

0 commit comments

Comments
 (0)