mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
19 lines
693 B
TypeScript
19 lines
693 B
TypeScript
import type { Protocol } from 'devtools-protocol';
|
|
import { DynamicParsedCodeRecord, SourceTextModuleRecord, type ScriptRecord } from '#self';
|
|
|
|
export function getParsedEvent(source: ScriptRecord | SourceTextModuleRecord | DynamicParsedCodeRecord, id: string, executionContextId: number): Protocol.Debugger.ScriptParsedEvent {
|
|
const lines = source.ECMAScriptCode.sourceText.split('\n');
|
|
return {
|
|
isModule: source instanceof SourceTextModuleRecord,
|
|
scriptId: id,
|
|
url: source.HostDefined.specifier || `vm:///${id}`,
|
|
startLine: 0,
|
|
startColumn: 0,
|
|
endLine: lines.length,
|
|
endColumn: lines.pop()!.length,
|
|
executionContextId,
|
|
hash: '',
|
|
buildId: '',
|
|
};
|
|
}
|