Skip to content

Improve type output of sourcemaps #5578

@ArnaudBarre

Description

@ArnaudBarre

Currently OXC outputs this for sourcemap types:

export interface SourceMap {
  file?: string
  mappings?: string
  sourceRoot?: string
  sources?: Array<string | undefined | null>
  sourcesContent?: Array<string | undefined | null>
  names?: Array<string>
}

Looking at the code, I think this more because the input type is reused as the output type

Currently Rollup/Vite requires this as a source map input:

export interface ExistingRawSourceMap {
	file?: string;
	mappings: string;
	names: string[];
	sourceRoot?: string;
	sources: string[];
	sourcesContent?: string[];
	version: number;
	x_google_ignoreList?: number[];
}

Having this be compatible will make it easier to write a transform plugin for Rollup/Vite that uses OXC

Note the required version: number; which can probably be hardcoded to 3 when serializing.

Metadata

Metadata

Assignees

Labels

C-enhancementCategory - New feature or request

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions