getappmap / appmap-node

AppMap client agent for Node.js
Other
10 stars 4 forks source link

fix: Properly parse tsconfig.json #114

Closed zermelo-wisen closed 9 months ago

zermelo-wisen commented 9 months ago

Fixes #91

tsconfig.json cannot be parsed with JSON.parse properly. It can have trailing comma which is not legal in JSON. Use typescript.readConfigFile instead.

zermelo-wisen commented 9 months ago

I'm very wary of pulling in whole typescript — it's quite large and will make the recommended usage with npx particularly more inconvenient. I'd look into other ways of parsing it — tsconfck looks promising.

BTW, any change like this should include test cases that didn't work before and now do.

I dropped typescript and strip-json-comments libraries and added json5 for parsing the tsconfig.json.

For the test case, I added a trailing comma to the tsconfig.json in test/typescript-esm, since tsconfig parsing code path is covered with the "esm-loader is loaded when required" integration test in typescript-esm.test.ts.

appland-release commented 9 months ago

:tada: This PR is included in version 2.16.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: