[X] All compiled assets are included (atom packages are git tags and hence the built files need to be a part of the source control)
At the moment, the algorithm is as follows:
From the TypeScript source file in question, traverse the directory tree upwards, looking for .atom-typescript.json or .atom/atom-typescript.json or .vscode/settings.json in each directory (in that order, i.e. if a directory contains .atom-typescript.json, only that one will be used). If a file is found, parse it as a JSON object and
If the JSON object has tsdkPath property, assign it to sdkPath.
Otherwise, if the JSON object has typescript.tsdk property, use the parent directory name of the path specified in the property as sdkPath (i.e. sdkPath = path.dirname(jsonObject['typescript.tsdk']))
Otherwise, go to 2.
If sdkPath is relative, assume it is relative to the directory being traversed. Check if tsserver/tsc binary exists under ${sdkPath}/lib/${binaryName}.js. If it exists, use it, else go to 2.
Use Atom configuration atom-typescript.tsdkPath as as path to TypeScript SDK installation directory. Check if tsserver/tsc binary exists under ${tsdkPath}/lib/${binaryName}.js. If it exists, use it, else go to 3.
Use the bundled TypeScript SDK.
Notes:
the result of the main binary resolution function is memoized to avoid costly directory traversal.
have to use jsonc-parser instead of good-ol' JSON.parse due to vscode compatibility layer
P.S. (1) might seem somewhat extraneous, considering atomic-management exists, however, there are a few caveats with that, and we probably want a solution that isn't dependent on community packages (so that it works unconditionally)
At the moment, the algorithm is as follows:
From the TypeScript source file in question, traverse the directory tree upwards, looking for
.atom-typescript.json
or.atom/atom-typescript.json
or.vscode/settings.json
in each directory (in that order, i.e. if a directory contains.atom-typescript.json
, only that one will be used). If a file is found, parse it as a JSON object andtsdkPath
property, assign it tosdkPath
.typescript.tsdk
property, use the parent directory name of the path specified in the property assdkPath
(i.e.sdkPath = path.dirname(jsonObject['typescript.tsdk'])
)If
sdkPath
is relative, assume it is relative to the directory being traversed. Check iftsserver
/tsc
binary exists under${sdkPath}/lib/${binaryName}.js
. If it exists, use it, else go to 2.atom-typescript.tsdkPath
as as path to TypeScript SDK installation directory. Check iftsserver
/tsc
binary exists under${tsdkPath}/lib/${binaryName}.js
. If it exists, use it, else go to 3.Notes:
jsonc-parser
instead of good-ol'JSON.parse
due to vscode compatibility layerP.S. (1) might seem somewhat extraneous, considering atomic-management exists, however, there are a few caveats with that, and we probably want a solution that isn't dependent on community packages (so that it works unconditionally)