2021-12-01 16:24:29 +00:00
|
|
|
/// SPDX-License-Identifier: GPL-3.0-or-later
|
2023-01-17 10:43:15 +00:00
|
|
|
/// SPDX-FileCopyrightText: Copyright © 2016-2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
2021-12-01 16:24:29 +00:00
|
|
|
|
2021-01-20 20:56:01 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
import { SourceMap } from '@syndicate-lang/compiler/lib/syntax/index.js';
|
|
|
|
import { Syntax } from '@syndicate-lang/compiler';
|
|
|
|
const { vlqDecode } = Syntax;
|
|
|
|
|
|
|
|
export function main(argv: string[]) {
|
|
|
|
const mapFilename = argv[0];
|
|
|
|
console.log(mapFilename);
|
|
|
|
const map = JSON.parse(fs.readFileSync(mapFilename, 'utf-8')) as SourceMap;
|
|
|
|
console.log(map);
|
|
|
|
|
|
|
|
const entries = map.mappings.split(/;/).map(e => e.split(/,/).map(vlqDecode));
|
|
|
|
entries.forEach((line, lineNumber) =>
|
|
|
|
console.log(lineNumber + 1, line));
|
|
|
|
}
|