all repos — onyx @ c80313085e7c6f7569fb3d81500a1b5b761aae78

minimal map annotation and location data sharing tool

use temporary file for srcmap instead of on-disk file
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmL4npoACgkQO3+8IhRO
Y5iVVg/9HZYUisE+jMEYrU/RKPiMhPF0BnKfihpwJV6n85U5CpyVFUKZYVXSuvvn
VB1y590XnIumJaZ3dFw9mqYno8vvY87txw9qI+TyeT5zo5TgEiYt+8W1YRquKAiT
ojEJ4F2c3v61SHb7A8iDB8BVOZ7lEUy7I3vc2kvjCafVMJQ6YT0muSsk8BUUjYdH
HA7bYRghNagjAPTuXHkCd7qX0zR51XbpVV0k8FqTUznvLNENAvLjcoSZhglwJzVa
sazwuz89e2g0mCQhIMJYODRTAd8YaxI/vmiQFHQJpbyf3BWynGLqw3eSTOkiK6B7
MjnZWjzu7XFHBkVizzm4d6S2xjyHTih+Ss6rcfqQ/KgY4sAm9UJaX8QofeDhHxHq
mkzfiVIA9SwqrXajZxnI2+yeJYEK3p0NVMGRwYI+0VgG5kqu1PJcKxWA4Wh36M4V
MwYnsTAX1rEVIhWdQJBmomewu83cw5fWUKcXvDjQD7mQg58ohEk7pFO2YiIok081
K7Sl9f/O2bVYgEaRfmCkcJ4BsdNeh9uGiKrrRnPMCAUajRMjQBeU+LRBK8GpHgSF
LVIpc877bSybfs2Z5NyrhKiVyRP6c2ZstrLr50owzI85C281XK8MKYKIRfjeo6cU
6Xo4qDW80j/odk/UPXbAX/oQo8Eyaoo6XCAFBMu6UZN7YuJEjpA=
=53TF
-----END PGP SIGNATURE-----
commit

c80313085e7c6f7569fb3d81500a1b5b761aae78

parent

14f1abffa9bde5c85ad2192dc9116b1fcdfd914c

3 files changed, 9 insertions(+), 7 deletions(-)

jump to
M buildtools/sourcemapper.gobuildtools/sourcemapper.go

@@ -50,23 +50,24 @@ } else {

panic(err.Error()) } } else { - self += l + "\n" + self += l } } return self } func main() { - if len(os.Args) == 2 { + if len(os.Args) == 3 { errFilename := os.Args[1]; + srcMapFilename := os.Args[2]; errFile, err1 := os.ReadFile(errFilename); - srcMapFile, err2 := os.ReadFile(".srcmap"); + srcMapFile, err2 := os.ReadFile(srcMapFilename); if err1 != nil || err2 != nil { panic("Couldn't open either the error temp file or the source map"); } srcMap := srcMapDeserialize(string(srcMapFile[:])) fmt.Print(buildOutputTransform(string(errFile[:]), srcMap)) } else { - fmt.Println("usage: sourcemapper ERRFILE"); + fmt.Println("usage: sourcemapper ERRFILE SRCMAP"); } }
M src/build.shsrc/build.sh

@@ -9,12 +9,13 @@ progname=$1

fi # build the source map and concatenate the source +srcmap=$(mktemp) for f in *.ts; do lines=$(wc -l ${f}) set ${lines} lines=$1 - echo "${f}\t${lines}" >> .srcmap + echo "${f}\t${lines}" >> ${srcmap} cat ${f} >> ${progname}.ts done

@@ -25,9 +26,9 @@ # compile and write output to temporary file

tsc --strict --target ES2015 --outFile ../static/${progname}.js ${progname}.ts | sed -e s/\(/:/ -e s/,/:/ -e s/\):// | nobs >> ${errorOut} # translate lines into original source with the source map and output to stdout -../buildtools/sourcemapper ${errorOut} +../buildtools/sourcemapper ${errorOut} ${srcmap} # delete the temporary files rm ${errorOut} rm ${progname}.ts -rm .srcmap+rm ${srcmap}