Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Nix store path from source maps #1084

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project's release branch is `master`. This log is written from the perspect

* Obelisk.Route: add pathQueryEncoder and generalizeIdentity
* [#1071](https://github.com/obsidiansystems/obelisk/pull/1071): Support deployment information repository sub-directories
* [#1084](https://github.com/obsidiansystems/obelisk/pull/1084): Fix source maps on Chrome

## v1.3.0.0
* [#1047](https://github.com/obsidiansystems/obelisk/pull/1047): Update default ios sdk to 15
Expand Down
32 changes: 26 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,36 @@ in rec {
set -euo pipefail
cd '${haskellLib.justStaticExecutables frontend}'
shopt -s globstar
for f in **/all.js; do
dir="$out/$(basename "$(dirname "$f")")"

base=$(pwd)
mkdir -p "$out"
cd "$out"

for f in $base/**/all.js; do
dir="$(basename "$(dirname "$f")")"

mkdir -p "$dir"
ln -s "$(realpath "$f")" "$dir/all.unminified.js"
pushd "$dir"

ln -s "$(realpath "$f")" "$out/$dir/all.unminified.js"
${if optimizationLevel == null then ''
ln -s "$dir/all.unminified.js" "$dir/all.js"
ln -s "$out/$dir/all.unminified.js" "$out/$dir/all.js"
'' else ''
# NOTE: "--error_format JSON" avoids closurecompiler crashes when trying to report errors.
'${pkgs.closurecompiler}/bin/closure-compiler' --error_format JSON ${if externs == null then "" else "--externs '${externs}'"} --externs '${reflex-platform.ghcjsExternsJs}' -O '${optimizationLevel}' --jscomp_warning=checkVars --warning_level=QUIET --create_source_map="$dir/all.js.map" --source_map_format=V3 --js_output_file="$dir/all.js" "$dir/all.unminified.js"
echo '//# sourceMappingURL=all.js.map' >> "$dir/all.js"
'${pkgs.closurecompiler}/bin/closure-compiler' \
--error_format JSON \
${if externs == null then "" else "--externs '${externs}'"} \
--externs '${reflex-platform.ghcjsExternsJs}' \
-O '${optimizationLevel}' \
--jscomp_warning=checkVars \
--warning_level=QUIET \
--create_source_map="all.js.map" \
--source_map_format=V3 \
--js_output_file="all.js" \
"all.unminified.js"
echo '//# sourceMappingURL=all.js.map' >> "all.js"

popd
''}
done
'';
Expand Down