@@ -6,6 +6,13 @@ import { stringToUuid } from './helpers/stringToUuid';
66export class SourceProcessor {
77 constructor ( private readonly _debugIdGenerator : DebugIdGenerator ) { }
88
9+ /**
10+ * Adds required snippets and comments to source, and modifies sourcemap to include debug ID.
11+ * @param source Source content.
12+ * @param sourceMap Sourcemap object or JSON.
13+ * @param debugId Debug ID. If not provided, one will be generated from `source`.
14+ * @returns Used debug ID, new source and new sourcemap.
15+ */
916 public async processSourceAndSourceMap ( source : string , sourceMap : string | RawSourceMap , debugId ?: string ) {
1017 if ( ! debugId ) {
1118 debugId = stringToUuid ( source ) ;
@@ -23,6 +30,14 @@ export class SourceProcessor {
2330 return { debugId, source : newSource , sourceMap : newSourceMap } ;
2431 }
2532
33+ /**
34+ * Adds required snippets and comments to source, and modifies sourcemap to include debug ID.
35+ * Will write modified content to the files.
36+ * @param sourcePath Path to the source.
37+ * @param sourceMapPath Path to the sourcemap.
38+ * @param debugId Debug ID. If not provided, one will be generated from `source`.
39+ * @returns Used debug ID.
40+ */
2641 public async processSourceAndSourceMapFiles ( sourcePath : string , sourceMapPath : string , debugId ?: string ) {
2742 const source = await fs . promises . readFile ( sourcePath , 'utf8' ) ;
2843 const sourceMap = await fs . promises . readFile ( sourceMapPath , 'utf8' ) ;
0 commit comments